mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Fix static linking Boost in 32-bit yabridge build
This commit is contained in:
@@ -769,11 +769,9 @@ ninja -C build
|
|||||||
```
|
```
|
||||||
|
|
||||||
Like the above commands, you might need to tweak the unity size based on the
|
Like the above commands, you might need to tweak the unity size based on the
|
||||||
amount of system memory available. You may also want to add
|
amount of system memory available. See the CI build definitions for some
|
||||||
`-Dwith-static-boost=true` and optionally also `-Dcpp_link_args='-static-libstdc++'`
|
examples on how to add static linking in the mix if you're going to run this
|
||||||
and `-Dbuild.cpp_link_args='-static-libstdc++'` to the `meson setup` command
|
version of yabridge on some other machine.
|
||||||
line if you're going to run these binaries on another system (that does still
|
|
||||||
supports the same version of glibc).
|
|
||||||
|
|
||||||
## Debugging
|
## Debugging
|
||||||
|
|
||||||
|
|||||||
+52
-53
@@ -105,6 +105,7 @@ endif
|
|||||||
# Build options
|
# Build options
|
||||||
#
|
#
|
||||||
|
|
||||||
|
with_32bit_libraries = get_option('build.cpp_args').contains('-m32')
|
||||||
with_bitbridge = get_option('with-bitbridge')
|
with_bitbridge = get_option('with-bitbridge')
|
||||||
with_static_boost = get_option('with-static-boost')
|
with_static_boost = get_option('with-static-boost')
|
||||||
with_winedbg = get_option('with-winedbg')
|
with_winedbg = get_option('with-winedbg')
|
||||||
@@ -142,36 +143,58 @@ endif
|
|||||||
# Dependencies
|
# Dependencies
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# I honestly have no idea what the correct way is to have `dependency()` or
|
||||||
|
# `compiler.find_dependency()` search for 32-bit versions of libraries when
|
||||||
|
# cross-compiling. Meson also doesn't seem to respect the default linker
|
||||||
|
# search path set by the system in `find_library()`. If anyone does know how
|
||||||
|
# to properly do this, please let me know!
|
||||||
|
winegcc = meson.get_compiler('cpp', native : false)
|
||||||
|
|
||||||
# Statically link against Boost.Filesystem, otherwise it would become impossible
|
# Statically link against Boost.Filesystem, otherwise it would become impossible
|
||||||
# to distribute a prebuilt version of yabridge
|
# to distribute a prebuilt version of yabridge
|
||||||
boost_dep = dependency('boost', version : '>=1.66', static : with_static_boost)
|
|
||||||
|
|
||||||
# HACK: I couldn't get Meson's Boost dependency detection to work with `-m32`,
|
# HACK: I couldn't get Meson's Boost dependency detection to work with `-m32`,
|
||||||
# because no matter what settings I use in machine/cross files it will
|
# because no matter what settings I use in machine/cross files it will
|
||||||
# keep rejecting the 32-bit libraries when the host system is 64-bit.
|
# keep rejecting the 32-bit libraries when the host system is 64-bit.
|
||||||
# Since cross-compiling 32-bit native libraries is not really a supported
|
# Since cross-compiling 32-bit native libraries is not really a supported
|
||||||
# use case anyways we'll just brute force it for the time being.
|
# use case anyways we'll just brute force it for the time being.
|
||||||
if get_option('build.cpp_args').contains('-m32')
|
#
|
||||||
if with_static_boost
|
# We also don't add any additional library search paths here, so you may
|
||||||
boost_filesystem_dep = declare_dependency(
|
# need to manually add your own using something like
|
||||||
link_args : ['-staticboost_filesystem'],
|
# `-Dbuild.cpp_link_args='-I/usr/local/lib'`.
|
||||||
compile_args : ['-DBOOST_FILESYSTEM_STATIC_LINK=1'],
|
boost_dep = dependency('boost', version : '>=1.66', static : with_static_boost)
|
||||||
)
|
|
||||||
else
|
if with_32bit_libraries or with_bitbridge
|
||||||
boost_filesystem_dep = declare_dependency(
|
boost_filesystem_32bit_dep = declare_dependency(
|
||||||
link_args : ['-lboost_filesystem'],
|
dependencies : winegcc.find_library(
|
||||||
compile_args : ['-DBOOST_FILESYSTEM_DYN_LINK=1'],
|
'boost_filesystem',
|
||||||
)
|
static : with_static_boost,
|
||||||
endif
|
dirs : [
|
||||||
else
|
# Used by Arch based distros
|
||||||
boost_filesystem_dep = dependency(
|
'/usr/local/lib32',
|
||||||
'boost',
|
'/usr/lib32',
|
||||||
version : '>=1.66',
|
# Used by Debian based distros
|
||||||
modules : ['filesystem'],
|
'/usr/local/lib/i386-linux-gnu',
|
||||||
static : with_static_boost,
|
'/usr/lib/i386-linux-gnu',
|
||||||
|
# Used by Red Hat based distros, could cause issues though since Meson
|
||||||
|
# cannot differentiate between the 32-bit version and the regular 64-bit
|
||||||
|
# version that would normally be in /lib
|
||||||
|
'/usr/local/lib',
|
||||||
|
'/usr/lib',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
compile_args : with_static_boost
|
||||||
|
? ['-DBOOST_FILESYSTEM_STATIC_LINK=1']
|
||||||
|
: ['-DBOOST_FILESYSTEM_DYN_LINK=1'],
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
boost_filesystem_64bit_dep = dependency(
|
||||||
|
'boost',
|
||||||
|
version : '>=1.66',
|
||||||
|
modules : ['filesystem'],
|
||||||
|
static : with_static_boost,
|
||||||
|
)
|
||||||
|
|
||||||
# TODO: Meson doesn't have a way to define version ranges, does it? Like
|
# TODO: Meson doesn't have a way to define version ranges, does it? Like
|
||||||
# `^>=5.2.0`, `>=5.2.0 && <6.0.0` or `5.2.*`.
|
# `^>=5.2.0`, `>=5.2.0 && <6.0.0` or `5.2.*`.
|
||||||
bitsery_dep = dependency('bitsery', version : '>=5.2.0', fallback : ['bitsery', 'bitsery_dep'])
|
bitsery_dep = dependency('bitsery', version : '>=5.2.0', fallback : ['bitsery', 'bitsery_dep'])
|
||||||
@@ -180,7 +203,7 @@ threads_dep = dependency('threads')
|
|||||||
tomlplusplus_dep = dependency('tomlplusplus', version : '>=2.1.0', fallback : ['tomlplusplus', 'tomlplusplus_dep'])
|
tomlplusplus_dep = dependency('tomlplusplus', version : '>=2.1.0', fallback : ['tomlplusplus', 'tomlplusplus_dep'])
|
||||||
# The built in threads dependency does not know how to handle winegcc
|
# The built in threads dependency does not know how to handle winegcc
|
||||||
wine_threads_dep = declare_dependency(link_args : '-lpthread')
|
wine_threads_dep = declare_dependency(link_args : '-lpthread')
|
||||||
xcb_dep = dependency('xcb')
|
xcb_64bit_dep = dependency('xcb')
|
||||||
|
|
||||||
dl_dep = declare_dependency(link_args : '-ldl')
|
dl_dep = declare_dependency(link_args : '-ldl')
|
||||||
rt_dep = declare_dependency(link_args : '-lrt')
|
rt_dep = declare_dependency(link_args : '-lrt')
|
||||||
@@ -530,7 +553,9 @@ shared_library(
|
|||||||
include_directories : include_dir,
|
include_directories : include_dir,
|
||||||
dependencies : [
|
dependencies : [
|
||||||
boost_dep,
|
boost_dep,
|
||||||
boost_filesystem_dep,
|
with_32bit_libraries
|
||||||
|
? boost_filesystem_32bit_dep
|
||||||
|
: boost_filesystem_64bit_dep,
|
||||||
bitsery_dep,
|
bitsery_dep,
|
||||||
dl_dep,
|
dl_dep,
|
||||||
rt_dep,
|
rt_dep,
|
||||||
@@ -550,7 +575,9 @@ if with_vst3
|
|||||||
include_directories : include_dir,
|
include_directories : include_dir,
|
||||||
dependencies : [
|
dependencies : [
|
||||||
boost_dep,
|
boost_dep,
|
||||||
boost_filesystem_dep,
|
with_32bit_libraries
|
||||||
|
? boost_filesystem_32bit_dep
|
||||||
|
: boost_filesystem_64bit_dep,
|
||||||
bitsery_dep,
|
bitsery_dep,
|
||||||
dl_dep,
|
dl_dep,
|
||||||
function2_dep,
|
function2_dep,
|
||||||
@@ -569,13 +596,13 @@ endif
|
|||||||
|
|
||||||
host_64bit_deps = [
|
host_64bit_deps = [
|
||||||
boost_dep,
|
boost_dep,
|
||||||
boost_filesystem_dep,
|
boost_filesystem_64bit_dep,
|
||||||
bitsery_dep,
|
bitsery_dep,
|
||||||
function2_dep,
|
function2_dep,
|
||||||
rt_dep,
|
rt_dep,
|
||||||
tomlplusplus_dep,
|
tomlplusplus_dep,
|
||||||
wine_threads_dep,
|
wine_threads_dep,
|
||||||
xcb_dep,
|
xcb_64bit_dep,
|
||||||
]
|
]
|
||||||
if with_vst3
|
if with_vst3
|
||||||
host_64bit_deps += [
|
host_64bit_deps += [
|
||||||
@@ -605,34 +632,6 @@ host_common_64bit_dep = declare_dependency(
|
|||||||
if with_bitbridge
|
if with_bitbridge
|
||||||
message('Bitbridge enabled, configuring a 32-bit host application')
|
message('Bitbridge enabled, configuring a 32-bit host application')
|
||||||
|
|
||||||
# I honestly have no idea what the correct way is to have `dependency()` or
|
|
||||||
# `compiler.find_dependency()` search for 32-bit versions of libraries when
|
|
||||||
# cross-compiling. Meson also doesn't seem to respect the default linker
|
|
||||||
# search path set by the system in `find_library()`. If anyone does know how
|
|
||||||
# to properly do this, please let me know!
|
|
||||||
winegcc = meson.get_compiler('cpp', native : false)
|
|
||||||
boost_filesystem_32bit_dep = declare_dependency(
|
|
||||||
dependencies : winegcc.find_library(
|
|
||||||
'boost_filesystem',
|
|
||||||
static : with_static_boost,
|
|
||||||
dirs : [
|
|
||||||
# Used by Arch based distros
|
|
||||||
'/usr/local/lib32',
|
|
||||||
'/usr/lib32',
|
|
||||||
# Used by Debian based distros
|
|
||||||
'/usr/local/lib/i386-linux-gnu',
|
|
||||||
'/usr/lib/i386-linux-gnu',
|
|
||||||
# Used by Red Hat based distros, could cause issues though since Meson
|
|
||||||
# cannot differentiate between the 32-bit version and the regular 64-bit
|
|
||||||
# version that would normally be in /lib
|
|
||||||
'/usr/local/lib',
|
|
||||||
'/usr/lib',
|
|
||||||
]
|
|
||||||
),
|
|
||||||
compile_args : [with_static_boost
|
|
||||||
? '-DBOOST_FILESYSTEM_STATIC_LINK=1'
|
|
||||||
: '-DBOOST_FILESYSTEM_DYN_LINK=1'],
|
|
||||||
)
|
|
||||||
xcb_32bit_dep = winegcc.find_library('xcb')
|
xcb_32bit_dep = winegcc.find_library('xcb')
|
||||||
|
|
||||||
host_32bit_deps = [
|
host_32bit_deps = [
|
||||||
|
|||||||
Reference in New Issue
Block a user