mesonbuild dependency(Drogon, ...)

100 views
Skip to first unread message

oxyrh...@gmail.com

unread,
Apr 7, 2021, 10:14:27 PM4/7/21
to The Meson Build System
Greetings,

FreeBSD stable/13, meson 0.57.1

I am looking for best practice to deal with my problem of trying
to build a drogon project executable with meson.

In the relevant meson.build file I have:

#exe_vultr_api_deps = dependency('Drogon', method : 'cmake', modules : ['Drogon::Drogon'])
exe_vultr_api_deps = dependency('Drogon', method : 'cmake')

var = exe_vultr_api_deps.get_variable(cmake : 'DROGON_LIBRARIES')
message('DROGON_LIBRARIES: ', var)

Which in either dependency() case above yields:

Found CMake: /usr/local/bin/cmake (3.19.6)
Run-time dependency drogon found: YES 1.4.1
Message: DROGON_LIBRARIES:  Drogon::Drogon

This means in practice that an executable linked by, say:

exe_vultr_api = executable('vultr_api', src_vultr_api,
               include_directories: project_include_directories,
               link_with: lib_demeisen_so,
               dependencies: exe_vultr_api_deps)

results in an executable that ldd shows:

vultr_api:
        libdrogon.so => not found (0)
        libtrantor.so => not found (0)
        libjsoncpp.so.24 => /usr/local/lib/libjsoncpp.so.24 (0x80024d000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x80028e000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x800360000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x800382000)
        libc.so.7 => /lib/libc.so.7 (0x80039b000)
        libm.so.5 => /lib/libm.so.5 (0x8007ac000)

However on this platform drogon correctly rpaths it's dependent
libraries into the drogon_ctl executable for the installation prefix
path I am using: ~/.local.

Am I making an elementary mistake?  I apologize if so, but if
otherwise, I would be interested to know what people do here.
I am not above just setting up some fragile hard coded paths
to look for particular libraries because for deployment reasons
I really want to rely on ~/.local.

Thanks,
Russell

Jeff

unread,
Apr 8, 2021, 12:05:41 AM4/8/21
to oxyrh...@gmail.com, The Meson Build System
I suggest to try inspecting the rpath in the executable as a first step?:


readelf -d <elf> | grep RPATH

--
You received this message because you are subscribed to the Google Groups "The Meson Build System" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mesonbuild+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mesonbuild/00d623f9-a2fa-438d-9402-5487e2e03136n%40googlegroups.com.

Jeff

unread,
Apr 8, 2021, 12:11:03 AM4/8/21
to oxyrh...@gmail.com, The Meson Build System
Besides that, I suggest to look at meson-logs.txt, at the linker args, I think something like -Wl,-rpath and confirm its set correctly

Russell Carter

unread,
Apr 9, 2021, 11:55:00 PM4/9/21
to The Meson Build System
For the benefit of other travelers going down this path,I was able to kludge a way around this with:

compiler = meson.get_compiler('cpp')
xdg_lib_dir = local_xdg_dir + '/lib'
exe_vultr_api_deps = []
exe_vultr_api_deps += compiler.find_library('libdrogon', dirs: xdg_lib_dir)
exe_vultr_api_deps += compiler.find_library('libtrantor', dirs: xdg_lib_dir)
exe_vultr_api_deps += jsoncpp_dep

local_xdg_dir is a meson CLI option specified in meson_options.txt, set in my already existing configure.sh
script.

All fine.
Best,
Russell


--
You received this message because you are subscribed to a topic in the Google Groups "The Meson Build System" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mesonbuild/VNpPYTJ0TZ0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mesonbuild+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages