Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have worked on Linux for a year. One thing bothers me is that I am not familiar with the process of installing new software with source code(I can't install them from netword due to environment limitations).

I was often blocked with different kinds of error, for example:

------------------------
libtool: install: error: relink `Magick++/lib/libMagick++.la' with the above command before installing it
------------------------

or

------------------------
magick/.libs/libMagickCore.so: undefined reference to `gzseek64'
magick/.libs/libMagickCore.so: undefined reference to `gztell64'
------------------------

Though I finally found solution with Google, I don't know exactly why it works.

Can anyone helps me with this situation or give me some advice on how to improve myself on such kind of things?

I am lacking of the knowledge of "configure","make","difference of 64bit","shared lib"; Could anyone point me in the right direction and give me some helpful books or articles?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Well, first two places to start are GNU make manual and GNU autoconf manual. http://www.gnu.org/software/make/manual/make.html and http://www.gnu.org/software/autoconf/manual/autoconf.html You don't need to understand everything now, but it will give you a feeling of what is going on behind the scenes.

Basically, when you configure a program, a make file for your system is made. Today a lot of software development is done using finished code which is packed is so called libraries. This way programmers don't need to focus on some things which are very important but at the same time irrelevant to their program. Take for example graphical user interface. In today's programs it is a necessary evil, because we don't have anything more advanced at the moment. Although many programs need to have GUI, it isn't particularly interesting to the programmer who is making the program. He'll want to focus on its main function instead. That is why GUI libraries are often used.

When you compile a program, the compiler needs to know where to find all the libraries program is using. The make will use makefile configured by autoconf to tell compiler where to find them. Autoconf will detect your system and appropriately configure makefile.

Also you may have noticed that source code of programs is contained in many files. These files are usually separately compiled. Make also takes care of the order in which these files need to be compiled. Once all files are compiled, they need to be linked together into one program. Linker does that. In the end, you get executable file which you can call.

Another interesting thing is that there is no need to call compiler by hand. Make will call it and use appropriate settings automagically.

Now about the errors you are getting: The undefined reference errors are because somehow autoconf configured a makefile for your system without correctly detecting all dependencies. Your program needs zlib to be correctly installed before compiling it. Autoconf should have told you that, but it seems that you started make which started compiler which cannot find zlib and produces errors.

The first error is made because of something called conditional compiling. Basically, you can tell autoconf that you don't want to use a part of the program. Then autoconf modifies makefile in such way that a part of the program isn't compiled. It seems to me that when Magick++ was compiled, some options were turned off. It is basically telling you that you need to turn them on.

A little bit about shared libraries. Once a program uses a library it can used as a static library which is linked so it is a part of the program or as a dynamic library which isn't actually part of the program. Static libraries are good when you want program which doesn't depend on anything else, but they take space in RAM and is several programs are using same library, each one will have to load it in RAM for its own use. Things are a bit different with dynamic libraries. Once a program is started, it loads the library into RAM and uses it. The library isn't a part of the program, so it needs to be separately installed. However, if several programs are using same library, it only needs to be loaded once into RAM and same copy will be used by all programs. This is almost always used with GUI libraries.

In the end since your computer doesn't have INTERNET access, be prepared for lots and lots of suffering. You'll never know when some program needs some obscure dependency or when a version of program you have installed is incompatible with the version your new program needs.

share|improve this answer
    
Really thanks for your help, AndrejaKo:) Your reply is a great help to me! I will go to the two places about gnu make you mentioned. Thanks a lot~~ –  bluesea007 Jun 20 '10 at 8:08
    
I have experience with Java applications which always have libraries in the same directory. However, when come to perl, things become complicated, because many shared libraries are used and I can not figure out the dependance. Could you recommend some books or articles on those topic to me? –  bluesea007 Jun 20 '10 at 8:09
    
Sorry, I never did any programming in Perl, so I don't know what it expects. This seems programming related, so you might try searching and asking at stackoverflow.com It's SU's sister site which solves programming problems. People there have more experience with this kind of stuff. Or you could start a new question here and hope someone helps. –  AndrejaKo Jun 22 '10 at 15:12
    
Thanks a lot :) –  bluesea007 Jun 23 '10 at 0:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.