Skip to content

Commit 27f8ae1

Browse files
committed
fix(glib): use -fPIE explicitly for g-ir-scanner
AlmaLinux 9 RPM build environment disables PIE by default by `LDFLAGS="-specs=/usr/lib/rpm/redhat/redhat-hardened-ld"`. If PIE is disabled, `g-ir-scanner` is failed: /usr/bin/ld: /build/rpmbuild/BUILD/apache-arrow-adbc-18/glib/build/tmp-introspect4ug84fdq/ADBC-1.0.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE Fixes #2574.
1 parent a88751d commit 27f8ae1

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

glib/adbc-arrow-glib/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ adbc_arrow_glib_gir = \
8181
libadbc_arrow_glib,
8282
dependencies: [declare_dependency(sources: adbc_glib_gir), arrow_glib],
8383
export_packages: 'adbc-arrow-glib',
84-
extra_args: ['--warn-all'],
84+
extra_args: gir_scanner_extra_args,
8585
fatal_warnings: gi_fatal_warnings,
8686
header: 'adbc-arrow-glib/adbc-arrow-glib.h',
8787
identifier_prefix: 'GADBCArrow',

glib/adbc-glib/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pkgconfig.generate(
9191
adbc_glib_gir = gnome.generate_gir(
9292
libadbc_glib,
9393
export_packages: 'adbc-glib',
94-
extra_args: ['--warn-all'],
94+
extra_args: gir_scanner_extra_args,
9595
fatal_warnings: gi_fatal_warnings,
9696
header: 'adbc-glib/adbc-glib.h',
9797
identifier_prefix: 'GADBC',

glib/meson.build

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ if adbc_build_dir != ''
5757
adbc_build_dir = meson.source_root() / adbc_build_dir
5858
endif
5959

60+
c_compiler = meson.get_compiler('c')
6061
if adbc_build_dir == ''
6162
adbc_driver_manager = dependency('adbc-driver-manager')
6263
else
63-
c_compiler = meson.get_compiler('c')
6464
adbc_driver_manager = c_compiler.find_library(
6565
'adbc_driver_manager',
6666
dirs: [adbc_build_dir],
@@ -76,6 +76,18 @@ if generate_vapi
7676
add_languages('vala')
7777
endif
7878

79+
# Specify -fPIE explicitly for g-ir-scanner because PIE is disabled by
80+
# default on AlmaLinux 9 RPM build by
81+
# LDFLAGS="-specs=/usr/lib/rpm/redhat/redhat-hardened-ld".
82+
gir_scanner_cflags = c_compiler.get_supported_arguments('-fPIE')
83+
if gir_scanner_cflags.length() == 0
84+
gir_scanner_extra_args = []
85+
else
86+
gir_scanner_extra_args = ['--cflags-begin'] + gir_scanner_cflags + [
87+
'--cflags-end',
88+
]
89+
endif
90+
7991
subdir('adbc-glib')
8092
arrow_glib = dependency('arrow-glib', required: generate_vapi)
8193
if arrow_glib.found()

0 commit comments

Comments
 (0)