I'm attempting to install an open source software qml in Mac high sierra. It's an interface btw kdb+ and LAPACK,BLAS. I've got the error message:
gcc-10 -m64 -fPIC -pipe -bundle -undefined dynamic_lookup -o qml.so const.o alloc.o util.o opt.o libm.o cephes.o lapack.o conmin.o conmax.o nlopt.o \
../lib/libprob.a ../lib/libconmax.a ../lib/libnlopt.a \
\
-llapack -lblas \
-lgfortran \
-lm \
-exported_symbols_list qml.symlist
duplicate symbol _call in:
conmin.o
conmax.o
duplicate symbol _call in:
conmin.o
nlopt.o
ld: 2 duplicate symbols for architecture x86_64
collect2: error: ld returned 1 exit status
I did some research and saw people fixed this issue by removing some Flags. here is the link can anyone help to see if any FLAG should be removed? Thanks. Here are the Flags:
FLAGS := -m64 -fPIC -pipe
LD_SHARED := -bundle -undefined dynamic_lookup
Related
I'm getting the following error when trying to link a code on a Mac (Montery). First let me say that up until a recent upgrade to Xcode the code built fine. GCC is 10, OpenMPI and it's a Fortran code. Now there are multiple executables which build and one libaray. The library compiles fine and is archived via ar (ar -ruvs). For example, here's a compile and build line for a code.
mpif90 -O2 -g -fexternal-blas -fbacktrace -fcheck=all,no-array-temps -fallow-argument-mismatch -I../../LIBSTELL/Release -I/opt/local/include -I. -c ../Sources/boozer_coords.f
mpif90 -shared -Wl,-no_compact_unwind -O2 -g -fexternal-blas -fbacktrace -fcheck=all,no-array-temps -fallow-argument-mismatch -I../../LIBSTELL/Release -I/opt/local/include -o xbooz_xform booz_jac.o read_wout_booz.o foranl.o allocate_boozer.o transpmn.o boozer_xform.o setup_booz.o write_boozmn.o harfun.o trigfunc.o booz_params.o vcoords.o boozer.o free_mem_boozer.o boozer_coords.o booz_persistent.o ../../LIBSTELL/Release/libstell.a -L/usr/lib -L/opt/local/lib -lopenblas -lscalapack -L/opt/local/lib -lnetcdf -lnetcdff -L/opt/local/lib -lfftw3 -L/opt/local/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lz -ldl -lm
This works fine and produces an executable. However, there is another code which links to this code. For that reason archives are made of the compiled code.
mpif90 -ffree-form -ffree-line-length-none -ffixed-line-length-none -O2 -g -fexternal-blas -fbacktrace -fcheck=all,no-array-temps -fallow-argument-mismatch -I../../LIBSTELL/Release -I../../BOOTSJ/Release -I/opt/local/include -I/opt/local/include -I. -c ../Sources/thrift_main.f90
mpif90 -shared -Wl,-no_compact_unwind -O2 -g -fexternal-blas -fbacktrace -fcheck=all,no-array-temps -fallow-argument-mismatch -I../../LIBSTELL/Release -I/opt/local/include -o xthrift thrift_interface_mod.o thrift_runtime.o thrift_main.o ../../BOOTSJ/Release/libbootsj.a ../../LIBSTELL/Release/libstell.a -L/usr/lib -L/opt/local/lib -lopenblas -lscalapack -L/opt/local/lib -lnetcdf -lnetcdff -L/opt/local/lib -lfftw3 -L/opt/local/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lz -ldl -lm
ld: in ../../BOOTSJ/Release/libbootsj.a(parambs.mod), archive member 'parambs.mod' with length 2800 is not mach-o or llvm bitcode file '../../BOOTSJ/Release/libbootsj.a' for architecture x86_64
collect2: error: ld returned 1 exit status
I've had limited success trying to understand the source of this error. Here's what the table for the archive looks like.
ar -t ../BOOTSJ/Release/libbootsj.a
__.SYMDEF SORTED
SIMPUN.o
al31.o
allocate_angles.o
allocate_radial.o
bongrid.o
bootsj.o
caprsh2.o
datain.o
deallocate_all.o
denmf.o
do_fft.o
driver.o
fraction.o
grad.o
othersums.o
output.o
parambs.o
positiv.o
read_boozer.o
reorganz.o
smooth1.o
sumit.o
temp.o
tok_fraction.o
trig.o
vmec0.o
woflam.o
parambs.mod
trig.mod
vmec0.mod
OK so I was adding the module files (.mod) to the archive. This was incorrect. Only the Object (.o) files should be in the archive.
If I understand correctly the compiler will use the -I <path> command to look for (.mod) files. So the archive only needs the object files.
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
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
/bin/sh ./libtool --tag=CXX --mode=link /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Users/unhammer/src/macdivvun-service/Dependencies
/Static/x86_64/include -fvisibility=hidden -std=c++1z -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -L/Users/unhammer/src/macdivvun-service/Dependencies/Static/x86_64/lib -o hfst-ospell main.o lib
hfstospell.la -n -L/usr/local/lib -licui18n -licuuc -licudata
libtool: link: /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Users/unhammer/src/macdivvun-service/Dependencies/Static/x86_64/include -fvisi
bility=hidden -std=c++1z -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -o hfst-ospell main.o -n -Wl,-bind_at_load -L/Users/unhammer/src/macdivvun-service/Dependencies/Static/x86_64/lib ./.libs/lib
hfstospell.a -L/usr/local/lib -licui18n -licuuc -licudata
clang: error: unknown argument: '-n'
make[1]: *** [hfst-ospell] Error 1
make: *** [all] Error 2
Where does that -n come from? How can I find out? I'm using xcodebuild, but xcodebuild -showBuildSettings -scheme Dependencies|grep -e -n gives nothing, and I see no -n in any of the flags in Makefile.am or configure.ac in the actual (autotools) project.
I looked at the actual goal being built in the generated Makefile, starting from the line $(AM_V_CXXLD)$(hfst_ospell_LINK) $(hfst_ospell_OBJECTS) $(hfst_ospell_LDADD) $(LIBS)
and manually checked all the variables there recursively. Finally, I saw that LIBS had -n -L/usr/local/lib -licui18n -licuuc -licudata. And LIBS was LIBS = #LIBS# in Makefile.in, so set by configure.ac, which ran icu-config --ldflags to set it.
For some reason, the version (57.1) of icu-config --ldflags that I had gave -n -L/usr/local/lib -licui18n -licuuc -licudata instead of -L/usr/local/lib -licui18n -licuuc -licudata. Upgrading icu solved it.
We are a team working on an R package containing C/C++ code. The package can successfully be installed on all the machines but one. These all run the same version of Mac OS X. I have provided the log files for the installation of the package on my computer (success) and a colleague's computer (error). The package depends on the Rcpp package and the GSL library, both of which were successfully installed on both machines.
My Computer
WARNING: ignoring environment value of R_HOME
* installing to library '/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15'
* installing *source* package 'mrenci' ...
** libs
*** arch - x86_64
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c MRMRTree.cc -o MRMRTree.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c Matrix.cc -o Matrix.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c MiMBuilder.cc -o MiMBuilder.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c SymmetricMatrix.cc -o SymmetricMatrix.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c adaptor.cc -o adaptor.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c memory.cc -o memory.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c tools.cc -o tools.o
/opt/local/bin/g++-mp-4.5 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/local/lib -o mrenci.so MRMRTree.o Matrix.o MiMBuilder.o SymmetricMatrix.o adaptor.o memory.o tools.o /Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/lib/x86_64/libRcpp.a -fopenmp -fopenmp -L/opt/local/lib/R/lib/x86_64 -lR
installing to /Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/mrenci/libs/x86_64
** R
** preparing package for lazy loading
** testing if installed package can be loaded
* DONE (mrenci)
Colleague's Computer
WARNING: ignoring environment value of R_HOME
* installing to library '/Library/Frameworks/R.framework/Versions/2.15/Resources/library'
* installing *source* package 'mrenci' ...
** libs
*** arch - x86_64
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c MRMRTree.cc -o MRMRTree.o
MRMRTree.cc: In member function 'double* const MRMRTree::bootstrap(unsigned int)':
MRMRTree.cc:73: warning: iteration variable 'i' is unsigned
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c Matrix.cc -o Matrix.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c MiMBuilder.cc -o MiMBuilder.o
MiMBuilder.cc: In member function 'Matrix* const MiMBuilder::createMiM(unsigned int*, unsigned int, unsigned int*, unsigned int)':
MiMBuilder.cc:102: warning: iteration variable 'i' is unsigned
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c SymmetricMatrix.cc -o SymmetricMatrix.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c adaptor.cc -o adaptor.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c memory.cc -o memory.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c tools.cc -o tools.o
g++ -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o mrenci.so MRMRTree.o Matrix.o MiMBuilder.o SymmetricMatrix.o adaptor.o memory.o tools.o /Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/lib/x86_64/libRcpp.a -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64
** R
** preparing package for lazy loading
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so, 6): Symbol not found: _GOMP_critical_name_end
Referenced from: /Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci'
At first, the installation on my colleague's computer would result in the compilation of the package for both architectures, upon which g++ complained about an unknown -arch argument. This issue, however, appears to have been mitigated by forcing the targeting of a single architecture x86_64. It is also worth noting that as a result of these errors, all computers now have several versions of R and g++. Is this an issue with the linker? Does the same compiler need to be used for both R and its packages? In the case of my computer, I never explicitly asked for g++-mp-4.5 to be used rather than the default g++ (version 4.2), so I figured R automatically detects it.
In case this is of any help, here is what my Makevars contains:
PKG_LIBS=`$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(SHLIB_OPENMP_CFLAGS) -fopenmp
PKG_CPPFLAGS=$(SHLIB_OPENMP_CXXFLAGS) -fopenmp
PKG_CFLAGS=$(SHLIB_OPENMP_CFLAGS) -fopenmp
The $(SHLIB_OPENMP_*FLAGS) flags seem to be defined only on my computer; -fopenmp flags were explicitly added for the package to work on all the machines.
Has anyone experienced similar issues? Any help would be appreciated.
I changed my colleague's ~/.R/Makevars to conform to my configs
LDFLAGS=-L/opt/local/lib
CC=/opt/local/bin/gcc-mp-4.5 -std=gnu99
CXX=/opt/local/bin/g++-mp-4.5
CPP=/opt/local/bin/gcc-mp-4.5 -std=gnu99 -E
CXXCPP=/opt/local/bin/g++-mp-4.5 -E
CFLAGS=-pipe -O2 -m64
CXXFLAGS=-pipe -O2 -m64
SHLIB_CXXLD=/opt/local/bin/g++-mp-4.5
SHLIB_CXXLDFLAGS=-dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
SHLIB_LD=/opt/local/bin/gcc-mp-4.5 -std=gnu99
SHLIB_LDFLAGS=-dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
Additionally, the --no-multiarch argument was used when issuing the installation command. And it now works on his computer.
The problem was because the use of openMP was hardwired (no checks) inside the code and clang did not support openMP at the same I asked the question. My colleague's R was installed using the default (Xcode) compiler when we were trying to use gcc via Mac Ports.
I'm trying to install cloog-ppl 0.15-11 in my 64 bit ubuntu 10.10. I get the following error during make. I guess it is wrt linking.
gcc -DHAVE_CONFIG_H -I. -I./include/cloog -I./include -I./include -Wall -fomit-frame-pointer -g -O2 -MT cloog.o -MD -MP -MF .deps/cloog.Tpo -c -o cloog.o `test -f 'source/cloog.c' || echo './'`source/cloog.c
mv -f .deps/cloog.Tpo .deps/cloog.Po
/bin/bash ./libtool --tag=CC --mode=link gcc -Wall -fomit-frame-pointer -g -O2 -o cloog cloog.o libcloog.la -lgmp -lppl_c -lppl -lgmpxx
libtool: link: gcc -Wall -fomit-frame-pointer -g -O2 -o .libs/cloog cloog.o ./.libs/libcloog.so /usr/lib/libgmp.so -lppl_c -lppl /usr/lib/libgmpxx.so
//usr/local/lib/libppl_c.so: undefined reference to `std::__detail::_List_node_base::_M_unhook()#GLIBCXX_3.4.15'
//usr/local/lib/libppl_c.so: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)#GLIBCXX_3.4.15'
//usr/local/lib/libppl_c.so: undefined reference to `std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&)#GLIBCXX_3.4.15'
//usr/local/lib/libppl_c.so: undefined reference to `std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)#GLIBCXX_3.4.15'
collect2: ld returned 1 exit status
make[1]: *** [cloog] Error 1
make[1]: Leaving directory `/home/praveen/cloog-ppl-0.15.11'
make: *** [all-recursive] Error 1
Can some one help me out on this ?
I have the same problem that I worked for a whole day!! I have a hit, as least this bug disappeared.
When it refers to GLIBCXX_3.4.15 it means that you are using a g++ or gcc with the library not providing the functions or classes you need, very likely 4.4 or 4.5. I changed my g++ and gcc to 4.6 and the problem was solved. For some references, you can check out the following:
How standard lib linked by libstdc++.so.6
Notice: I only get libstdc++.so.5 in /usr/lib when I have g++-4.5 installed. I think libstdc++ is the library that g++ and gcc used.
for changing the compiler version in Linux, see the following link:
Upgrade your compiler
Hope it helps!