问题
I'm trying to compile and install git on a shared RHEL5 host, but have no zlib-devel libraries installed. I've extracted the libraries from the RPM, but can't work out how to get make to recognise them. I get the following message:
cache.h:17:18: error: zlib.h: No such file or directory
Have tried the following:
CFLAGS='-I$HOME/root/usr/include -L$HOME/root/usr/lib64' make
but this doesn't seem to work. I've also tried setting
C_INCLUDE_PATH='$HOME/root/usr/include
Again, no luck. Any ideas? Needless to say, zlib.h is in $HOME/root/usr/include.
回答1:
Updated as I tried this on my own Linux machine
You can use CPPFLAGS
to specify your additional include directories.
CPPFLAGS="-I $HOME/root/usr/include" ./configure
Also, if you are trying to make a 64-bit version, you do not specify linking to a location with 64-bit libraries to make it happen. Instead, you pass the -m64
compiler flag in your CFLAGS
, like this:
CFLAGS="-m64" CPPFLAGS="-I $HOME/root/usr/include" ./configure
And if you have to specify additional non-standard library directories, use LDFLAGS
.
来源:https://stackoverflow.com/questions/4105839/compile-git-on-shared-host-without-zlib-devel