Link failure building opencv-2.1.0 on NetBSD (Bug #726)
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?
Associated revisions
fixed OpenCV build on NetBSD (ticket #726)
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
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