PDA

View Full Version : How to compile source code in mac os?




MacMan988
Mar 1, 2013, 10:43 PM
Hi guys, I have been trying to install some programs such as Tesseract which requires compilations and I really don't have a clue about what those terminal commands such as "./configure","make","make install" are doing and I would like to learn more about those steps.

Are they gonna make the source compiled and installed completely? Are those commands enough to get the source compiled and running when I type the program name in Terminal? Or do I have to manually place the executable file generated somewhere in the OS so it can file it up when I type the program name in Terminal?

Thanks.



LPZ
Mar 2, 2013, 04:38 AM
Hi guys, I have been trying to install some programs such as Tesseract which requires compilations and I really don't have a clue about what those terminal commands such as "./configure","make","make install" are doing and I would like to learn more about those steps.

Are they gonna make the source compiled and installed completely? Are those commands enough to get the source compiled and running when I type the program name in Terminal? Or do I have to manually place the executable file generated somewhere in the OS so it can file it up when I type the program name in Terminal?

Thanks.

First, please check out MacPorts (http://www.macports.org/). You might find it a better choice than building your own binaries from source.

"configure" can be used to enable/disable features in the software you are building. The output of configure is a "makefile". "make" reads the info in the makefile and directs the actual compiling of the source code and the linking of libraries. Invoking "make install" installs the executable and supporting files in your file system. Typically, by default the executable goes in /usr/local/bin. But this can be specified in the configure process. If /usr/local/bin is the list of search paths specified by your PATH variable, you should be able to invoke your program simply by entering its name at a Terminal prompt. In any case, you should always be able to invoke the program by entering its full path: /usr/local/bin/name-goes-here.

Again, please check out MacPorts.:)

balamw
Mar 2, 2013, 07:10 AM
Again, please check out MacPorts.:)

Especially since they do have a tesseract port. https://trac.macports.org/browser/trunk/dports/textproc/tesseract/Portfile

The precursor to installing macports though is installing Xcode and the Command Line Tools in order to be able to compile code at all.

EDIT: MOD NOTE: I think the folks in the programming forum might be able to help more so I moved the thread there even though it is not strictly a programming question/thread.

B

MacMan988
Mar 2, 2013, 10:40 PM
Thank you for all the information you have provided. And specially thanks for telling me about MacPorts ! :)