JuliaInterop / libcxxwrap-julia

C++ library for backing CxxWrap.jl
Other
85 stars 43 forks source link

using libcxxwrap-julia as a dependency in BinaryBuilder #8

Closed jstrube closed 6 years ago

jstrube commented 6 years ago

I'm trying to move my builds over to BinaryBuilder. My idea is to follow your example and split the C++ code and the Julia code into two different repositories. For the C++ part, I was thinking I can just use libcxxwrap-julia as a dependency, and pass BinaryBuilder the path of the build.jl file. Unfortunately, when I specify the project as a dependency, it looks like the CMake file tries to find julia again to build the libraries. But it doesn't find julia in the BinaryBuilder environment.

CMake Error at /workspace/destdir/lib/cmake/JlCxx/FindJulia.cmake:30 (file):
  file failed to open for reading (No such file or directory):

    /workspace/srcdir/LCIOWrapBuilder/Julia_VERSION_INCLUDE-NOTFOUND
Call Stack (most recent call first):
  /workspace/destdir/lib/cmake/JlCxx/JlCxxConfig.cmake:3 (find_package)
  CMakeLists.txt:13 (find_package)

CMake Error at /workspace/destdir/lib/cmake/JlCxx/FindJulia.cmake:31 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  /workspace/destdir/lib/cmake/JlCxx/JlCxxConfig.cmake:3 (find_package)
  CMakeLists.txt:13 (find_package)

-- Julia_VERSION_STRING: 
CMake Error at /workspace/destdir/lib/cmake/JlCxx/FindJulia.cmake:46 (if):
  if given arguments:

    "VERSION_LESS" "0.7.0"

  Unknown arguments specified
Call Stack (most recent call first):
  /workspace/destdir/lib/cmake/JlCxx/JlCxxConfig.cmake:3 (find_package)
  CMakeLists.txt:13 (find_package)

-- Configuring incomplete, errors occurred!

The other dependency I specify seems to find the cmake file, and recognizes that the libs are already built.

-- Check for LCIO (2.12.1)
-- Check for LCIO_LIBRARIES: lcio;sio
-- Check for LCIO_LCIO_LIBRARY: /workspace/destdir/lib/liblcio.so -- ok
-- Check for LCIO_SIO_LIBRARY: /workspace/destdir/lib/libsio.so -- ok

Is this search for the julia dirs necessary if I want to build my package against the existing libcxxwrap libraries and headers? I'm really not a cmake expert. Is this something I should address in my CMakeLists.txt, or is there a check you could add to this project to check for the libs before searching for julia?

barche commented 6 years ago

Yes, since libcxxwrap-julia also calls into libjulia from within header files, you also need to link to libjulia. I download these in my build script, so you could also use the same method. This is only for Julia 0.7 for now, when https://github.com/JuliaPackaging/BinaryBuilder.jl/issues/320 is resolved the URL should be changed and point to official binaries.

CC @staticfloat

barche commented 6 years ago

The new binaries are now up at https://github.com/JuliaPackaging/JuliaBuilder/releases and I have updated the build script to use them for both Julia 0.7 and 1.0. See the CxxWrap.jl build.jl file for and example of how to download the correct binary based on the Julia version.

jstrube commented 6 years ago

OK, thank you for the hints. I have the build working, but all my tests fail, for some reason I don't really understand. I get null pointers when calling into my functions now. Will investigate separately. At least julia and libcxxwrap are found now. (Needed to add Libdl as a dependency and needed to add using CxxWrap to my wrapper module build script -- otherwise the lib is missing the dependency and dlopen, and hence the build, fails. The latter part is something you might want to add to the docs.