Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling on OSX 10.9.2 fails #13

Closed
kubark42 opened this issue May 20, 2014 · 16 comments
Closed

Compiling on OSX 10.9.2 fails #13

kubark42 opened this issue May 20, 2014 · 16 comments

Comments

@kubark42
Copy link
Contributor

Using latest checkout (e0d255f ) catkin_make fails with

[ 96%] Built target stereoimageproc_exe
Linking CXX shared library /Users/kenz/Documents/catkin_ws/devel/lib/libgscam.dylib
Undefined symbols for architecture x86_64:
  "image_transport::ImageTransport::advertiseCamera(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, bool)", referenced from:
      gscam::GSCam::init_stream() in gscam.cpp.o
  "image_transport::ImageTransport::ImageTransport(ros::NodeHandle const&)", referenced from:
      gscam::GSCam::GSCam(ros::NodeHandle, ros::NodeHandle) in gscam.cpp.o
  "image_transport::ImageTransport::~ImageTransport()", referenced from:
      gscam::GSCam::GSCam(ros::NodeHandle, ros::NodeHandle) in gscam.cpp.o
      gscam::GSCam::~GSCam() in gscam.cpp.o
  "camera_info_manager::CameraInfoManager::validateURL(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      gscam::GSCam::configure() in gscam.cpp.o
  "camera_info_manager::CameraInfoManager::getCameraInfo()", referenced from:
      gscam::GSCam::publish_stream() in gscam.cpp.o
  "camera_info_manager::CameraInfoManager::setCameraName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      gscam::GSCam::configure() in gscam.cpp.o
  "camera_info_manager::CameraInfoManager::loadCameraInfo(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      gscam::GSCam::configure() in gscam.cpp.o
.
.
.
"_gst_version_string", referenced from:
      gscam::GSCam::init_stream() in gscam.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/Users/kenz/Documents/catkin_ws/devel/lib/libgscam.dylib] Error 1
