Ask Your Question

Revision history [back]

Linking OpenCV and AVT Manta Camera through PvAPI interface - different Ubuntu systems - errors occur

Lets wrap up the problem as compact as possible ...

I have two possible configurations

  1. SETUP 1: Ubuntu 12.04 - CodeBlocks 10.05 - GCC compiler 4.6.3 - G++ compiler 4.6.3
  2. SETUP 2: Ubuntu 14.04 - CodeBlocks 13.12 - GCC compiler 4.6.4 - G++ compiler 4.8.2

On both systems I fire up codeblocs, make a new console project and copy the following code - pastebin due to not screwing the main point - to the main.cpp file.

I then configure my codeblocks in a similar way. I add the PvAPI.h file to the project and fire up the linker options. I then add all the following dependencies to link libraries:

/home/spu/Software/AVT_sdk/lib-pc/x64/4.5/libPvAPI.a
/usr/lib/x86_64-linux-gnu/librt.a
/usr/lib/x86_64-linux-gnu/libpthread.a

And to the other linker options

`pkg-config opencv --libs`

So far so good, until I decide to built the actual project.

  1. SETUP 1: everything builds fine and I can grab frames from the AVT cam.
  2. SETUP 2: results in a giant list of errors in the pthread lib

You can see the errors below

||=== Build: Debug in AVT_gigE_OpenCV (compiler: GNU GCC Compiler) ===|
/usr/lib/x86_64-linux-gnu/libpthread.a(nptl-init.o)||In function `__pthread_initialize_minimal_internal':|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|285|undefined reference to `__libc_setup_tls'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|303|undefined reference to `_dl_cpuclock_offset'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|419|undefined reference to `_dl_pagesize'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|428|undefined reference to `_dl_pagesize'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|448|undefined reference to `_dl_init_static_tls'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|450|undefined reference to `_dl_wait_lookup_done'|
/usr/lib/x86_64-linux-gnu/libpthread.a(nptl-init.o)||In function `__pthread_get_minstack':|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|471|undefined reference to `_dl_pagesize'|
/usr/lib/x86_64-linux-gnu/libpthread.a(pthread_create.o)||In function `allocate_stack':|
/build/buildd/eglibc-2.19/nptl/allocatestack.c|475|undefined reference to `_dl_stack_flags'|
/build/buildd/eglibc-2.19/nptl/allocatestack.c|614|undefined reference to `_dl_stack_flags'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-write.o)||In function `__write_nocancel':|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-read.o)||In function `__read_nocancel':|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-close.o)||In function `__close_nocancel':|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-close.o):/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|more undefined references to `__syscall_error' follow|
||=== Build failed: 15 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

After that I decided to make the G++ and Gcc compiler identical on both systems, error stills occur. Anyone has an idea what is going wrong?

Linking OpenCV and AVT Manta Camera through PvAPI interface - different Ubuntu systems - errors occur

Lets wrap up the problem as compact as possible ...

I have two possible configurations

  1. SETUP 1: Ubuntu 12.04 - CodeBlocks 10.05 - GCC compiler 4.6.3 - G++ compiler 4.6.3
  2. SETUP 2: Ubuntu 14.04 - CodeBlocks 13.12 - GCC compiler 4.6.4 - G++ compiler 4.8.2

On both systems I fire up codeblocs, make a new console project and copy the following code - pastebin due to not screwing the main point - to the main.cpp file.

I then configure my codeblocks in a similar way. I add the PvAPI.h file to the project and fire up the linker options. I then add all the following dependencies to link libraries:

/home/spu/Software/AVT_sdk/lib-pc/x64/4.5/libPvAPI.a
/usr/lib/x86_64-linux-gnu/librt.a
/usr/lib/x86_64-linux-gnu/libpthread.a

And to the other linker options

`pkg-config opencv --libs`

So far so good, until I decide to built the actual project.

  1. SETUP 1: everything builds fine and I can grab frames from the AVT cam.
  2. SETUP 2: results in a giant list of errors in the pthread lib

You can see the errors below

||=== Build: Debug in AVT_gigE_OpenCV (compiler: GNU GCC Compiler) ===|
/usr/lib/x86_64-linux-gnu/libpthread.a(nptl-init.o)||In function `__pthread_initialize_minimal_internal':|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|285|undefined reference to `__libc_setup_tls'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|303|undefined reference to `_dl_cpuclock_offset'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|419|undefined reference to `_dl_pagesize'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|428|undefined reference to `_dl_pagesize'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|448|undefined reference to `_dl_init_static_tls'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|450|undefined reference to `_dl_wait_lookup_done'|
/usr/lib/x86_64-linux-gnu/libpthread.a(nptl-init.o)||In function `__pthread_get_minstack':|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|471|undefined reference to `_dl_pagesize'|
/usr/lib/x86_64-linux-gnu/libpthread.a(pthread_create.o)||In function `allocate_stack':|
/build/buildd/eglibc-2.19/nptl/allocatestack.c|475|undefined reference to `_dl_stack_flags'|
/build/buildd/eglibc-2.19/nptl/allocatestack.c|614|undefined reference to `_dl_stack_flags'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-write.o)||In function `__write_nocancel':|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-read.o)||In function `__read_nocancel':|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-close.o)||In function `__close_nocancel':|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-close.o):/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|more undefined references to `__syscall_error' follow|
||=== Build failed: 15 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

