I don’t really know what I’m doing here, so I’ve basically cobbled up some stuff using various Yggdrasil recipes as examples. Here is the BinaryBuilder.jl script:
using BinaryBuilder, Pkg
const src_name = "glasgow_subgraph_solver"
const src_version = v"0.1"
platforms = supported_platforms()
# From Yggdrasil/F/finufft/build_tarballs.jl
# Expand for microarchitectures on x86_64 (library doesn't have CPU dispatching)
#platforms = expand_cxxstring_abis(expand_microarchitectures(supported_platforms(), ["x86_64", "avx", "avx2", "avx512"]); skip=!Sys.iswindows)
#platforms = [
# BinaryProvider.Linux(:x86_64, compiler_abi=CompilerABI(:gcc7))
#]
sources = [
DirectorySource("/home/dstahlke/Desktop/glasgow-subgraph-solver")
]
script = raw"""
export
cmake \
-DCMAKE_FIND_ROOT_PATH=${prefix} \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DJulia_PREFIX=${prefix} \
-DBUILD_SHARED_LIBS=ON \
-DWITH_JULIA=ON \
-S . -B build
cmake --build build --config Release --target install -- -j${nproc}
ldd ${prefix}/lib/libgssjulia.so
"""
products = [
LibraryProduct("libgssjulia", :libgssjulia)
]
dependencies = [
# Boost breaks ABI in every single version because they embed the full version number in
# the SONAME, so we're compatible with one and only one version at a time.
Dependency(PackageSpec(name="boost_jll", uuid="28df3c45-c428-5900-9ff8-a3135698ca75"); compat="=1.76.0"),
Dependency("libcxxwrap_julia_jll"),
BuildDependency("libjulia_jll"),
]
build_tarballs(ARGS, src_name, src_version, sources, script, platforms, products, dependencies;
preferred_gcc_version = v"11",
julia_compat="1.6")
In that script I’m running ldd for debug purposes. Here is the ldd output:
[15:53:07] ---> ldd ${prefix}/lib/libgssjulia.so
[15:53:07] linux-vdso.so.1 (0x00007fff8f499000)
[15:53:07] libcxxwrap_julia.so.0 => /workspace/destdir/lib/libcxxwrap_julia.so.0 (0x00007f92a46a5000)
[15:53:07] libglasgow_subgraphs.so => /workspace/destdir/lib/libglasgow_subgraphs.so (0x00007f92a45b5000)
[15:53:07] libjulia.so.1 => /workspace/destdir/lib/libjulia.so.1 (0x00007f92a4200000)
[15:53:07] libboost_container.so.1.76.0 => /workspace/destdir/lib/libboost_container.so.1.76.0 (0x00007f92a3e00000)
[15:53:07] libstdc++.so.6 => /usr/lib/csl-glibc-x86_64/libstdc++.so.6 (0x00007f92a3bec000)
[15:53:07] libm.so.6 => /lib64/libm.so.6 (0x00007f92a44d9000)
[15:53:07] libgcc_s.so.1 => /usr/lib/csl-glibc-x86_64/libgcc_s.so.1 (0x00007f92a44be000)
[15:53:07] libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f92a44b9000)
[15:53:07] libc.so.6 => /lib64/libc.so.6 (0x00007f92a39f0000)
[15:53:07] libdl.so.2 => /lib64/libdl.so.2 (0x00007f92a44b4000)
[15:53:07] librt.so.1 => /lib64/librt.so.1 (0x00007f92a44ad000)
[15:53:07] ldd (0x00007f92a46f7000)
So it seems at that point it’s finding everything. And it depends on libm.so rather than libopenlibm.so.
The cmake subdir for the CxxWrap wrapper that I’ve added to the C++ package:
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
find_package(JlCxx REQUIRED)
get_target_property(JlCxx_location JlCxx::cxxwrap_julia LOCATION)
get_filename_component(JlCxx_location ${JlCxx_location} DIRECTORY)
message(STATUS "Found JlCxx at ${JlCxx_location}")
#set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${JlCxx_location}")
list(APPEND CMAKE_INSTALL_RPATH "\$ORIGIN;${JlCxx_location}")
add_library(gssjulia SHARED gssjulia.cpp)
add_dependencies(gssjulia glasgow_subgraphs)
target_link_libraries(gssjulia PRIVATE JlCxx::cxxwrap_julia glasgow_subgraphs)
install(TARGETS gssjulia DESTINATION lib)
Again, I don’t really know what I’m doing here and did some copy-paste from various examples. I’m not sure whether I should be setting RPATH here. It doesn’t seem to make a difference one way or the other. It looks like either cmake or BinaryBuilder may be setting RPATH=$ORIGIN by default anyway.