make[1]: *** [gscam/CMakeFiles/gscam.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

I'm not sure what library it's looking for. FWIW, I've added image_transport to the workspace src directory.

@jbohren
Copy link
Member

jbohren commented May 20, 2014

@kubark42 It's probably not linking to gstreamer at all.

What's the pkg-config name for gstreamer on OS X?

On Ubutntu 12.04, it's gstreamer-0.10. What does the pkg-config give you on OS X for that?

[moldy-crow:~]$ pkg-config gstreamer-0.10 --libs
-pthread -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lxml2 -lglib-2.0  

@kubark42
Copy link
Contributor Author

@jbohren, here's a list of all the "gstreamer-" double-tab autocompletion strings.

$ pkg-config gstreamer-
gstreamer-0.10               gstreamer-net-0.10
gstreamer-app-0.10           gstreamer-netbuffer-0.10
gstreamer-audio-0.10         gstreamer-pbutils-0.10
gstreamer-base-0.10          gstreamer-plugins-base-0.10
gstreamer-cdda-0.10          gstreamer-riff-0.10
gstreamer-check-0.10         gstreamer-rtp-0.10
gstreamer-controller-0.10    gstreamer-rtsp-0.10
gstreamer-dataprotocol-0.10  gstreamer-sdp-0.10
gstreamer-fft-0.10           gstreamer-tag-0.10
gstreamer-floatcast-0.10     gstreamer-video-0.10
gstreamer-interfaces-0.10    

And the specific response to your question:

$ pkg-config gstreamer-0.10 --libs
-L/usr/local/Cellar/gstreamer010/0.10.36/lib -L/usr/local/Cellar/glib/2.40.0/lib -L/usr/local/opt/gettext/lib -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -lxml2 

@jbohren
Copy link
Member

jbohren commented May 20, 2014

Ah I see.

I suspect the problem is here: https://github.com/ros-drivers/gscam/blob/master/CMakeLists.txt#L55

Try adding the following to the CmakeLists.txt:

  target_link_libraries(gscam
    ${catkin_LIBRARIES}
    ${GSTREAMER_LIBRARIES}
    ${GST_APP_LIBRARIES})

@kubark42
Copy link
Contributor Author

Progress, maybe?

@@ -57,10 +57,14 @@ else()
   add_executable(gscam_node src/gscam_node.cpp)
   target_link_libraries(gscam_node gscam
     ${catkin_LIBRARIES}
     ${GSTREAMER_LIBRARIES}
     ${GST_APP_LIBRARIES})
+  target_link_libraries(gscam
+    ${catkin_LIBRARIES}
+    ${GSTREAMER_LIBRARIES}
+    ${GST_APP_LIBRARIES})
   set_target_properties(gscam_node PROPERTIES OUTPUT_NAME gscam)

   add_library(GSCamNodelet src/gscam_nodelet.cpp)
   target_link_libraries(GSCamNodelet gscam
     ${catkin_LIBRARIES}

led to a different error:

[ 44%] Built target image_transport_plugins
Linking CXX shared library /Users/kenz/Documents/catkin_ws/devel/lib/libgscam.dylib
[ 46%] [ 47%] Built target list_transports
Built target republish
ld: library not found for -lintl
[ 49%] Built target image_rotate_exe
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/Users/kenz/Documents/catkin_ws/devel/lib/libgscam.dylib] Error 1
make[1]: *** [gscam/CMakeFiles/gscam.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 50%] Built target image_rotate
[ 52%] Built target disparity_view
[ 53%] Built target image_saver
[ 63%] Built target image_proc
[ 64%] Built target extract_images
[ 72%] Built target depth_image_proc
[ 76%] Built target image_view
make: *** [all] Error 2

Could you confirm that I've added the target_link_libraries code to the appropriate place?

@jbohren
Copy link
Member

jbohren commented May 20, 2014

Could you confirm that I've added the target_link_libraries code to the appropriate place?

It should go right after add_library() ie here: https://github.com/ros-drivers/gscam/blob/master/CMakeLists.txt#L56

@kubark42
Copy link
Contributor Author

Moved there, but almost the same results:

[ 44%] Built target image_transport_plugins
Linking CXX shared library /Users/kenz/Documents/catkin_ws/devel/lib/libgscam.dylib
[ 46%] Built target republish
[ 47%] Built target list_transports
[ 49%] [ 50%] Built target image_rotate
Built target image_rotate_exe
ld: library not found for -lintl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/Users/kenz/Documents/catkin_ws/devel/lib/libgscam.dylib] Error 1
make[1]: *** [gscam/CMakeFiles/gscam.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 52%] Built target disparity_view
[ 61%] [ 63%] Built target image_proc
Built target image_saver
[ 64%] Built target extract_images
[ 66%] Built target image_view_exe
[ 70%] Built target image_view
[ 78%] Built target depth_image_proc
make: *** [all] Error 2
Invoking "make" failed

@kubark42
Copy link
Contributor Author

Solution to the second problem, the missing intl lib, was found here: http://stackoverflow.com/questions/11151197/ld-library-not-found-for-lintl-on-mac-os-x-lion

gscam now successfully compiles. Now I just have to figure out how to use it with a Logitech c920 on OSX! Pointers are welcome. ;)

@jbohren
Copy link
Member

jbohren commented May 20, 2014

@kubark42 Cool, thanks for the feedback!

@jbohren
Copy link
Member

jbohren commented May 20, 2014

Solution to the second problem, the missing intl lib, was found here: http://stackoverflow.com/questions/11151197/ld-library-not-found-for-lintl-on-mac-os-x-lion

@tfoote on linux libintl usually comes in via glibc but on OS X it looks like the common way to get it is with libgettext is there a good dependency for this to go into in the core dependencies?

gscam now successfully compiles. Now I just have to figure out how to use it with a Logitech c920 on OSX! Pointers are welcome. ;)

Look at the v4l.launch (video4linux) and try replacing v4l2src in the gscam_config parameter with osxvideosrc. Ref: http://stackoverflow.com/a/13007444

If that works, could you submit a PR with an osx.launch example launchfile?

@tfoote
Copy link

tfoote commented May 20, 2014

I am not familiar with that. Probably the best solution is to create a rosdep for libintl and have it point to glibc for everything except OSX where it points to libgettext

@jbohren
Copy link
Member

jbohren commented May 20, 2014

