1

Warning: Newbie Ubuntu/g++ user

I'm trying to build a C++ app (C++11, OpenMP, OpenCV3, experimental filesystem) that works on another platform, but I get linker errors for missing libraries. The names are too generic to find answers via Google.

What do I need to install and/or configure to resolve these, please? I'm using g++ 6.2 on Ubuntu 16.04.1

g++ -g -pthread -m64 -I/usr/include/root -O3 -fprofile-generate \
-march=native -fomit-frame-pointer -std=c++11 -std=c++1y -fopenmp \
-flto -lstdc++fs -DNDEBUG  -c -o docproc.o docproc.cpp

/usr/bin/ld: cannot find -lGraf3d
/usr/bin/ld: cannot find -lPostscript
/usr/bin/ld: cannot find -lPhysics
collect2: error: ld returned 1 exit status

Here's my g++ version

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.2.0-3ubuntu11~16.04' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --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-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-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 6.2.0 20160901 (Ubuntu 6.2.0-3ubuntu11~16.04)
cdmh
  • 3,294
  • 2
  • 26
  • 41
  • Which libraries does the linker say are missing? – Jonathan Mee Nov 04 '16 at 15:51
  • 1
    I think "/usr/bin/ld: cannot find" -lGraf3d, -lPostscript and -lPhysics are libraries? – cdmh Nov 04 '16 at 15:53
  • Have you installed: "libroot-\*", "root-plugin-\*", and "root-system-\*"? – Jonathan Mee Nov 04 '16 at 15:59
  • I installed `libroot-core-dev` because my makefile uses `root-config`. Is this a problem? Do I need more? – cdmh Nov 04 '16 at 16:05
  • [This](https://root.cern.ch/phpBB3/viewtopic.php?t=16352#p70058) seems to think that might be the problem... – Jonathan Mee Nov 04 '16 at 16:06
  • I installed all `libroot-*`, `root-plugin-*`, `root-system-*` (except for `root-system-rootd`) and the `ttf-root-installer` packages, and those errors have gone, but I now get `/usr/bin/ld: /tmp/cc3AgAJm.ltrans2.ltrans.o: undefined reference to symbol 'GOMP_parallel@@GOMP_4.0' //usr/lib/x86_64-linux-gnu/libgomp.so.1: error adding symbols: DSO missing from command line` – cdmh Nov 04 '16 at 16:25
  • Where did: "//usr/lib/x86_64-linux-gnu/libgomp.so.1" come from? Did you build it? Did your program? – Jonathan Mee Nov 04 '16 at 16:27
  • I didn't build it, no. I think it's the OpenMP library? – cdmh Nov 04 '16 at 16:29
  • Looks like it's an OpenCV3 problem. And I'm not seeing much insight on this answer: http://stackoverflow.com/q/40322301/2642059 We should probably close out this question and ask another one against OpenCV3 (which I don't have a lot of experience with.) Do you want me to post the package install answer so you can accept it, or do you just want to delete this? – Jonathan Mee Nov 04 '16 at 16:34
  • That would be great, thanks and I'll accept. Really appreciate your help :) – cdmh Nov 04 '16 at 16:35
  • Yeah man, there's nothing more frustrating than linking issues. Speaking of linking, if you'll post a link to the OpenCV3 question you post I'd at least like to keep an eye on it to hopefully see it resolved. – Jonathan Mee Nov 04 '16 at 16:39
  • Thanks. I think it's a `makefile` problem, not `OpenCV`. Here's the details. http://stackoverflow.com/q/40428108/198083 – cdmh Nov 04 '16 at 17:00
  • I saw you bot an answer from [Barry](http://stackoverflow.com/users/2069064/barry) that guy's amazing. It looks like I've accepted 11 of his answers: http://data.stackexchange.com/stackoverflow/query/573518 Hopefully this has you past all your linking issues and on to actual coding? – Jonathan Mee Nov 07 '16 at 14:51
  • 1
    @JonathanMee yes, I've got past the hurdles now thanks to the both of you. g++ is a very different environment for me ;) – cdmh Nov 08 '16 at 15:00

1 Answers1

2

This seems to have been solved in the past by installing:

  • libroot-*
  • root-plugin-*
  • root-system-*
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288