Problem building samples (Ubuntu 15.10)

Problem building samples (Ubuntu 15.10)

Hi,

after a fresh install on Ubuntu 15.10 using the binaries with bundled TBB, I get the following error message when trying to build the samples (GNU Make 4.0, gcc 5.2.1, environment variables are sourced):

$ make
cd nqueens; make all
make[1]: Entering directory '/tmp/cnc-samples/nqueens'
cd nqueens; make all
make[2]: Entering directory '/tmp/cnc-samples/nqueens/nqueens'
g++ -c -I/opt/intel/cnc/1.0.100/include -pthread  -O3 -o nqueens.o nqueens.cpp
g++ -pthread  -O3 -o nqueens nqueens.o -L/opt/intel/cnc/1.0.100/lib/intel64 -lcnc -lrt -ltbb -ltbbmalloc
nqueens.o: In function `solve(int, bool, int)':
nqueens.cpp:(.text+0x79f): undefined reference to `CnC::Internal::tag_collection_i::tag_collection_i(CnC::Internal::context_base&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
nqueens.o: In function `CnC::Internal::tag_collection_base<NQueensConfig, CnC::preserve_tuner<NQueensConfig, cnc_hash<NQueensConfig>, cnc_equal<NQueensConfig> > >::tag_collection_base(CnC::Internal::context_base&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
nqueens.cpp:(.text._ZN3CnC8Internal19tag_collection_baseI13NQueensConfigNS_14preserve_tunerIS2_8cnc_hashIS2_E9cnc_equalIS2_EEEEC1ERNS0_12context_baseERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN3CnC8Internal19tag_collection_baseI13NQueensConfigNS_14preserve_tunerIS2_8cnc_hashIS2_E9cnc_equalIS2_EEEEC1ERNS0_12context_baseERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x8d): undefined reference to `CnC::Internal::tag_collection_i::tag_collection_i(CnC::Internal::context_base&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
nqueens.o: In function `char CnC::Internal::tagged_step_instance<NQueensConfig>::do_execute<QueensStep, nq_cnc_context>(CnC::Internal::step_instance_base*, QueensStep const&, NQueensConfig const&, nq_cnc_context&, CnC::Internal::context_base&, bool, bool, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
nqueens.cpp:(.text._ZN3CnC8Internal20tagged_step_instanceI13NQueensConfigE10do_executeI10QueensStep14nq_cnc_contextEEcPNS0_18step_instance_baseERKT_RKS2_RT0_RNS0_12context_baseEbbbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi[_ZN3CnC8Internal20tagged_step_instanceI13NQueensConfigE10do_executeI10QueensStep14nq_cnc_contextEEcPNS0_18step_instance_baseERKT_RKS2_RT0_RNS0_12context_baseEbbbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi]+0x1cd): undefined reference to `CnC::Internal::chronometer::add_record(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, unsigned long, unsigned long, unsigned long, unsigned long, double, double, double, char)'
collect2: error: ld returned 1 exit status
Makefile:29: recipe for target 'nqueens' failed
make[2]: *** [nqueens] Error 1
make[2]: Leaving directory '/tmp/cnc-samples/nqueens/nqueens'
Makefile:17: recipe for target 'nqueens/.dmy' failed
make[1]: *** [nqueens/.dmy] Error 2
make[1]: Leaving directory '/tmp/cnc-samples/nqueens'
Makefile:17: recipe for target 'nqueens/.dmy' failed
make: *** [nqueens/.dmy] Error 2

 

So somehow an undefined reference. Any idea what is going wrong? I'll have to brush up my C++/make knowledge along the way, maybe its a simple mistake to the keen observer. Thanks!

8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,
seems to an issue with g++ 5.2. The missing symbols are all from templates and so should be in nqueens.o. Looks like a compile/link mismatch. Have you tried suggestion mentioned here:

https://github.com/openframeworks/openFrameworks/issues/4203

?

frank

thanks frank!

I tried running make OPTS="-D_GLIBCXX_USE_CXX11_ABI=0", but seemingly to no avail.

$ make OPTS="-D_GLIBCXX_USE_CXX11_ABI=0"
cd nqueens; make all
make[1]: Entering directory '/tmp/cnc-samples/nqueens'
cd nqueens; make all
make[2]: Entering directory '/tmp/cnc-samples/nqueens/nqueens'
g++ -pthread -D_GLIBCXX_USE_CXX11_ABI=0 -O3 -o nqueens nqueens.o -L/opt/intel/cnc/1.0.100/lib/intel64 -lcnc -lrt -ltbb -ltbbmalloc
nqueens.o: In function `solve(int, bool, int)':
nqueens.cpp:(.text+0x79f): undefined reference to `CnC::Internal::tag_collection_i::tag_collection_i(CnC::Internal::context_base&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
...

 

I had a brief read of http://developerblog.redhat.com/2015/02/05/gcc5-and-the-c11-abi/. My understanding is limited, but might building CnC from source help to ensure ABI compatability?

Another line of thought: any g++ version known to be working?

Cheers

I am sorry you are having these issues. Unfortunately I have not tested it with g++ 5.x.

I'd assume that building everything from sources using the same compiler will solve your issues.

As you also suggest, using an older g++ might be easier. g++ 4.6 and 4.8 definitely work.

No worries, lets see if we can work our way around them!

I installed and ran with g++ 4.8.5. The same error still occurs -.- (output of make OPTS="-v" given below)

Any other ideas?

$ make OPTS="-v"
cd nqueens; make all
make[1]: Entering directory '/tmp/cnc-samples/nqueens'
cd nqueens; make all
make[2]: Entering directory '/tmp/cnc-samples/nqueens/nqueens'
g++ -pthread -v -O3 -o nqueens nqueens.o -L/opt/intel/cnc/1.0.100/lib/intel64 -lcnc -lrt -ltbb -ltbbmalloc
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.5-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.5 (Ubuntu 4.8.5-1ubuntu1) 
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/opt/intel/cnc/1.0.100/tbb42_20140122oss/lib/intel64/gcc4.4/:/opt/intel/cnc/1.0.100/lib/intel64/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-pthread' '-v' '-O3' '-o' 'nqueens' '-L/opt/intel/cnc/1.0.100/lib/intel64' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.8/collect2 --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o nqueens /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o -L/opt/intel/cnc/1.0.100/lib/intel64 -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/opt/intel/cnc/1.0.100/tbb42_20140122oss/lib/intel64/gcc4.4 -L/opt/intel/cnc/1.0.100/lib/intel64 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. nqueens.o -lcnc -lrt -ltbb -ltbbmalloc -lstdc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
nqueens.o: In function `solve(int, bool, int)':
nqueens.cpp:(.text+0x79f): undefined reference to `CnC::Internal::tag_collection_i::tag_collection_i(CnC::Internal::context_base&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
...

 

hm, is this specific to nqueens? Do other samples work?

Frank, you were right in the first place after all. I still had a stale nqueens.o file.

After deleting that, both g++ 5.2 with -D_GLIBCXX_USE_CXX11_ABI=0 and g++ 4.8 work.

Great - what a relief!

I am glad it now works for you.

frank

Leave a Comment

Please sign in to add a comment. Not a member? Join today