I am not familiar with that. Probably the best solution is to create a rosdep for libintl and have it point to glibc for everything except OSX where it points to libgettext

Actually my mistake, libgettext is apparently getting installed properly, but symlinks aren't getting generated. It's apparently a keg-only install. More here: https://github.com/Homebrew/homebrew/wiki/FAQ#what-does-keg-only-mean

@wjwwood Have you had issues with "keg-only" installs in your osx-ing x-perience?

@wjwwood
Copy link
Member

wjwwood commented May 20, 2014

Generally if something is keg-only, then it is because OS X comes with a conflicting version or package. You can just do brew link <thing> to make it not keg-only.

@jbohren
Copy link
Member

jbohren commented May 20, 2014

Generally if something is keg-only, then it is because OS X comes with a conflicting version or package. You can just do brew link to make it not keg-only.

Is there something we should do as package maintainers about a (second-order) keg-only dependency?

@wjwwood
Copy link
Member

wjwwood commented May 20, 2014

I think the general rule of thumb is that if you don't know why you need to the keg-only formula, then you don't actually need it. In which case keg-only shouldn't affect you and you'll use the system provided one. If you actually need the newer or different one provided keg-only then you'll need to advise your users to link the keg-only package or you'll need to make sure your CMake package looks for the keg-only thing in /usr/local/opt/<thing name> before looking in /usr and other places.

@kubark42
Copy link
Contributor Author

FWIW, I did a brew unlink gettext after compiling was completed, because brew cautioned that the link might break other things.

@jbohren Thanks for the advice on v4l.launch. Progress!

 roslaunch gscam osx.launch 
... logging to /Users/kenz/.ros/log/d549440c-df99-11e3-8316-b8f6b1175209/roslaunch-Kenns-MacBook-Pro.local-21562.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt

started roslaunch server http://Kenns-MacBook-Pro.local:56202/

SUMMARY
========

PARAMETERS
 * /rosdistro
 * /rosversion
 * /v4l/gscam_driver_v4l/camera_info_url
 * /v4l/gscam_driver_v4l/camera_name
 * /v4l/gscam_driver_v4l/frame_id
 * /v4l/gscam_driver_v4l/gscam_config
 * /v4l/gscam_driver_v4l/sync_sink

NODES
  /v4l/
    gscam_driver_v4l (gscam/gscam)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[v4l/gscam_driver_v4l-1]: started with pid [21567]
[ INFO] [1400628987.690000000]: Using gstreamer config from rosparam: "qtkitvideosrc device=/dev/viddsftsdf ! video/x-raw-rgb,framerate=30/1 ! ffmpegcolorspace"
[ INFO] [1400628987.697332000]: camera calibration URL: package://gscam/examples/uncalibrated_parameters.ini
[ INFO] [1400628987.711284000]: Loaded camera calibration from package://gscam/examples/uncalibrated_parameters.ini
[ INFO] [1400628987.744439000]: Time offset: -0.000
[ INFO] [1400628989.937526000]: Publishing stream...
[ INFO] [1400628989.938292000]: Started stream.

So this is great news, although I'm not all the way yet. When I run with qtkitvideosrc (note, not osxvideo) my internal iSight camera turns on. I don't know if the data is going anywhere, however. rosnode list only shows "/v4l/gscam_driver_v4l" (because I didn't change the XML field names in the new osx.launch file), so I'm not quite sure what to make of this yet: i's not the image_raw and camera_info topics that the Readme suggests I should have.

Also, the DEVICE name has no effect on which camera is chosen. I can enter something completely random-- e.g. pounding the keyboard-- and it will still turn on the internal camera. When I figure out how to specify the camera I'll submit a patch for OSX.

Should I make a new issue for the fact that it's not publishing image_raw and camera_info topics?

@jbohren
Copy link
Member

jbohren commented May 21, 2014

Should I make a new issue for the fact that it's not publishing image_raw and camera_info topics?

Yeah, though I don't have a mac for testing, so I might not be too much help at the moment.

jonathanhechtbauer-bc pushed a commit to braincorp/gscam that referenced this issue Apr 16, 2021
Fixes ros-drivers#13, now builds on stricter linkers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants