How to remove a link option from ld in make file? - makefile

I'm installing a ROOT class and I ran into an error.
caffeinated:libroot-hijing-1.7 sudoankit$ make
/bin/sh ../libtool --tag=CXX --mode=link /usr/bin/g++ -std=gnu++11 -g -O2 -L/usr/local/Cellar/root6/6.06.08/lib/root -R /usr/local/Cellar/root6/6.06.08/lib/root -version-info 1:7:0 -o libTHijing.la -rpath /Users/sudoankit/lib THijing.lo THijingMinBias.lo THijingFlow.lo THijingPara.lo TRanMar.lo ran.lo hijing1.383.lo hipyset1.35.lo THijingDict.lo -lCint -lCore -lTree -lPhysics -lGraf3d -lGraf -lHist -lMatrix -lEG -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0 -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0/../../.. -lgfortran -lquadmath -lm
libtool: link: /usr/bin/g++ -std=gnu++11 -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o .libs/libTHijing.1.dylib .libs/THijing.o .libs/THijingMinBias.o .libs/THijingFlow.o .libs/THijingPara.o .libs/TRanMar.o .libs/ran.o .libs/hijing1.383.o .libs/hipyset1.35.o .libs/THijingDict.o -L/usr/local/Cellar/root6/6.06.08/lib/root -lCint -lCore -lTree -lPhysics -lGraf3d -lGraf -lHist -lMatrix -lEG -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0 -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0/../../.. -lgfortran -lquadmath -lm -g -O2 -install_name /Users/sudoankit/lib/libTHijing.1.dylib -compatibility_version 2 -current_version 2.7 -Wl,-single_module
ld: library not found for -lCint
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libTHijing.la] Error 1
make: *** [all-recursive] Error 1
The solution I found after some time is to remove the -lCint library from ld. How should I do this? Where is the linking located in the Makefile? Or the configure file?

An example of filter-out:
A = X Y -lCint Z
B = $(filter-out -lCint, $(A))
all:
#echo $(B)

Related

Has anyone built gcc 8.2.0 on OpenBSD 6.3?

I am getting the following error when I try to build gcc 8.2.0 on OpenBSD 6.3:
/bin/sh ./libtool --tag=CC --mode=compile /home/shane/gcc-8.2.0/host-i386-unknown-openbsd6.3/gcc/xgcc -B/home/shane/gcc-8.2.0/host-i386-unknown-openbsd6.3/gcc/ -B/opt/gcc-8.2.0/i386-unknown-openbsd6.3/bin/ -B/opt/gcc-8.2.0/i386-unknown-openbsd6.3/lib/ -isystem /opt/gcc-8.2.0/i386-unknown-openbsd6.3/include -isystem /opt/gcc-8.2.0/i386-unknown-openbsd6.3/sys-include -DHAVE_CONFIG_H -I../.././libatomic/config/x86 -I../.././libatomic/config/posix -I../.././libatomic -I. -march=i486 -mtune=i386 -fomit-frame-pointer -Wall -Werror -pthread -g -O2 -MT fence.lo -MD -MP -MF .deps/fence.Tpo -c -o fence.lo ../.././libatomic/fence.c
libtool: compile: /home/shane/gcc-8.2.0/host-i386-unknown-openbsd6.3/gcc/xgcc -B/home/shane/gcc-8.2.0/host-i386-unknown-openbsd6.3/gcc/ -B/opt/gcc-8.2.0/i386-unknown-openbsd6.3/bin/ -B/opt/gcc-8.2.0/i386-unknown-openbsd6.3/lib/ -isystem /opt/gcc-8.2.0/i386-unknown-openbsd6.3/include -isystem /opt/gcc-8.2.0/i386-unknown-openbsd6.3/sys-include -DHAVE_CONFIG_H -I../.././libatomic/config/x86 -I../.././libatomic/config/posix -I../.././libatomic -I. -march=i486 -mtune=i386 -fomit-frame-pointer -Wall -Werror -pthread -g -O2 -MT fence.lo -MD -MP -MF .deps/fence.Tpo -c ../.././libatomic/fence.c -fPIC -DPIC -o .libs/fence.o
../.././libatomic/fence.c:26:10: fatal error: stdatomic.h: No such file or directory
#include <stdatomic.h>
^~~~~~~~~~~~~
compilation terminated.
gmake[4]: *** [Makefile:491: fence.lo] Error 1
gmake[4]: Leaving directory '/home/shane/gcc-8.2.0/i386-unknown-openbsd6.3/libatomic'
gmake[3]: *** [Makefile:524: all-recursive] Error 1
gmake[3]: Leaving directory '/home/shane/gcc-8.2.0/i386-unknown openbsd6.3/libatomic'
gmake[2]: *** [Makefile:360: all] Error 2
gmake[2]: Leaving directory '/home/shane/gcc-8.2.0/i386-unknown-openbsd6.3/libatomic'
gmake[1]: *** [Makefile:21680: all-target-libatomic] Error 2
gmake[1]: Leaving directory '/home/shane/gcc-8.2.0'
gmake: *** [Makefile:943: all] Error 2
My process:
Install OpenBSD (using defaults)
Run syspatch
Add some packages:
# pkg_add wget
# pkg_add gmp mpfr libmpc
# pkg_add gmake
Get the source:
$ wget ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-8.2.0/gcc-8.2.0.tar.gz
$ tar xzf gcc-8.2.0.tar.gz
$ cd gcc-8.2.0
Build:
$ ./configure --prefix=/opt/gcc-8.2.0 --with-gmp=/usr/local --enable-languages=c,c++
$ gmake
This also fails with gcc 8.1.0 in a similar way.
I also tried using clang rather than gcc to build, like this:
$ CC=cc CXX=c++ ./configure --prefix=/opt/gcc-8.2.0 --with-gmp=/usr/local --enable-languages=c,c++
That made no difference, which makes some sense as apparently it is failing in stage 3 (gcc compiling itself again for a final check).
Annoyingly, there is a stdatomic.h file in the tarball:
$ find gcc-8.2.0 -name stdatomic.h
gcc-8.2.0/gcc/ginclude/stdatomic.h
So I have no idea what I am missing.
Has anyone successfully built this? How?

