Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not build with current gcc, g++ and libtbb #2

Open
mr-wunderlich opened this issue Aug 1, 2016 · 0 comments
Open

Does not build with current gcc, g++ and libtbb #2

mr-wunderlich opened this issue Aug 1, 2016 · 0 comments

Comments

@mr-wunderlich
Copy link

Trying to build the main libraries with make release seems to work, even though it doesn't seem to link pthread properly and there is a missing symbol coming from itself:

➜  nvm_malloc git:(master) ld libnvmmalloc.so
ld: warning: cannot find entry symbol _start; not setting start address
libnvmmalloc.so: undefined reference to `pthread_detach'
libnvmmalloc.so: undefined reference to `error_and_exit'
libnvmmalloc.so: undefined reference to `pthread_create'

When executing make in the benchmark directory this results in a failed build:

➜  benchmark git:(master) make
g++ -std=c++11 -Wall -Isrc -I../src -O3 -DUSE_MALLOC -o build/bench_fastalloc -L.. -lpthread -ltbb -lnvmmalloc src/bench_fastalloc.cpp src/common.cpp
/tmp/ccw89qrE.o: In function `nvb::execute_in_pool(std::function<void (int)>, unsigned long)':
bench_fastalloc.cpp:(.text._ZN3nvb15execute_in_poolESt8functionIFviEEm[_ZN3nvb15execute_in_poolESt8functionIFviEEm]+0x236): undefined reference to `pthread_create'
/tmp/ccdSO6nd.o: In function `tbb::interface5::concurrent_hash_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*, nvb::StringHashCompare, tbb::tbb_allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*> > >::clear()':
common.cpp:(.text._ZN3tbb10interface519concurrent_hash_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPvN3nvb17StringHashCompareENS_13tbb_allocatorISt4pairIS7_S8_EEEE5clearEv[_ZN3tbb10interface519concurrent_hash_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPvN3nvb17StringHashCompareENS_13tbb_allocatorISt4pairIS7_S8_EEEE5clearEv]+0x8c): undefined reference to `tbb::internal::deallocate_via_handler_v3(void*)'
common.cpp:(.text._ZN3tbb10interface519concurrent_hash_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPvN3nvb17StringHashCompareENS_13tbb_allocatorISt4pairIS7_S8_EEEE5clearEv[_ZN3tbb10interface519concurrent_hash_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPvN3nvb17StringHashCompareENS_13tbb_allocatorISt4pairIS7_S8_EEEE5clearEv]+0xd3): undefined reference to `tbb::internal::NFS_Free(void*)'
collect2: error: ld returned 1 exit status
Makefile:21: recipe for target 'build/bench_fastalloc' failed
make: *** [build/bench_fastalloc] Error 1

Run on a fresh Ubuntu 16.04.1, with the following g++ and tbb:

➜  benchmark git:(master) g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --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-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-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 --enable-multilib --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 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.1)
➜  benchmark git:(master)
➜  benchmark git:(master) apt-cache show libtbb2
Package: libtbb2
Priority: extra
Section: universe/libs
Installed-Size: 378
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Steve Capper <[email protected]>
Architecture: amd64
Source: tbb
Version: 4.4~20151115-0ubuntu3
Depends: libc6 (>= 2.14), libgcc1 (>= 1:3.0), libstdc++6 (>= 5.2)
Filename: pool/universe/t/tbb/libtbb2_4.4~20151115-0ubuntu3_amd64.deb
Size: 110800
MD5sum: 3f45e19ca18c2bd428d8a574876ed47d
SHA1: 8023e835d148e553045583fcdbae24eb6b01506e
SHA256: a509a56479b6369ce59384a117dd7e7734b5a11162124aeb00de54c0deddc8e1
Description-en: parallelism library for C++ - runtime files
 TBB is a library that helps you leverage multi-core processor
 performance without having to be a threading expert. It represents a
 higher-level, task-based parallelism that abstracts platform details
 and threading mechanism for performance and scalability.
 .
 (Note: if you are a user of the i386 architecture, i.e., 32-bit Intel
 or compatible hardware, this package only supports Pentium4-compatible
 and higher processors.)
 .
 This package includes the TBB runtime files.
Description-md5: 597d0e658709781286f685402350c986
Multi-Arch: same
Homepage: http://threadingbuildingblocks.org/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 5y
Task: edubuntu-desktop-gnome, xubuntu-desktop, ubuntustudio-desktop, ubuntukylin-desktop

The problem seems to originate from wrong order of linked libraries and missing initiated symbol for error_and_exit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant