Opened 4 years ago

Last modified 8 months ago

#42702 assigned defect

libtool drops dylibs at link time

Reported by: jeremyhu (Jeremy Huddleston Sequoia) Owned by: larryv (Lawrence Velázquez)
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: cooljeanius (Eric Gallager), stromnov (Andrew Stromnov)
Port: libtool

Description

VLC fails to build with opencv support because opencv's pkg-config file lists paths to dylibs rather than -l<lib> arguments. This should work just fine, but glibtool doesn't like it. It just drops the dylibs on the floor when creating the command line to envoke:

/opt/local/bin/glibtool  --tag=CXX   --mode=link /usr/bin/clang++   -pipe -Os -arch x86_64 -stdlib=libc++ -D_INTL_REDIRECT_MACROS -I/opt/local/var/macports/build/_Users_jeremy_src_macports_trunk_dports_multimedia_VLC-devel/VLC-devel/work/VLC-devel-2.1.99/contrib/include -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -fvisibility=hidden -ffast-math -funroll-loops -fomit-frame-pointer -avoid-version -module -export-symbols-regex ^vlc_entry -shrext .dylib -no-undefined ../../compat/libcompat.la ../../src/libvlccore.la  -rpath '/opt/local/lib/vlc/plugins/video_filter'  -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -Wl,-headerpad_max_install_names -L/opt/local/var/macports/build/_Users_jeremy_src_macports_trunk_dports_multimedia_VLC-devel/VLC-devel/work/VLC-devel-2.1.99/contrib/lib -o libopencv_example_plugin.la  libopencv_example_plugin_la-opencv_example.lo /opt/local/lib/libopencv_calib3d.dylib /opt/local/lib/libopencv_contrib.dylib /opt/local/lib/libopencv_core.dylib /opt/local/lib/libopencv_features2d.dylib /opt/local/lib/libopencv_flann.dylib /opt/local/lib/libopencv_gpu.dylib /opt/local/lib/libopencv_highgui.dylib /opt/local/lib/libopencv_imgproc.dylib /opt/local/lib/libopencv_legacy.dylib /opt/local/lib/libopencv_ml.dylib /opt/local/lib/libopencv_nonfree.dylib /opt/local/lib/libopencv_objdetect.dylib /opt/local/lib/libopencv_photo.dylib /opt/local/lib/libopencv_stitching.dylib /opt/local/lib/libopencv_superres.dylib /opt/local/lib/libopencv_ts.a /opt/local/lib/libopencv_video.dylib /opt/local/lib/libopencv_videostab.dylib

*** Warning: Linking the shared library libopencv_example_plugin.la against the
*** static library /opt/local/lib/libopencv_ts.a is not portable!
glibtool: link: rm -fr  .libs/libopencv_example_plugin.exp
glibtool: link: /usr/bin/nm  .libs/libopencv_example_plugin_la-opencv_example.o   | sed -n -e 's/^.*[	 ]\([BCDEGRST][BCDEGRST]*\)[	 ][	 ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' | sed '/ __gnu_lto/d' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libopencv_example_plugin.exp
glibtool: link: /usr/bin/grep -E -e "^vlc_entry" ".libs/libopencv_example_plugin.exp" > ".libs/libopencv_example_plugin.expT"
glibtool: link: mv -f ".libs/libopencv_example_plugin.expT" ".libs/libopencv_example_plugin.exp"
glibtool: link: sed -e 's,^,_,' < .libs/libopencv_example_plugin.exp > .libs/libopencv_example_plugin-symbols.expsym
glibtool: link: /usr/bin/clang++  -o .libs/libopencv_example_plugin.dylib -bundle  .libs/libopencv_example_plugin_la-opencv_example.o   ../../compat/.libs/libcompat.a -L/opt/local/lib -L/opt/local/var/macports/build/_Users_jeremy_src_macports_trunk_dports_multimedia_VLC-devel/VLC-devel/work/VLC-devel-2.1.99/contrib/lib ../../src/.libs/libvlccore.dylib -lintl -lidn -liconv -lm /opt/local/lib/libopencv_ts.a  -Os -arch x86_64 -stdlib=libc++ -Wl,-headerpad_max_install_names -arch x86_64 -Wl,-headerpad_max_install_names   -Wl,-exported_symbols_list,.libs/libopencv_example_plugin-symbols.expsym
Undefined symbols for architecture x86_64:
  "_cvClearMemStorage", referenced from:
      Filter(filter_t*, picture_t*) in libopencv_example_plugin_la-opencv_example.o
  "_cvCreateMemStorage", referenced from:
      OpenFilter(vlc_object_t*) in libopencv_example_plugin_la-opencv_example.o
  "_cvGetSeqElem", referenced from:
      Filter(filter_t*, picture_t*) in libopencv_example_plugin_la-opencv_example.o
  "_cvHaarDetectObjects", referenced from:
      Filter(filter_t*, picture_t*) in libopencv_example_plugin_la-opencv_example.o
  "_cvLoad", referenced from:
      OpenFilter(vlc_object_t*) in libopencv_example_plugin_la-opencv_example.o
  "_cvRectangle", referenced from:
      Filter(filter_t*, picture_t*) in libopencv_example_plugin_la-opencv_example.o
  "_cvReleaseHaarClassifierCascade", referenced from:
      CloseFilter(vlc_object_t*) in libopencv_example_plugin_la-opencv_example.o
  "_cvReleaseMemStorage", referenced from:
      CloseFilter(vlc_object_t*) in libopencv_example_plugin_la-opencv_example.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Change History (8)

comment:1 Changed 4 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:2 Changed 4 years ago by skymoo (Adam Mercer)

Cc: stromnov@… added
Port: opencv added

That sounds like a problem with opencv's pkg-config file, surely it should specify the link flags needed to link the library, which libtool then passes these onto the compiler, not the path to the libraries?

comment:3 Changed 4 years ago by stromnov (Andrew Stromnov)

Probably fixed by jeremyhu at r117530.

My system:

$ port installed opencv
The following ports are currently installed:
  opencv @2.4.8_2+eigen+java+opencl+python27+qt4 (active)

and

$ cat /opt/local/lib/pkgconfig/opencv.pc
# Package Information for pkg-config

prefix=/opt/local
exec_prefix=${prefix}
libdir=
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include

Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.8
Libs: -L${exec_prefix}/lib  -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab
Cflags: -I${includedir_old} -I${includedir_new}

comment:4 in reply to:  3 Changed 4 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Replying to stromnov@…:

Probably fixed by jeremyhu at r117530.

No, that was a workaround in opencv.

This is a bug in glibtool.

comment:5 in reply to:  2 Changed 4 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Replying to ram@…:

That sounds like a problem with opencv's pkg-config file, surely it should specify the link flags needed to link the library, which libtool then passes these onto the compiler, not the path to the libraries?

No, it's not a bug in opencv as I already explained. You can clearly see in the command line that the linker flags *ARE* being passed to glibtoo, and glibtool is not passing them on to the linker.

comment:6 Changed 4 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Port: webkit-gtk opencv removed

comment:7 Changed 4 years ago by skymoo (Adam Mercer)

Owner: changed from ram@… to macports-tickets@…

comment:8 Changed 8 months ago by ryandesign (Ryan Schmidt)

Owner: changed from macports-tickets@… to larryv
Port: libtool added; glibtool removed
Status: newassigned
Summary: glibtool drops dylibs at link timelibtool drops dylibs at link time
Note: See TracTickets for help on using tickets.