After that I decided to make the G++ and Gcc compiler identical on both systems, error stills occur. Anyone has an idea what is going wrong?

UPDATE

I can confirm that it has to be something outside OpenCV causing these errors. Used exactly the same OpenCV version, build with same parameters but error still persists on 14.04 system. However, if anyone has had a similar experience, feel free to share!

Linking OpenCV and AVT Manta Camera through PvAPI interface - different Ubuntu systems - errors occur

Lets wrap up the problem as compact as possible ...

I have two possible configurations

  1. SETUP 1: Ubuntu 12.04 - CodeBlocks 10.05 - GCC compiler 4.6.3 - G++ compiler 4.6.3
  2. SETUP 2: Ubuntu 14.04 - CodeBlocks 13.12 - GCC compiler 4.6.4 - G++ compiler 4.8.2

On both systems I fire up codeblocs, make a new console project and copy the following code - pastebin due to not screwing the main point - to the main.cpp file.

I then configure my codeblocks in a similar way. I add the PvAPI.h file to the project and fire up the linker options. I then add all the following dependencies to link libraries:

/home/spu/Software/AVT_sdk/lib-pc/x64/4.5/libPvAPI.a
/usr/lib/x86_64-linux-gnu/librt.a
/usr/lib/x86_64-linux-gnu/libpthread.a

And to the other linker options

`pkg-config opencv --libs`

So far so good, until I decide to built the actual project.

  1. SETUP 1: everything builds fine and I can grab frames from the AVT cam.
  2. SETUP 2: results in a giant list of errors in the pthread lib

You can see the errors below

||=== Build: Debug in AVT_gigE_OpenCV (compiler: GNU GCC Compiler) ===|
/usr/lib/x86_64-linux-gnu/libpthread.a(nptl-init.o)||In function `__pthread_initialize_minimal_internal':|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|285|undefined reference to `__libc_setup_tls'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|303|undefined reference to `_dl_cpuclock_offset'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|419|undefined reference to `_dl_pagesize'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|428|undefined reference to `_dl_pagesize'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|448|undefined reference to `_dl_init_static_tls'|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|450|undefined reference to `_dl_wait_lookup_done'|
/usr/lib/x86_64-linux-gnu/libpthread.a(nptl-init.o)||In function `__pthread_get_minstack':|
/build/buildd/eglibc-2.19/nptl/nptl-init.c|471|undefined reference to `_dl_pagesize'|
/usr/lib/x86_64-linux-gnu/libpthread.a(pthread_create.o)||In function `allocate_stack':|
/build/buildd/eglibc-2.19/nptl/allocatestack.c|475|undefined reference to `_dl_stack_flags'|
/build/buildd/eglibc-2.19/nptl/allocatestack.c|614|undefined reference to `_dl_stack_flags'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-write.o)||In function `__write_nocancel':|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-read.o)||In function `__read_nocancel':|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-close.o)||In function `__close_nocancel':|
/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-close.o):/build/buildd/eglibc-2.19/nptl/../sysdeps/unix/syscall-template.S|81|more undefined references to `__syscall_error' follow|
||=== Build failed: 15 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

After that I decided to make the G++ and Gcc compiler identical on both systems, error stills occur. Anyone has an idea what is going wrong?

UPDATE

I can confirm that it has to be something outside OpenCV causing these errors. Used exactly the same OpenCV version, build with same parameters but error still persists on 14.04 system. However, if anyone has had a similar experience, feel free to share!

UPDATE 2

I have looked further and found this link. It states we should build libpthread and libc both dynamically or both statically. So I explicitly told my linker settings where to look.

Looking at my g++ command I am no longer statically linking

g++  -o bin/Debug/AVT_gigE_OpenCV obj/Debug/main.o  /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so   -L /usr/local/cuda-6.0/lib64  /home/spu/Software/AVT_sdk/lib-pc/x64/4.5/libPvAPI.a /usr/lib/x86_64-linux-gnu/librt.a /usr/lib/x86_64-linux-gnu/libpthread.a /usr/lib/x86_64-linux-gnu/libc.a

However, this doesnt do the trick because then a new error arises which is even more unsolvable.

PvNet.cpp:(.text+0x51f): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/x86_64-linux-gnu/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie

Applying the suggestion simply doesn't work. Will keep you updated!