Meson Troubles: How Do I Path to Library?

Joined
Feb 25, 2024
Messages
4
Reaction score
0
I have a c++ project that uses SDL2. I want Meson to use a certain path for libraries when building, but I want the resulting executable to use a local path (eg. @executable_path/../libs). I tried build_rpath and install_rpath, but they do not seem to work. I asked many chatbots for help, but none of them helped at all. Any ideas?

code:

Code:
project('Default','cpp')
SDL2_dir = 'SDL2'
SDL2_Ldir = '/Library/SoftwareDevelopment/cpp/lib'
executable('Executable', 'main.cpp', link_args:[SDL2_Ldir+'/libSDL2-x64.dylib'], build_rpath:SDL2_Ldir, install_rpath:'@executable_path/../libs')
 
Joined
Sep 4, 2022
Messages
128
Reaction score
16
Hello HyperVertex !



Code:
install_rpath:'@executable_path/../libs' // reserved to 'System Output short version' for a path.

// this display for a Path is a common 'output' for long paths.
// but when you are setting by code a Path, you can not
// use 'double dot' in the middle of one path.

// to have a solution, you have to build the 'Path String' yourself.

// '../' are always at beginning of a Path string, but never in the middle.
// '../' is a reset of the path, it leads the 'path resource' at root.
 
Joined
Feb 25, 2024
Messages
4
Reaction score
0
The problem is that Meson does not look at build_rpath or install_rpath at all; it completely ignores it for some reason. Am I missing something that has to go with build_rpath and install_rpath?
 
Joined
Feb 25, 2024
Messages
4
Reaction score
0
Just realized im stupid. The problem is that the SDL2.dylib I compiled searches for /usr/local/lib/SDL2-2.0.0.dylib. How do I compile SDL2 so that it uses @rpath/SDL2.dylib?
 
Joined
Nov 23, 2023
Messages
56
Reaction score
3
I have a c++ project that uses SDL2. I want Meson to use a certain path for libraries when building, but I want the resulting executable to use a local path (eg. @executable_path/../libs). I tried build_rpath and install_rpath, but they do not seem to work. I asked many chatbots for help, but none of them helped at all. Any ideas?

code:

Code:
project('Default','cpp')
SDL2_dir = 'SDL2'
SDL2_Ldir = '/Library/SoftwareDevelopment/cpp/lib'
executable('Executable', 'main.cpp', link_args:[SDL2_Ldir+'/libSDL2-x64.dylib'], build_rpath:SDL2_Ldir, install_rpath:'@executable_path/../libs')
Use install_files in your Meson build to copy necessary SDL2 library files to a directory next to your executable during installation. Make sure the path in install_files is relative to the executable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top