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

Build issue in trunk with pcl_visualization #80

Closed
julienr opened this issue May 11, 2013 · 12 comments
Closed

Build issue in trunk with pcl_visualization #80

julienr opened this issue May 11, 2013 · 12 comments

Comments

@julienr
Copy link

julienr commented May 11, 2013

When linking an application that uses master PCL, I get an error due to pcl_visualization not finding pcl_geometry-1.7 :

Package pcl_geometry-1.7 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pcl_geometry-1.7.pc'
to the PKG_CONFIG_PATH environment variable
Package 'pcl_geometry-1.7', required by 'pcl_visualization', not found

I think this is due to commit 10d42e9 which disable the generation of the pcl_geometry-1.7.pc pkgconfig file.

Since pcl_visualization still depends on pcl_geometry, the pcl_visualization-1.7.pc file contain a reference to the non-existing pcl_geometry-1.7.pc

@rbrusu
Copy link
Member

rbrusu commented May 31, 2013

Can you tell us how we could replicate this please?

@nizar-sallem
Copy link
Contributor

This is probably due to the fact that geometry is a header only module that doesn't produce a binary library file.
Checking...

@nizar-sallem
Copy link
Contributor

So apparently we don't handle the case where library is headers only for the generated pc files though we do it for the cmake.
Working on a fix.

@nizar-sallem
Copy link
Contributor

@rbrusu I found a solution but I am not sure we want it pulled right now on PCL.
You can find it in my fork for now https://github.com/nizar-sallem/pcl.git then switch to "pkgconfig_fix" branch.

@jspricke
Copy link
Member

jspricke commented Jul 7, 2013

@nizar-sallem The branch is not on Github anymore, do you have some fix lying around?

@martyvona
Copy link

For now the workaround we are using to get our pkg-config based build going is we manually create the file pcl_geometry-1.7.pc with these contents:

missing pkg-config file for pcl_geometry

prefix=/usr/local
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include/pcl-1.7
Name: pcl_geometry
Description: Point cloud geometry library
Version: 1.7.0
Requires:
Libs:
Cflags: -I${includedir}

You can then put that somewhere in the pkg-config search path, like /usr/local/lib/pkgconfig/. Though to avoid hacking up your system you can just keep the file local to your project build directory and use this command in place of the vanilla pkg-config call in your makefiles:

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:. pkg-config

@jdt141
Copy link
Contributor

jdt141 commented Aug 27, 2013

I ran into the same issue and fixed it this way so that the proper pkg-config file will always be built when you build from source:

I create a new macro in pcl_targets.cmake:

macro(PCL_MAKE_PKGCONFIG_HEADER_ONLY _name _component _desc _pcl_deps _ext_deps _int_deps _cflags)
set(PKG_NAME ${_name})
set(PKG_DESC ${_desc})
set(PKG_CFLAGS ${_cflags})
#set(PKG_LIBFLAGS ${_lib_flags})
LIST_TO_STRING(_ext_deps_str "${_ext_deps}")
set(PKG_EXTERNAL_DEPS ${_ext_deps_str})
foreach(_dep ${_pcl_deps})
set(PKG_EXTERNAL_DEPS "${PKG_EXTERNAL_DEPS} pcl_${_dep}-${PCL_MAJOR_VERSION}.${PCL_MINOR_VERSION}")
endforeach(_dep)
set(PKG_INTERNAL_DEPS "")
foreach(_dep ${_int_deps})
set(PKG_INTERNAL_DEPS "${PKG_INTERNAL_DEPS} -l${_dep}")
endforeach(_dep)
set(_pc_file ${CMAKE_CURRENT_BINARY_DIR}/${_name}-${PCL_MAJOR_VERSION}.${PCL_MINOR_VERSION}.pc)
configure_file(${PROJECT_SOURCE_DIR}/cmake/pkgconfig-headeronly.cmake.in ${_pc_file} @ONLY)
install(FILES ${_pc_file} DESTINATION ${PKGCFG_INSTALL_DIR}
COMPONENT pcl_${_component})
endmacro(PCL_MAKE_PKGCONFIG_HEADER_ONLY)

I also added a file: pkgconfig-headeronly.cmake.in to the same directory. It looks like this:

# This file was generated by CMake for @PROJECT_NAME@ library @PKG_NAME@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@LIB_INSTALL_DIR@
#includedir=${prefix}/@INCLUDE_INSTALL_DIR@
includedir=${prefix}/include/@PROJECT_NAME_LOWER@-@PCL_MAJOR_VERSION@.@PCL_MINOR_VERSION@
Name: @PKG_NAME@
Description: @PKG_DESC@
Version: @PCL_VERSION@
Requires: @PKG_EXTERNAL_DEPS@
Libs: 
Cflags: -I${includedir} @PKG_CFLAGS@

Then I called PCL_MAKE_PKGCONFIG_HEADER_ONLY from geometry/CMakeLists.txt. Works like a charm!

@martyvona
Copy link

Great, that sounds like a fix that could be included in pcl to resolve this issue, not just a workaround. Thanks!

@jspricke
Copy link
Member

@jdt141 looking good, can you send it as a pull request, so we can merge it? Thanks!

@rbrusu
Copy link
Member

rbrusu commented Sep 7, 2013

+1 for a pull request.

@jdt141
Copy link
Contributor

jdt141 commented Sep 9, 2013

Just submitted the request. HTH!

@jspricke
Copy link
Member

merged, thanks!

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

6 participants