Mac OS X linking dynamic library - macos

I am trying to build this library under Mac OS X Lion, gcc4.8, XCode 5.0.2:
https://github.com/zeromq/zmqpp
I built gcc4.8 with:
brew install gcc48 --enable-all-languages
When I try to build it, the linker (in /usr/bin) gives these errors:
$ make
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/context.o src/zmqpp/context.cpp
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/frame.o src/zmqpp/frame.cpp
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/message.o src/zmqpp/message.cpp
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/poller.o src/zmqpp/poller.cpp
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/socket.o src/zmqpp/socket.cpp
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/zmqpp.o src/zmqpp/zmqpp.cpp
g++ -shared -dynamic -Wl,libzmqpp.so.3 -o ./build/max-g++/libzmqpp.so.3 build/max-g++/obj/zmqpp/context.o build/max-g++/obj/zmqpp/frame.o build/max-g++/obj/zmqpp/message.o build/max-g++/obj/zmqpp/poller.o build/max-g++/obj/zmqpp/socket.o build/max-g++/obj/zmqpp/zmqpp.o -lzmq
ld: file not found: libzmqpp.so.3
collect2: error: ld returned 1 exit status
make: *** [libzmqpp.so] Error 1
So I removed the r in front of dynamic so that it just reads
-dynamic
That seems to be ok. However, then I get
Mac-mini:zmqpp ivan$ make
g++ -shared -dynamic -Wl,-soname -Wl,libzmqpp.so.3 -o ./build/max-g++/libzmqpp.so.3 build/max-g++/obj/zmqpp/context.o build/max-g++/obj/zmqpp/frame.o build/max-g++/obj/zmqpp/message.o build/max-g++/obj/zmqpp/poller.o build/max-g++/obj/zmqpp/socket.o build/max-g++/obj/zmqpp/zmqpp.o -lzmq
ld: unknown option: -soname
collect2: error: ld returned 1 exit status
make: *** [libzmqpp.so] Error 1
I don't know how to get rid of this error. If I just remove -soname from the Makefile, I get
Mac-mini:zmqpp ivan$ make
g++ -shared -dynamic -Wl,libzmqpp.so.3 -o ./build/max-g++/libzmqpp.so.3 build/max-g++/obj/zmqpp/context.o build/max-g++/obj/zmqpp/frame.o build/max-g++/obj/zmqpp/message.o build/max-g++/obj/zmqpp/poller.o build/max-g++/obj/zmqpp/socket.o build/max-g++/obj/zmqpp/zmqpp.o -lzmq
ld: file not found: libzmqpp.so.3
collect2: error: ld returned 1 exit status
make: *** [libzmqpp.so] Error 1
libzmqpp.so.3 doen't even look like correct protocol for Mac dynamic libraries.
If I remove the entire line and replace it I get
Mac-mini:zmqpp ivan$ make
g++ -shared -dynamic -o ./build/max-g++/libzmqpp.so.3 build/max-g++/obj/zmqpp/context.o build/max-g++/obj/zmqpp/frame.o build/max-g++/obj/zmqpp/message.o build/max-g++/obj/zmqpp/poller.o build/max-g++/obj/zmqpp/socket.o build/max-g++/obj/zmqpp/zmqpp.o -lzmq
ar crf ./build/max-g++/libzmqpp.a build/max-g++/obj/zmqpp/context.o build/max-g++/obj/zmqpp/frame.o build/max-g++/obj/zmqpp/message.o build/max-g++/obj/zmqpp/poller.o build/max-g++/obj/zmqpp/socket.o build/max-g++/obj/zmqpp/zmqpp.o
ar: illegal option -- f
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make: *** [libzmqpp.a] Error 1
One thing, the ar it is using is the one in /usr/bin not in /usr/local/Cellar/gcc48/4.8.2/bin/gcc, gcc-ar-4.8

g++ -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-current_version,1.0,-install_name,/usr/local/lib/libzmqpp.3.dylib -o libzmqpp.1.dylib ./build/max-g++/obj/zmqpp/context.o ./build/max-g++/obj/zmqpp/frame.o ./build/max-g++/obj/zmqpp/message.o ./build/max-g++/obj/zmqpp/poller.o ./build/max-g++/obj/zmqpp/socket.o ./build/max-g++/obj/zmqpp/zmqpp.o -lzmq
According to this question this should work. I would try with and without the -dynamic. I build shared libraries all day long but don't have a mac. I am not sure why it is trying to build a static library with the ar command.
The mac linker doesn't take the arguments the linux ones do. Here is some information on building shared libraries on Mac.

Related

Error installing Mike's Arbitrary Precision Math Library (MAPM)

Please I need help, I need to install this library quickly for a project I am working on (https://github.com/LuaDist/mapm) and I don't understand makefile. Per the instructions I run the command "make" and get the following output:
gcc -c -Wall -O2 mapmhsin.c
gcc -c -Wall -O2 mapm_pow.c
gcc -c -Wall -O2 mapm_log.c
gcc -c -Wall -O2 mapm_lg2.c
gcc -c -Wall -O2 mapm_lg4.c
gcc -c -Wall -O2 mapm_exp.c
gcc -c -Wall -O2 mapm_lg3.c
gcc -c -Wall -O2 mapmasin.c
gcc -c -Wall -O2 mapmasn0.c
gcc -c -Wall -O2 mapm_sin.c
gcc -c -Wall -O2 mapm5sin.c
gcc -c -Wall -O2 mapmrsin.c
gcc -c -Wall -O2 mapm_cpi.c
gcc -c -Wall -O2 mapmsqrt.c
gcc -c -Wall -O2 mapmcbrt.c
gcc -c -Wall -O2 mapmgues.c
gcc -c -Wall -O2 mapmfact.c
gcc -c -Wall -O2 mapm_gcd.c
gcc -c -Wall -O2 mapmipwr.c
gcc -c -Wall -O2 mapmpwr2.c
gcc -c -Wall -O2 mapm_rnd.c
gcc -c -Wall -O2 mapm_flr.c
gcc -c -Wall -O2 mapm_fpf.c
gcc -c -Wall -O2 mapm_rcp.c
gcc -c -Wall -O2 mapmstck.c
gcc -c -Wall -O2 mapm_div.c
gcc -c -Wall -O2 mapm_mul.c
gcc -c -Wall -O3 mapmfmul.c
gcc -c -Wall -O2 mapm_fft.c
gcc -c -Wall -O2 mapm_add.c
gcc -c -Wall -O2 mapmistr.c
gcc -c -Wall -O2 mapm_set.c
gcc -c -Wall -O2 mapm_fam.c
gcc -c -Wall -O3 mapmutil.c
gcc -c -Wall -O2 mapmutl2.c
gcc -c -Wall -O2 mapmutl1.c
gcc -c -Wall -O2 mapmcnst.c
rm -f libmapm.a
ar rc libmapm.a mapmhasn.o mapmhsin.o mapm_pow.o mapm_log.o mapm_lg2.o mapm_lg4.o mapm_exp.o mapm_lg3.o mapmasin.o mapmasn0.o mapm_sin.o mapm5sin.o mapmrsin.o mapm_cpi.o mapmsqrt.o mapmcbrt.o mapmgues.o mapmfact.o mapm_gcd.o mapmipwr.o mapmpwr2.o mapm_rnd.o mapm_flr.o mapm_fpf.o mapm_rcp.o mapmstck.o mapm_div.o mapm_mul.o mapmfmul.o mapm_fft.o mapm_add.o mapmistr.o mapm_set.o mapm_fam.o mapmutil.o mapmutl2.o mapmutl1.o mapmcnst.o
gcc -c -Wall -O2 calc.c
gcc -s -static -o calc calc.o libmapm.a -lm
/usr/bin/ld: cannot find -lm
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make: *** [Makefile:63: calc] Error 1
It looks like everything goes fine until the end:
/usr/bin/ld: cannot find -lm
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
Is there any way I fix this, and what does the command -lm and -lc do?

"ld: library not found for -lc" in mac big sur

I try to writed a redis module by clone the git project https://github.com/RedisLabs/RedisModulesSDK.git
and type the "Make" command in my mac with big sur version, below message display in the console.
But there is a error "ld: library not found for -lc".
How to fix it. I try the same command in a linux os, it works find.
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o util.o util.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o strings.o strings.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o sds.o sds.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o vector.o vector.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o alloc.o alloc.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o periodic.o periodic.c
ar rcs librmutil.a util.o strings.o sds.o vector.o alloc.o periodic.o
gcc -I../ -Wall -g -fPIC -lc -lm -std=gnu99 -c -o module.o module.c
clang: warning: -lc: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
ld -o module.so module.o -bundle -undefined dynamic_lookup -v -L../rmutil -lrmutil -lc
#(#)PROGRAM:ld PROJECT:ld64-609.8
BUILD 15:07:46 Dec 18 2020
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
../rmutil
/usr/lib
/usr/local/lib
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/
ld: library not found for -lc
make[1]: *** [module.so] Error 1
make: *** [module.so] Error 2
To prevent this error on 11.x+: ld: library not found for -lc
the path /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib needs to be added with -L
https://github.com/macports/macports-ports/commit/0a780d32e0ae3997ed2f2d611cee604d1476cdb5

Caffe-segnet: redefinition of argument 'compiler-bindir'

It's been days trying to compile caffe-segnet, and now stuck at this error, I m using gcc gcc (Ubuntu 4.8.5-4ubuntu8) 4.8.5
to compile caffe-segnet. I'm using Cuda 9.0, cudnn v2 and opencv 3.3.0 as mentionned in the documentation of caffe and opencv. Disabling cudnn or not in the Makefile.config doesn't change anything as mentioned here.
Before that I was using cuda 10.0 and cudnn 7.0 and deleted all because when starting my model there was so many errors. Here is the output error when using make all:
CXX src/caffe/common.cpp
/usr/bin/g++-4.8 src/caffe/common.cpp -pthread -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -Wall -Wno-sign-compare -std=c++11 -MMD -MP -pthread -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -Wall -Wno-sign-compare -c -o .build_release/src/caffe/common.o 2> .build_release/src/caffe/common.o.warnings.txt \
|| (cat .build_release/src/caffe/common.o.warnings.txt; exit 1)
CXX src/caffe/internal_thread.cpp
/usr/bin/g++-4.8 src/caffe/internal_thread.cpp -pthread -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -Wall -Wno-sign-compare -std=c++11 -MMD -MP -pthread -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -Wall -Wno-sign-compare -c -o .build_release/src/caffe/internal_thread.o 2> .build_release/src/caffe/internal_thread.o.warnings.txt \
|| (cat .build_release/src/caffe/internal_thread.o.warnings.txt; exit 1)
NVCC src/caffe/layers/upsample_layer.cu
/usr/local/cuda/bin/nvcc -D_FORCE_INLINES -ccbin=/usr/bin/g++-4.8 -Xcompiler -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -std=c++11 -ccbin=/usr/bin/g++-4.8 -Xcompiler -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -M src/caffe/layers/upsample_layer.cu -o .build_release/cuda/src/caffe/layers/upsample_layer.d \
-odir .build_release/cuda/src/caffe/layers
nvcc fatal : redefinition of argument 'compiler-bindir'
Makefile:544: recipe for target '.build_release/cuda/src/caffe/layers/upsample_layer.o' failed
make: *** [.build_release/cuda/src/caffe/layers/upsample_layer.o] Error 1
and the line 544 in Makefile which the error come from:
...
# cat $#.$(WARNS_EXT)
$(BUILD_DIR)/cuda/%.o: %.cu | $(ALL_BUILD_DIRS)
544> # echo NVCC $<
$(Q)$(CUDA_DIR)/bin/nvcc $(NVCCFLAGS) $(CUDA_ARCH) -M $< -o ${#:.o=.d} \
-odir $(#D)
...
Notice that I tried compiling it with gcc 5 and gcc 7 and the same error occur ! Any idea guys ?
EDIT 1:
I also added this CUSTOM_CXX := /usr/bin/g++-4.8 to Makefile.config
Since no one aswered I finaly found a solution, the error is caused because the same argument is called twice, in my Makefile I added those lines of code:
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) -std=c++11
LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
to avoid this error /usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
In the same file in the complete build flags, we have the same flag:
...
# Complete build flags.
COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
# mex may invoke an older gcc that is too liberal with -Wuninitalized
...
what I did is commenting my flag I added:
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
#NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) -std=c++11
LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
and add -std=c++11 argument to NVCCFLAGS in the complete build flags section, it turned to be something like this:
...
# Complete build flags.
COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) -std=c++11
# mex may invoke an older gcc that is too liberal with -Wuninitalized
...
Before doing a make all after editing your Makefile, make sure you do a make clean or you'll get the same error !

gcc 4.9.2 build error on RHEL6

I'm trying to build gcc 4.9.2 on RHEL6, as follows:
unpack the source tarball (to ~/gcc-4.9.2)
in the source dir:
./contrib/download_prerequisites
create a separate build directory ~/gcc-4.9.2-build
in the build dir:
~/gcc-4.9.2/configure --prefix=/usr/local/gcc-4.9.2
make
This fails with:
make[6]: Entering directory `/root/gcc-4.9.2-build-try0/x86_64-unknown-linux-gnu/libjava/classpath/native/jni/java-math'
/bin/sh ../../../libtool --tag=CC --mode=compile /root/gcc-4.9.2-build-try0/./gcc/xgcc -B/root/gcc-4.9.2-build-try0/./gcc/ -B/usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/bin/ -B/usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/root/gcc-4.9.2/libjava/classpath/native/jni/java-math -I../../../include -I/root/gcc-4.9.2/libjava/classpath/include -I/root/gcc-4.9.2/libjava/classpath/native/jni/classpath -I/root/gcc-4.9.2/libjava/classpath/native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -I/usr/include -g -O2 -MT gnu_java_math_GMP.lo -MD -MP -MF .deps/gnu_java_math_GMP.Tpo -c -o gnu_java_math_GMP.lo /root/gcc-4.9.2/libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c
libtool: compile: /root/gcc-4.9.2-build-try0/./gcc/xgcc -B/root/gcc-4.9.2-build-try0/./gcc/ -B/usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/bin/ -B/usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/root/gcc-4.9.2/libjava/classpath/native/jni/java-math -I../../../include -I/root/gcc-4.9.2/libjava/classpath/include -I/root/gcc-4.9.2/libjava/classpath/native/jni/classpath -I/root/gcc-4.9.2/libjava/classpath/native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -I/usr/include -g -O2 -MT gnu_java_math_GMP.lo -MD -MP -MF .deps/gnu_java_math_GMP.Tpo -c /root/gcc-4.9.2/libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c -fPIC -DPIC -o .libs/gnu_java_math_GMP.o
mv -f .deps/gnu_java_math_GMP.Tpo .deps/gnu_java_math_GMP.Plo
/bin/sh ../../../libtool --tag=CC --mode=link /root/gcc-4.9.2-build-try0/./gcc/xgcc -B/root/gcc-4.9.2-build-try0/./gcc/ -B/usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/bin/ -B/usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/sys-include -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -I/usr/include -g -O2 -module -version-info 0:0:0 -no-undefined -lgmp -avoid-version -o libjavamath.la -rpath /usr/local/gcc-4.9.2/lib/../lib64/gcj-4.9.2-15 gnu_java_math_GMP.lo ../../../native/jni/classpath/jcl.lo -lrt
libtool: link: /root/gcc-4.9.2-build-try0/./gcc/xgcc -B/root/gcc-4.9.2-build-try0/./gcc/ -B/usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/bin/ -B/usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/sys-include -shared .libs/gnu_java_math_GMP.o ../../../native/jni/classpath/.libs/jcl.o /root/gcc-4.9.2-build-try0/./gmp/.libs/libgmp.a -lrt -Wl,-soname -Wl,libjavamath.so -o .libs/libjavamath.so
/usr/bin/ld: /root/gcc-4.9.2-build-try0/./gmp/.libs/libgmp.a(mp_set_fns.o): relocation R_X86_64_32 against `__gmp_default_allocate' can not be used when making a shared object; recompile with -fPIC
/root/gcc-4.9.2-build-try0/./gmp/.libs/libgmp.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[6]: *** [libjavamath.la] Error 1
make[6]: Leaving directory `/root/gcc-4.9.2-build-try0/x86_64-unknown-linux-gnu/libjava/classpath/native/jni/java-math'
A little googling pointed me at the --disable-shared option, which sort of helped, but now:
in the build dir:
~/gcc-4.9.2/configure --prefix=/usr/local/gcc-4.9.2 --disable-shared
make
yielded a slightly different error:
make[8]: Entering directory `/root/gcc-4.9.2-build/x86_64-unknown-linux-gnu/32/libjava/classpath/native/jni/classpath'
/bin/sh ../../../libtool --tag=CC --mode=compile /root/gcc-4.9.2-build/./gcc/xgcc -B/root/gcc-4.9.2-build/./gcc/ -B/usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/bin/ -B/usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc-4.9.2/x86_64-unknown-linux-gnu/sys-include -m32 -DHAVE_CONFIG_H -I. -I/root/gcc-4.9.2/libjava/classpath/native/jni/classpath -I../../../include -I/root/gcc-4.9.2/libjava/classpath/include -I/root/gcc-4.9.2/libjava/classpath/native/jni/classpath -I/root/gcc-4.9.2/libjava/classpath/native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -fexceptions -fasynchronous-unwind-tables -g -O2 -m32 -MT jcl.lo -MD -MP -MF .deps/jcl.Tpo -c -o jcl.lo /root/gcc-4.9.2/libjava/classpath/native/jni/classpath/jcl.c
libtool: compile: not configured to build any kind of library
libtool: compile: See the libtool documentation for more information.
libtool: compile: Fatal configuration error.
make[8]: *** [jcl.lo] Error 1
make[8]: Leaving directory `/root/gcc-4.9.2-build/x86_64-unknown-linux-gnu/32/libjava/classpath/native/jni/classpath'
Adding the --enable-static option made no difference.
Any suggestions on what might be wrong?
BTW, gcc 4.9.1 gave the same errors.
System: Linux 2.6.32-431.29.2.el6.x86_64 #1 SMP Sun Jul 27 15:55:46 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
System is RHEL6, fully updated via Redhat, and has no custom RPMs that I know of.
Just completed building 4.9.2 on a CentOS 6.4 VM using 4.4.7 gcc. Ran into an out of space issue, which caused the build to fail, but once resolved, everything else went smoothly.
Looks like your build is failing in the Java side of town? Not sure if you need the Java support, so have you tried compiling just the c/c++ language support?
~/gcc-4.9.2/configure --enable-languages=c,c++ ...
I also don't require 32-bit binaries, so I add --disable-multilib to the list of configure parameters.

GNU scientific library linking

My GNU scientific library (http://www.gnu.org/software/gsl/) installed in the path: /home/myname/gsl-1.6
My mlRho 1.7-stat prog (http://guanine.evolbio.mpg.de/mlRho/mlRho_1.7.tgz) which uses GNU scientific library-installed in:/home/myname/MlRho_1.7
my operating system: Fedora 16
original make file in mlRho
cd /home/myname/MlRho_1.7/
vim make
CC=gcc
CFLAGS= -O3 -Wall -Wshadow -pedantic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVER32 \
-I/opt/local/include/ -L/opt/local/lib/
I have changed path in mlRho
CC=gcc
CFLAGS= -O3 -Wall -Wshadow -pedantic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVER32 \
-I/home/myname/gsl-1.6 -L/home/myname/gsl-1.6
after making changes, I tried running make, it gives error
make
gcc -O3 -Wall -Wshadow -pedantic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVER32 -I/home/myname/gsl-1.6/include/ -L/home/myname/gsl-1.6/lib/ -c -o mlRho.o mlRho.c
In file included from mlRho.c:16:0:
mlComp.h:7:30: fatal error: gsl/gsl_sf_gamma.h: No such file or directory
compilation terminated.
make: *** [mlRho.o] Error 1
when i do make test- it gives me error below
make test
make[1]: Entering directory `/home/myname/MlRho_1.7/TestMlPi'
gcc -O3 -Wall -Wshadow -pedantic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVER32 -I/opt/local/include/ -L/opt/local/lib/ -c -o testMlPi.o testMlPi.c
testMlPi.c: In function ‘main’:
testMlPi.c:62:67: warning: variable ‘sderr’ set but not used [-Wunused-but-set-variable]
testMlPi.c:62:60: warning: variable ‘sdhet’ set but not used [-Wunused-but-set-variable]
gcc -O3 -Wall -Wshadow -pedantic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVER32 -I/opt/local/include/ -L/opt/local/lib/ -c -o interface.o interface.c
gcc -O3 -Wall -Wshadow -pedantic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVER32 -I/opt/local/include/ -L/opt/local/lib/ -c -o eprintf.o eprintf.c
gcc -O3 -Wall -Wshadow -pedantic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVER32 -I/opt/local/include/ -L/opt/local/lib/ -c -o ranNum.o ranNum.c
gcc -O3 -Wall -Wshadow -pedantic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVER32 -I/opt/local/include/ -L/opt/local/lib/ -o testMlPi testMlPi.o interface.o eprintf.o ranNum.o -lm
make[1]: Leaving directory `/home/myname/MlRho_1.7/TestMlPi'
Output from testMlPi:
pi: 5.00e-05 epsilon: 4.90e-04 -log(L): 1.40e+05
Output from mlRho:
make: ./mlRho: Command not found
make: *** [testPi] Error 127
Output from mlRho:
make: ./mlRho: Command not found
make: *** [testPi] Error 127
It somehow GNU library not linking to mlRho programme. How to fix it?

Resources