clang: error: unknown argument: '-n' from libtool on macos

/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.

Building Lua 5.0 on 64bit Mac

For compatibility/legacy reasons I need to build the Lua compiler (luac) from version 5.0, on my 64bit Intel Mac. (5.1 or later can't be used.)
Dev tools installed through Xcode 4.6's Preferences window.
After I 'cd' in to the Lua directory, I issue the command 'make'.
cd include; make all
make[1]: Nothing to be done for `all'.
cd src; make all
make[1]: Nothing to be done for `all'.
cd src/lib; make all
make[1]: Nothing to be done for `all'.
cd src/luac; make all
gcc -o ../../bin/luac luac.o print.o lopcodes.o -L../../lib -llua -llualib -lm
Undefined symbols for architecture x86_64:
"_UNUSED", referenced from:
_writer in luac.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [../../bin/luac] Error 1
make: *** [all] Error 2
I do not know how to configure the make process for x86_64. Could someone please step me through it?
Thanks.
It works for me, but the output below is different from yours:
...
cd src/luac; make all
gcc -O2 -Wall -I../../include -I.. -c -o luac.o luac.c
gcc -O2 -Wall -I../../include -I.. -c -o print.o print.c
gcc -o lopcodes.o -c -O2 -Wall -I../../include -I.. -DLUA_OPNAMES ../lopcodes.c
gcc -o ../../bin/luac luac.o print.o lopcodes.o -L../../lib -llua -llualib -lm
cd src/lua; make all
gcc -O2 -Wall -I../../include -c -o lua.o lua.c
Try make clean all at the top level first.

gcc file not found issue

I'm trying to compile a simple little test program. and I'm getting errors:
MacBook-Air:Untitled user$ ls
main.c makefile utils.c utils.h
MacBook-Air:Untitled user$ make
avr-gcc -I. -g -mmcu=atmega640 -Os -fpack-struct -fshort-enums -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -Wa,-ahlms=main.lst -c main.c -o main.o
make: avr-gcc: No such file or directory
make: *** [main.o] Error 1
MacBook-Air:Untitled user$
What file is gcc complaining about? main.c does exist in the same directory as the makefile so I'm confused.
It's not the C file it can't find, it's the C compiler (avr-gcc). Is it defined in the makefile? E.g. CC=avr-gcc ? You could try replacing that with CC=gcc

Cloog-ppl make error

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!

Resources