Link failure building opencv-2.1.0 on NetBSD (Bug #726)


Added by Thomas Klausner over 14 years ago. Updated over 14 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:- % Done:

0%

Category:build/install
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

CMake has a test for libdl, and it is not found.
(On NetBSD, dl*() are included in libc itself, so it's not needed.)

However, the build tries to link against libdl anyway, which fails.

The last line of the build is:

cd /scratch/nih/opencv/work/OpenCV-2.1.0/src/cxcore && /usr/pkg/bin/cmake -E cmake_link_script CMakeFiles/cxcore.dir/link.txt --verbose=1
/scratch/nih/opencv/work/.wrapper/bin/c++ -fPIC -O2 -I/usr/pkg/include -I/usr/include -I/usr/X11R7/include -I/usr/X11R7/include/freetype2 -Wall -Wno-long-long -pthread -ffunction-sections -DNDEBUG -fomit-frame-pointer -O3 -ffast-math -msse -msse2 -DNDEBUG -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -shared -Wl,-soname,libcxcore.so.2.1 -o ../../lib/libcxcore.so.2.1.0 CMakeFiles/cxcore.dir/cxalloc.o CMakeFiles/cxcore.dir/cxarithm.o CMakeFiles/cxcore.dir/cxarray.o CMakeFiles/cxcore.dir/cxconvert.o CMakeFiles/cxcore.dir/cxcopy.o CMakeFiles/cxcore.dir/cxdatastructs.o CMakeFiles/cxcore.dir/cxdrawing.o CMakeFiles/cxcore.dir/cxdxt.o CMakeFiles/cxcore.dir/cxflann.o CMakeFiles/cxcore.dir/cxlapack.o CMakeFiles/cxcore.dir/cxmathfuncs.o CMakeFiles/cxcore.dir/cxmatmul.o CMakeFiles/cxcore.dir/cxmatrix.o CMakeFiles/cxcore.dir/cxpersistence.o CMakeFiles/cxcore.dir/cxprecomp.o CMakeFiles/cxcore.dir/cxrand.o CMakeFiles/cxcore.dir/cxstat.o CMakeFiles/cxcore.dir/cxsystem.o CMakeFiles/cxcore.dir/cxtables.o -ldl -lm -lpthread -lrt ../../3rdparty/lib/libopencv_lapack.a ../../3rdparty/lib/libzlib.a ../../3rdparty/lib/libflann.a
ld: cannot find -ldl
gmaker2: *** [lib/libcxcore.so.2.1.0] Error 1

I don't understand why "-ldl" is added to the linker line. Can you please help?


cmake_system.log - Requested system log (24 kB) Thomas Klausner, 2010-12-03 04:18 pm

patch-aa - Patch for the dl problem. (542 Bytes) Thomas Klausner, 2010-12-03 05:40 pm

patch-ab - Patch for a png problem. (526 Bytes) Thomas Klausner, 2010-12-03 05:40 pm


Associated revisions

Revision b0cc526b
Added by Vadim Pisarevsky over 14 years ago

fixed OpenCV build on NetBSD (ticket #726)

Revision aebffb71
Added by Andrey Kamaev almost 12 years ago

Merge pull request #726 from jet47:fix-pvs-studio-warnings

History

Updated by stathis -- over 14 years ago

Can you run the following command on your system:

cmake --system-information cmake_system.log

and attach here the generated cmake_system.log ?

There is already a fix for FreeBSD for this, if I'm not mistaken, but it would be relatively easy to add a fix for your system too.

Updated by Thomas Klausner over 14 years ago

I've just attached the system information log as requested.

Updated by stathis -- over 14 years ago

[Liquid Syntax Error] Variable '{{' was not properly terminated with regexp: /\}\}/
wiz, If you're using 2.1, as is here: https://code.ros.org/trac/opencv/browser/tags/2.1/opencv/CMakeLists.txt then you could change line 441 to read: {{ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") }} Let me know if it works, then I will provide a patch for the current trunk (seems that change should be the same).

Updated by Thomas Klausner over 14 years ago

sigma,
thanks for the pointer -- that was exactly the problem.

I've attached two patches I needed to get opencv to compile, one for the problem above and one for a png compatibility problem (a symbol was removed in png-1.4.x). Please apply something like them to the trunk, if you don't have them already.
Thanks!

Updated by stathis -- over 14 years ago

I'm glad it is working now. I checked and the png patch/modification is already in the svn trunk (thanks though), the other one is a trivial change, I think the opencv developers will be able to apply it in due time as I cannot commit myself to the repository.

Updated by Vadim Pisarevsky over 14 years ago

thanks! the patches are applied in r4272

  • Status changed from Open to Done
  • (deleted custom field) set to fixed

Also available in: Atom PDF