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

FindDL.cmake is not working when cross-compiling to WebAssembly via Emscripten #59

Open
osrf-migration opened this issue Apr 22, 2019 · 4 comments
Labels
bug Something isn't working major

Comments

@osrf-migration
Copy link

Original report (archived issue) by Silvio Traversaro (Bitbucket: traversaro).


When cross-compiling using Emscripten ( https://emscripten.org/ ) find_package(DL REQUIRED) should always be successful, as the functions usually contained in the dlfcn.h header are already linked without the need of linking any additional library (such as dl in Linux).

However, instead the FindDL.cmake script currently provided in ignition-cmake fails, for two reasons:

  • It searches for a dl library in any non-Windows system, while it should observe the CMAKE_DL_LIBS standard CMake variable and only search for a library if CMAKE_DL_LIBS is non-empty.

  • For some reason, the script fails to find the dlfcn.h system header provided by emscripten

The solution for the first problem is trivial, but I am not sure what is the reason behind the second problem.

@osrf-migration
Copy link
Author

Original comment by Silvio Traversaro (Bitbucket: traversaro).


  • Edited issue description

1 similar comment
@osrf-migration
Copy link
Author

Original comment by Silvio Traversaro (Bitbucket: traversaro).


  • Edited issue description

@osrf-migration
Copy link
Author

Original comment by Silvio Traversaro (Bitbucket: traversaro).


If someone is interested in reproducing this problem, you can check the colcon instructions provided in https://gist.github.com/traversaro/4e6b094206001d9aa444e518afdb884d .

@osrf-migration
Copy link
Author

Original comment by Silvio Traversaro (Bitbucket: traversaro).


The first problem could be solved by changing the part related to find_library(DL_LIBRARIES dl) with:

  if(CMAKE_DL_LIBS)
    find_library(DL_LIBRARIES ${CMAKE_DL_LIBS})
    if(DL_LIBRARIES)

      if(NOT DL_FIND_QUIETLY)
        message(STATUS "Looking for libdl - found")
      endif()

    else(DL_LIBRARIES)

      if(NOT DL_FIND_QUIETLY)
        message(STATUS "Looking for libdl - not found")
      endif()

      set(DL_FOUND false)

    endif()
    mark_as_advanced(DL_LIBRARIES)
  endif()

@osrf-migration osrf-migration added major bug Something isn't working labels Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant