Compiling a package from source files
apple Verified ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I am trying to install a package from source files. The installation instructions for this package say that I should just download the scripts to one directory, enter the correct paths in the Makefile (which comes with the package) and run "make".
The problem is that while the g++ compiler is there on my computer
(there is a binary called g++ located at
/Developer/usr/bin/g++
)
I am not sure if that is the real compiler. Or where the c header files are, for instance, I can't find math.h, or stdio.h or any of the other standard files.
Any help will be greatly appreciated. I am very new to command lines, so please explain as you would to a five year old.
To help with specifics, I edited the Makefile so that the first part looks like:
#MATLABDIR ?= /usr/local/matlab
# for Mac
MATLABDIR ?= /Applications/MATLAB_R2008b.app
CXX ?= g++
#CXX = g++-4.1
CFLAGS = -Wall -Wconversion -O3 -fPIC -I$(MATLABDIR)/extern/include
Thanks a ton for the help
7 replies
Sign in or join Beachball Help to reply.
- 0
Tom Gewecke ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
For command line stuff probably best to post in the Unix forum:
- 0
KJK555 ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Your compiler program is gcc. (/usr/bin/gcc).
http://gcc.gnu.org/in terminal type (at the prompt):
gcc --version
(press return)should output the following:
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) (dot 1)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.If it does, your compiler is alive and kicking and ready for action, if not, reinstall developer tools
package from your SL install DVD.The usual ritual for compiling is to drag the directory containing the source code to your desktop,
then, in terminal, change terminal path to the source directory using the change directory command
"cd".
example; say I have a program called cdrtools 2.0.1 and the source is in a folder I dragged to my
desktop called cdrtools_2.0.1:
In terminal i would type:
cd /Users/kj/Desktop/cdrtools_2.0.1Follow the instructions that come with the package. Typically they will tell you to:
./configure
( Many packages have a configure script which will query your system and configure themselves
appropriately. Not supported by all software).make
( Compile the software. Some require a file name to build such as make foo. make reads a file
normally called Makefile for what commands to run).make install
( Install the software. Typically packages will put themselves in /usr/local. Run as root).That is the usual ritual, but you must follow the instructions that come with the software, as they
may vary.Read documentation!
Look for files called: INSTALL, README, SETUP, or similar.For more information see the following:
http://luv.asn.au/overheads/compile.htmlNow beware that some source code written before Snow Leopard was released may not compile
properly on SL, because of SL's 64Bit gcc extensions. If the source has not been updated to run
under the Snow Leopard compiler, then the compilation may fail.IF the program fails to compile, or fails to run after compiling, then most likely, then the source
may need updating.good luck, and don't pull all your hair out at once. Save some for later. 🙂
The guys in the 'NIX forum can help you with all the grizzly details as you go on your quest.
http://discussions.apple.com/forum.jspa?forumID=735Good luck,
Kj ♘ - 0
Achy Main ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I wanted to add something. The first 5 of the 250 or so errors that "make" gives me are
g++ -Wall -Wconversion -O3 -fPIC -I/Applications/MATLAB_R2008b.app/extern/include -c svm.cpp
svm.cpp:1:18: error: math.h: No such file or directory
svm.cpp:2:19: error: stdio.h: No such file or directory
svm.cpp:3:20: error: stdlib.h: No such file or directory
svm.cpp:4:19: error: ctype.h: No such file or directory
svm.cpp:6:20: error: string.h: No such file or directory - 0
Tom Gewecke ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
For command line stuff probably best to post in the Unix forum:
- 0
KJK555 ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Your compiler program is gcc. (/usr/bin/gcc).
http://gcc.gnu.org/in terminal type (at the prompt):
gcc --version
(press return)should output the following:
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) (dot 1)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.If it does, your compiler is alive and kicking and ready for action, if not, reinstall developer tools
package from your SL install DVD.The usual ritual for compiling is to drag the directory containing the source code to your desktop,
then, in terminal, change terminal path to the source directory using the change directory command
"cd".
example; say I have a program called cdrtools 2.0.1 and the source is in a folder I dragged to my
desktop called cdrtools_2.0.1:
In terminal i would type:
cd /Users/kj/Desktop/cdrtools_2.0.1Follow the instructions that come with the package. Typically they will tell you to:
./configure
( Many packages have a configure script which will query your system and configure themselves
appropriately. Not supported by all software).make
( Compile the software. Some require a file name to build such as make foo. make reads a file
normally called Makefile for what commands to run).make install
( Install the software. Typically packages will put themselves in /usr/local. Run as root).That is the usual ritual, but you must follow the instructions that come with the software, as they
may vary.Read documentation!
Look for files called: INSTALL, README, SETUP, or similar.For more information see the following:
http://luv.asn.au/overheads/compile.htmlNow beware that some source code written before Snow Leopard was released may not compile
properly on SL, because of SL's 64Bit gcc extensions. If the source has not been updated to run
under the Snow Leopard compiler, then the compilation may fail.IF the program fails to compile, or fails to run after compiling, then most likely, then the source
may need updating.good luck, and don't pull all your hair out at once. Save some for later. 🙂
The guys in the 'NIX forum can help you with all the grizzly details as you go on your quest.
http://discussions.apple.com/forum.jspa?forumID=735Good luck,
Kj ♘ - 0
Achy Main ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Thanks for the detailed response. so here is what I do:
on typing:
]> gcc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Then, when in the folder which contains the source files, I type "make" as there is no ./configure file, and there is a Makefile. The makefile requires addresses for the Matlab installation, which I give it as
MATLABDIR ?= /Applications/MATLAB_R2008b.app
This, I have checked, is the path for the Matlab folder.
The README then says, that all I need to do is type "make". On doing that, I get the same output as before:
]> make
g++ -Wall -Wconversion -O3 -fPIC -I/Applications/MATLAB_R2008b.app/extern/include -c svm.cpp
svm.cpp:1:18: error: math.h: No such file or directory
svm.cpp:2:19: error: stdio.h: No such file or directory
svm.cpp:3:20: error: stdlib.h: No such file or directory
svm.cpp:4:19: error: ctype.h: No such file or directory
svm.cpp:6:20: error: string.h: No such file or directory
svm.cpp: In function ‘void clone(T*&, S*, int)’:Message was edited by: Achy Main
- 0
Achy Main ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Nearly complete solution in the following thread:
http://discussions.apple.com/thread.jspa?threadID=2383185&tstart=0
Thanks everyone.