build: honor default_library for the installed libraries
Subsystems (3)
PATCH 1/1 build: honor default_library for the installed libraries
The installed libraries (libgpiod, libgpiodcxx, libgpiod-glib and libgpiodbus) are built with both_libraries(), so the shared variant is always built, even with -Ddefault_library=static. When the toolchain or the environment requests a fully static link (e.g. LDFLAGS=-static, as done by Buildroot for static-only builds), linking the shared library then fails:
FAILED: lib/libgpiod.so.3.1.2
[...] crtbeginT.o: relocation R_ARC_32_ME against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
Use library() instead, which follows default_library, and set default_library=both in the project's default options, so that a default build still installs both the shared and static libraries. As library() returns an object behaving like the shared library when both are built, the users of these objects (link_with, pkgconfig.generate, generate_gir, full_path) keep working as before.
With a default build, the only change in the installed files is that libgpiotools, already declared with library(), is now also installed as a static library, like the other libraries.
--- bindings/cxx/meson.build | 3 +-- bindings/glib/meson.build | 3 +-- dbus/lib/meson.build | 3 +-- lib/meson.build | 3 +-- meson.build | 1 + 5 files changed, 5 insertions(+), 8 deletions(-)
bindings/cxx/meson.build +1 -2
@@ -3,7 +3,7 @@ cxx_inc = include_directories('.', '../../include') -libgpiodcxx_both = both_libraries('gpiodcxx', +libgpiodcxx_lib = library('gpiodcxx', sources: [ 'chip.cpp', 'chip-info.cpp',
@@ -29,7 +29,6 @@ libgpiodcxx_both = both_libraries('gpiodcxx', soversion: libgpiodcxx_soversion, install: true, ) -libgpiodcxx_lib = libgpiodcxx_both.get_shared_lib() install_headers('gpiod.hpp')
bindings/glib/meson.build +1 -2
@@ -61,7 +61,7 @@ glib_public_headers = files( glib_inc = include_directories('.', '../../include') -libgpiod_glib_both = both_libraries('gpiod-glib', +libgpiod_glib_lib = library('gpiod-glib', sources: glib_sources + [gen_enum_c, gen_enum_h], include_directories: glib_inc, c_args: ['-DG_LOG_DOMAIN="gpiod-glib"', '-DGPIODGLIB_COMPILATION'] + profiling_c_args,
@@ -71,7 +71,6 @@ libgpiod_glib_both = both_libraries('gpiod-glib', soversion: libgpiod_glib_soversion, install: true, ) -libgpiod_glib_lib = libgpiod_glib_both.get_shared_lib() install_headers('gpiod-glib.h')
dbus/lib/meson.build +1 -2
@@ -14,7 +14,7 @@ generated_dbus = gnome.gdbus_codegen('generated-gpiodbus', dbus_lib_inc = include_directories('.', '../../include') -libgpiodbus_both = both_libraries('gpiodbus', +libgpiodbus_lib = library('gpiodbus', sources: ['gpiodbus.h', generated_dbus], include_directories: dbus_lib_inc, c_args: ['-DG_LOG_DOMAIN="gpiodbus"'],
@@ -22,7 +22,6 @@ libgpiodbus_both = both_libraries('gpiodbus', soversion: 1, install: true, ) -libgpiodbus_lib = libgpiodbus_both.get_shared_lib() install_data('io.gpiod1.xml', install_dir: get_option('datadir') / 'dbus-1' / 'interfaces',
lib/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # SPDX-FileCopyrightText: 2026 Qualcomm Technologies, Inc. and/or its subsidiaries -libgpiod_both = both_libraries('gpiod', +libgpiod_lib = library('gpiod', sources: [ 'chip.c', 'chip-info.c',
@@ -22,7 +22,6 @@ libgpiod_both = both_libraries('gpiod', soversion: libgpiod_soversion, install: true, ) -libgpiod_lib = libgpiod_both.get_shared_lib() pkgconfig = import('pkgconfig') pkgconfig.generate(libgpiod_lib,
meson.build +1 -0
@@ -6,6 +6,7 @@ project('libgpiod', 'c', license: 'LGPL-2.1-or-later', default_options: [ 'c_std=gnu89', + 'default_library=both', 'cpp_std=gnu++17', 'warning_level=2', ],
Signature · 1 line
2.34.1
Bartosz Golaszewski
maintainerQuoted 10 lines · Yegor Yefremov
The installed libraries (libgpiod, libgpiodcxx, libgpiod-glib and libgpiodbus) are built with
both_libraries(), so the shared variant is always built, even with -Ddefault_library=static. When the toolchain or the environment requests a fully static link (e.g. LDFLAGS=-static, as done by Buildroot for static-only builds), linking the shared library then fails:FAILED:
lib/libgpiod.so.3.1.2
[...] crtbeginT.o: relocationR_ARC_32_MEagainst `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
Quoted 7 lines
Use
library()instead, which followsdefault_library, and set default_library=both in the project's default options, so that a default build still installs both the shared and static libraries. Aslibrary()returns an object behaving like the shared library when both are built, the users of these objects (link_with, pkgconfig.generate,generate_gir,full_path) keep working as before.
I'm not sure this is true, see below.
Quoted 8 lines
With a default build, the only change in the installed files is that libgpiotools, already declared with
library(), is now also installed as a static library, like the other libraries.Fixes 97bab4cc87dd ("build: replace autotools with meson & ninja")Assisted-by Claude:claude-opus-5-5Signed-off-by Yegor Yefremov <[email protected]>---
With this patch, the following commands:
meson setup ./build -Ddefault_library=static -Dintrospection=enabled ninja -C ./build
fail like so:
ninja: Entering directory `./build/'
[111/166] Generating bindings/glib/Gpiodglib-1.0.gir with a custom
command (wrapped by meson to set env)
FAILED: bindings/glib/Gpiodglib-1.0.gir
env PKG_CONFIG_PATH=/tmp/libgpiod/build/meson-uninstalled PKG_CONFIG=/usr/bin/pkg-config CC=cc/usr/bin/x86_64-linux-gnu-g-ir-scanner --quiet --no-libtool --namespace=Gpiodglib --nsversion=1.0 --warn-all --output bindings/glib/Gpiodglib-1.0.gir --c-include=gpiod-glib.h --c-include=gpiod-glib.h --warn-all -DGPIODGLIB_COMPILATION -I/tmp/libgpiod/bindings/glib -I/tmp/libgpiod/build/bindings/glib -I/tmp/libgpiod/bindings/glib/. -I/tmp/libgpiod/build/bindings/glib/. -I/tmp/libgpiod/bindings/glib/../../include -I/tmp/libgpiod/build/bindings/glib/../../include
-I/tmp/libgpiod/include -I/tmp/libgpiod/build/include --filelist=/tmp/libgpiod/build/bindings/glib/libgpiod-glib.a.p/Gpiodglib_1.0_gir_filelist --include=Gio-2.0 --symbol-prefix=gpiodglib
--identifier-prefix=Gpiodglib --pkg-export=gpiod-glib --cflags-begin -D_GNU_SOURCE '-DGPIOD_VERSION_STR="2.4+devel"' '-DGPIOD_API_VERSION_STR="2.2.1"' -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/libmount -I/usr/include/blkid
-I/usr/include/gio-unix-2.0 -I/usr/include/gobject-introspection-1.0 --cflags-end -I/tmp/libgpiod/bindings/glib/. -I/tmp/libgpiod/build/bindings/glib/. -I/tmp/libgpiod/bindings/glib/../../include -I/tmp/libgpiod/build/bindings/glib/../../include --add-include-path=/usr/share/gir-1.0 --add-include-path=/tmp/libgpiod/bindings/glib/. --add-include-path=/tmp/libgpiod/build/bindings/glib/. --add-include-path=/tmp/libgpiod/bindings/glib/../../include --add-include-path=/tmp/libgpiod/build/bindings/glib/../../include --library /tmp/libgpiod/build/bindings/glib/libgpiod-glib.a --extra-library=glib-2.0 --extra-library=gobject-2.0 --extra-library=gio-2.0 --extra-library=girepository-1.0
--sources-top-dirs /tmp/libgpiod/ --sources-top-dirs/tmp/libgpiod/build//usr/bin/ld: /tmp/libgpiod/build/bindings/glib/libgpiod-glib.a(chip.c.o):
in function `gpiodglib_chip_on_info_event':
/tmp/libgpiod/build/../bindings/glib/chip.c:47:(.text+0x119):
undefined reference to `gpiod_chip_read_info_event'/usr/bin/ld: /tmp/libgpiod/build/bindings/glib/libgpiod-glib.a(chip.c.o):
in function `gpiodglib_chip_constructed':
/tmp/libgpiod/build/../bindings/glib/chip.c:92:(.text+0x401):
undefined reference to `gpiod_chip_open'/usr/bin/ld: /tmp/libgpiod/build/../bindings/glib/chip.c:100:(.text+0x45d):
undefined reference to `gpiod_chip_get_fd'/usr/bin/ld: /tmp/libgpiod/build/bindings/glib/libgpiod-glib.a(chip.c.o):
in function `gpiodglib_chip_close':
/tmp/libgpiod/build/../bindings/glib/chip.c:141:(.text+0x744):
undefined reference to `gpiod_chip_close'/usr/bin/ld: /tmp/libgpiod/build/bindings/glib/libgpiod-glib.a(chip.c.o):
in function `gpiodglib_chip_get_info':
/tmp/libgpiod/build/../bindings/glib/chip.c:251:(.text+0xaee):
undefined reference to `gpiod_chip_get_info'/usr/bin/ld: /tmp/libgpiod/build/bindings/glib/libgpiod-glib.a(chip.c.o):
in function `gpiodglib_chip_get_line_info':
/tmp/libgpiod/build/../bindings/glib/chip.c:289:(.text+0xc1e):
undefined reference to `gpiod_chip_get_line_info'/usr/bin/ld: /tmp/libgpiod/build/bindings/glib/libgpiod-glib.a(chip.c.o):
in function `gpiodglib_chip_watch_line_info':
/tmp/libgpiod/build/../bindings/glib/chip.c:297:(.text+0xc54):
undefined reference to `gpiod_chip_watch_line_info'/usr/bin/ld: /tmp/libgpiod/build/bindings/glib/libgpiod-glib.a(chip.c.o):
in function `gpiodglib_chip_unwatch_line_info':
/tmp/libgpiod/build/../bindings/glib/chip.c:315:(.text+0xcdf):
undefined reference to `gpiod_chip_unwatch_line_info'/usr/bin/ld: /tmp/libgpiod/build/bindings/glib/libgpiod-glib.a(chip.c.o):
in function `gpiodglib_chip_get_line_offset_from_name':
/tmp/libgpiod/build/../bindings/glib/chip.c:345:(.text+0xdd4):
undefined reference to `gpiod_chip_get_line_offset_from_name'/usr/bin/ld: /tmp/libgpiod/build/bindings/glib/libgpiod-glib.a(chip.c.o):
in function `gpiodglib_chip_request_lines':
/tmp/libgpiod/build/../bindings/glib/chip.c:388:(.text+0xf24):
undefined reference to `gpiod_chip_request_lines'
[...]
Thanks,
Bartosz
PATCH v2 1/1 build: honor default_library for the installed libraries
In reply to Yegor YefremovThe installed libraries (libgpiod, libgpiodcxx, libgpiod-glib and libgpiodbus) are built with both_libraries(), so the shared variant is always built, even with -Ddefault_library=static. When the toolchain or the environment requests a fully static link (e.g. LDFLAGS=-static, as done by Buildroot for static-only builds), linking the shared library then fails:
FAILED: lib/libgpiod.so.3.1.2
[...] crtbeginT.o: relocation R_ARC_32_ME against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
Use library() instead, which follows default_library, and set default_library=both in the project's default options, so that a default build still installs both the shared and static libraries. As library() returns an object behaving like the shared library when both are built, the users of these objects (link_with, pkgconfig.generate, generate_gir, full_path) keep working as before.
With default_library=static, generate_gir() would get the static libgpiod-glib, but meson's gnome module does not pass internal static libraries to g-ir-scanner, so linking libgpiod-glib.a then fails with undefined references to libgpiod. A typelib for a static-only library would also be useless, as it has no shared library to load at runtime. Disable introspection when only static libraries are built, and error out if it was explicitly enabled.
With a default build, the only change in the installed files is that libgpiotools, already declared with library(), is now also installed as a static library, like the other libraries.
---
Changes v1 -> v2:
- disable introspection with default_library=static, as meson does not pass internal static libraries to g-ir-scanner (Bartosz)
bindings/cxx/meson.build | 3 +-- bindings/glib/meson.build | 3 +-- dbus/lib/meson.build | 3 +-- lib/meson.build | 3 +-- meson.build | 6 ++++++ 5 files changed, 10 insertions(+), 8 deletions(-)
bindings/cxx/meson.build +1 -2
@@ -3,7 +3,7 @@ cxx_inc = include_directories('.', '../../include') -libgpiodcxx_both = both_libraries('gpiodcxx', +libgpiodcxx_lib = library('gpiodcxx', sources: [ 'chip.cpp', 'chip-info.cpp',
@@ -29,7 +29,6 @@ libgpiodcxx_both = both_libraries('gpiodcxx', soversion: libgpiodcxx_soversion, install: true, ) -libgpiodcxx_lib = libgpiodcxx_both.get_shared_lib() install_headers('gpiod.hpp')
bindings/glib/meson.build +1 -2
@@ -61,7 +61,7 @@ glib_public_headers = files( glib_inc = include_directories('.', '../../include') -libgpiod_glib_both = both_libraries('gpiod-glib', +libgpiod_glib_lib = library('gpiod-glib', sources: glib_sources + [gen_enum_c, gen_enum_h], include_directories: glib_inc, c_args: ['-DG_LOG_DOMAIN="gpiod-glib"', '-DGPIODGLIB_COMPILATION'] + profiling_c_args,
@@ -71,7 +71,6 @@ libgpiod_glib_both = both_libraries('gpiod-glib', soversion: libgpiod_glib_soversion, install: true, ) -libgpiod_glib_lib = libgpiod_glib_both.get_shared_lib() install_headers('gpiod-glib.h')
dbus/lib/meson.build +1 -2
@@ -14,7 +14,7 @@ generated_dbus = gnome.gdbus_codegen('generated-gpiodbus', dbus_lib_inc = include_directories('.', '../../include') -libgpiodbus_both = both_libraries('gpiodbus', +libgpiodbus_lib = library('gpiodbus', sources: ['gpiodbus.h', generated_dbus], include_directories: dbus_lib_inc, c_args: ['-DG_LOG_DOMAIN="gpiodbus"'],
@@ -22,7 +22,6 @@ libgpiodbus_both = both_libraries('gpiodbus', soversion: 1, install: true, ) -libgpiodbus_lib = libgpiodbus_both.get_shared_lib() install_data('io.gpiod1.xml', install_dir: get_option('datadir') / 'dbus-1' / 'interfaces',
lib/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # SPDX-FileCopyrightText: 2026 Qualcomm Technologies, Inc. and/or its subsidiaries -libgpiod_both = both_libraries('gpiod', +libgpiod_lib = library('gpiod', sources: [ 'chip.c', 'chip-info.c',
@@ -22,7 +22,6 @@ libgpiod_both = both_libraries('gpiod', soversion: libgpiod_soversion, install: true, ) -libgpiod_lib = libgpiod_both.get_shared_lib() pkgconfig = import('pkgconfig') pkgconfig.generate(libgpiod_lib,
meson.build +6 -0
@@ -6,6 +6,7 @@ project('libgpiod', 'c', license: 'LGPL-2.1-or-later', default_options: [ 'c_std=gnu89', + 'default_library=both', 'cpp_std=gnu++17', 'warning_level=2', ],
@@ -79,6 +80,11 @@ if opt_introspection.enabled() 'introspection requires -Dbindings-glib=enabled') endif +# Introspection requires the shared library. +opt_introspection = opt_introspection.require( + get_option('default_library') != 'static', + error_message: 'introspection requires -Ddefault_library=shared or both') + # systemd requires D-Bus. if opt_systemd.enabled() assert(opt_dbus.allowed(),
Signature · 1 line
2.34.1
Bartosz Golaszewski
maintainerQuoted 29 lines · Yegor Yefremov
The installed libraries (libgpiod, libgpiodcxx, libgpiod-glib and libgpiodbus) are built with
both_libraries(), so the shared variant is always built, even with -Ddefault_library=static. When the toolchain or the environment requests a fully static link (e.g. LDFLAGS=-static, as done by Buildroot for static-only builds), linking the shared library then fails:FAILED:
lib/libgpiod.so.3.1.2
[...] crtbeginT.o: relocationR_ARC_32_MEagainst `__TMC_END__' can not be used when making a shared object; recompile with -fPICUse
library()instead, which followsdefault_library, and set default_library=both in the project's default options, so that a default build still installs both the shared and static libraries. Aslibrary()returns an object behaving like the shared library when both are built, the users of these objects (link_with, pkgconfig.generate,generate_gir,full_path) keep working as before.With default_library=static,
generate_gir()would get the static libgpiod-glib, but meson's gnome module does not pass internal static libraries to g-ir-scanner, so linking libgpiod-glib.a then fails with undefined references to libgpiod. A typelib for a static-only library would also be useless, as it has no shared library to load at runtime. Disable introspection when only static libraries are built, and error out if it was explicitly enabled.With a default build, the only change in the installed files is that libgpiotools, already declared with
library(), is now also installed as a static library, like the other libraries.
Quoted 8 lines
Fixes 97bab4cc87dd ("build: replace autotools with meson & ninja")Assisted-by Claude:claude-opus-5-5Signed-off-by Yegor Yefremov <[email protected]>---
Changes v1 -> v2:
- disable introspection with default_library=static, as meson does not pass internal static libraries to g-ir-scanner (Bartosz)
Please resend it as a new thread, not a reply to the v1 thread. Every new iteration of a series should be its own thread.
Thanks,
Bartosz
PATCH v3 1/1 build: honor default_library for the installed libraries
In reply to Yegor YefremovFrom: Yegor Yefremov <[email protected]>
The installed libraries (libgpiod, libgpiodcxx, libgpiod-glib, libgpiodbus and libgpiosim) are built with both_libraries(), so the shared variant is always built, even with -Ddefault_library=static. When the toolchain or the environment requests a fully static link (e.g. LDFLAGS=-static, as done by Buildroot for static-only builds), linking the shared library then fails:
FAILED: lib/libgpiod.so.3.1.2
[...] crtbeginT.o: relocation R_ARC_32_ME against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
Use library() instead, which follows default_library, and set default_library=both in the project's default options, so that a default build still installs both the shared and static libraries. As library() returns an object behaving like the shared library when both are built, the users of these objects (link_with, pkgconfig.generate, generate_gir, full_path) keep working as before.
The Rust bindings always link against the static libgpiosim. With default_library=shared, build a static archive from the objects of the shared libgpiosim for them, which is neither installed nor built by default.
With default_library=static, generate_gir() would get the static libgpiod-glib, but meson's gnome module does not pass internal static libraries to g-ir-scanner, so linking libgpiod-glib.a then fails with undefined references to libgpiod. A typelib for a static-only library would also be useless, as it has no shared library to load at runtime. Disable introspection when only static libraries are built, and error out if it was explicitly enabled.
With a default build, the only change in the installed files is that libgpiotools, already declared with library(), is now also installed as a static library, like the other libraries.
---
Changes v2 -> v3:
- also convert libgpiosim, which is installed too and still built the shared library with default_library=static; keep providing a static libgpiosim for the Rust bindings with default_library=shared
Changes v1 -> v2:
- disable introspection with default_library=static, as meson does not pass internal static libraries to g-ir-scanner (Bartosz)
bindings/cxx/meson.build | 3 +-- bindings/glib/meson.build | 3 +-- dbus/lib/meson.build | 3 +-- lib/meson.build | 3 +-- meson.build | 6 ++++++ tests/gpiosim/meson.build | 17 ++++++++++++++--- 6 files changed, 24 insertions(+), 11 deletions(-)
bindings/cxx/meson.build +1 -2
@@ -3,7 +3,7 @@ cxx_inc = include_directories('.', '../../include') -libgpiodcxx_both = both_libraries('gpiodcxx', +libgpiodcxx_lib = library('gpiodcxx', sources: [ 'chip.cpp', 'chip-info.cpp',
@@ -29,7 +29,6 @@ libgpiodcxx_both = both_libraries('gpiodcxx', soversion: libgpiodcxx_soversion, install: true, ) -libgpiodcxx_lib = libgpiodcxx_both.get_shared_lib() install_headers('gpiod.hpp')
bindings/glib/meson.build +1 -2
@@ -61,7 +61,7 @@ glib_public_headers = files( glib_inc = include_directories('.', '../../include') -libgpiod_glib_both = both_libraries('gpiod-glib', +libgpiod_glib_lib = library('gpiod-glib', sources: glib_sources + [gen_enum_c, gen_enum_h], include_directories: glib_inc, c_args: ['-DG_LOG_DOMAIN="gpiod-glib"', '-DGPIODGLIB_COMPILATION'] + profiling_c_args,
@@ -71,7 +71,6 @@ libgpiod_glib_both = both_libraries('gpiod-glib', soversion: libgpiod_glib_soversion, install: true, ) -libgpiod_glib_lib = libgpiod_glib_both.get_shared_lib() install_headers('gpiod-glib.h')
dbus/lib/meson.build +1 -2
@@ -14,7 +14,7 @@ generated_dbus = gnome.gdbus_codegen('generated-gpiodbus', dbus_lib_inc = include_directories('.', '../../include') -libgpiodbus_both = both_libraries('gpiodbus', +libgpiodbus_lib = library('gpiodbus', sources: ['gpiodbus.h', generated_dbus], include_directories: dbus_lib_inc, c_args: ['-DG_LOG_DOMAIN="gpiodbus"'],
@@ -22,7 +22,6 @@ libgpiodbus_both = both_libraries('gpiodbus', soversion: 1, install: true, ) -libgpiodbus_lib = libgpiodbus_both.get_shared_lib() install_data('io.gpiod1.xml', install_dir: get_option('datadir') / 'dbus-1' / 'interfaces',
lib/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # SPDX-FileCopyrightText: 2026 Qualcomm Technologies, Inc. and/or its subsidiaries -libgpiod_both = both_libraries('gpiod', +libgpiod_lib = library('gpiod', sources: [ 'chip.c', 'chip-info.c',
@@ -22,7 +22,6 @@ libgpiod_both = both_libraries('gpiod', soversion: libgpiod_soversion, install: true, ) -libgpiod_lib = libgpiod_both.get_shared_lib() pkgconfig = import('pkgconfig') pkgconfig.generate(libgpiod_lib,
meson.build +6 -0
@@ -6,6 +6,7 @@ project('libgpiod', 'c', license: 'LGPL-2.1-or-later', default_options: [ 'c_std=gnu89', + 'default_library=both', 'cpp_std=gnu++17', 'warning_level=2', ],
@@ -79,6 +80,11 @@ if opt_introspection.enabled() 'introspection requires -Dbindings-glib=enabled') endif +# Introspection requires the shared library. +opt_introspection = opt_introspection.require( + get_option('default_library') != 'static', + error_message: 'introspection requires -Ddefault_library=shared or both') + # systemd requires D-Bus. if opt_systemd.enabled() assert(opt_dbus.allowed(),
tests/gpiosim/meson.build +14 -3
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # SPDX-FileCopyrightText: 2026 Qualcomm Technologies, Inc. and/or its subsidiaries -libgpiosim_both = both_libraries('gpiosim', +libgpiosim_lib = library('gpiosim', sources: ['gpiosim.c'], c_args: ['-fvisibility=hidden'], dependencies: [libkmod_dep, mount_dep, threads_dep],
@@ -9,8 +9,19 @@ libgpiosim_both = both_libraries('gpiosim', soversion: libgpiosim_soversion, install: true, ) -libgpiosim_lib = libgpiosim_both.get_shared_lib() -libgpiosim_static = libgpiosim_both.get_static_lib() + +# The Rust bindings always link against the static libgpiosim. +if get_option('default_library') == 'both' + libgpiosim_static = libgpiosim_lib.get_static_lib() +elif get_option('default_library') == 'static' + libgpiosim_static = libgpiosim_lib +else + libgpiosim_static = static_library('gpiosim', + objects: libgpiosim_lib.extract_all_objects(recursive: false), + build_by_default: false, + ) +endif + libgpiosim_inc = include_directories('.') executable('gpiosim-selftest',
Signature · 1 line
2.55.0
Bartosz Golaszewski
maintainerQuoted 9 lines · Yegor Yefremov
From: Yegor Yefremov <[email protected]>
The installed libraries (libgpiod, libgpiodcxx, libgpiod-glib, libgpiodbus and libgpiosim) are built with
both_libraries(), so the shared variant is always built, even with -Ddefault_library=static. When the toolchain or the environment requests a fully static link (e.g. LDFLAGS=-static, as done by Buildroot for static-only builds), linking the shared library then fails:
Quoted 3 lines
FAILED:
lib/libgpiod.so.3.1.2
[...] crtbeginT.o: relocationR_ARC_32_MEagainst `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
This is a reply to a previous thead again. :(
Bart
Quoted 11 lines · Bartosz Golaszewski
Quoted 9 lines · Yegor Yefremov
From: Yegor Yefremov <[email protected]>
The installed libraries (libgpiod, libgpiodcxx, libgpiod-glib, libgpiodbus and libgpiosim) are built with
both_libraries(), so the shared variant is always built, even with -Ddefault_library=static. When the toolchain or the environment requests a fully static link (e.g. LDFLAGS=-static, as done by Buildroot for static-only builds), linking the shared library then fails:
Quoted 5 lines
Quoted 3 lines
FAILED:
lib/libgpiod.so.3.1.2
[...] crtbeginT.o: relocationR_ARC_32_MEagainst `__TMC_END__' can not be used when making a shared object; recompile with -fPICThis is a reply to a previous thead again. :(
My bad. The In-Reply-To was embedded into the patch file so I missed it :-(
Yegor
Bartosz Golaszewski
maintainerQuoted 12 lines · Yegor Yefremov
Quoted 11 lines · Bartosz Golaszewski
Quoted 9 lines · Yegor Yefremov
From: Yegor Yefremov <[email protected]>
The installed libraries (libgpiod, libgpiodcxx, libgpiod-glib, libgpiodbus and libgpiosim) are built with
both_libraries(), so the shared variant is always built, even with -Ddefault_library=static. When the toolchain or the environment requests a fully static link (e.g. LDFLAGS=-static, as done by Buildroot for static-only builds), linking the shared library then fails:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
FAILED:
lib/libgpiod.so.3.1.2
[...] crtbeginT.o: relocationR_ARC_32_MEagainst `__TMC_END__' can not be used when making a shared object; recompile with -fPICThis is a reply to a previous thead again. :(
My bad. The In-Reply-To was embedded into the patch file so I missed it :-(
Please consider using b4 for managing patches.
Bart
Quoted 18 lines · Bartosz Golaszewski
Quoted 16 lines · Yegor Yefremov
Quoted 15 lines · Bartosz Golaszewski
Quoted 12 lines · Yegor Yefremov
From: Yegor Yefremov <[email protected]>
The installed libraries (libgpiod, libgpiodcxx, libgpiod-glib, libgpiodbus and libgpiosim) are built with
both_libraries(), so the shared variant is always built, even with -Ddefault_library=static. When the toolchain or the environment requests a fully static link (e.g. LDFLAGS=-static, as done by Buildroot for static-only builds), linking the shared library then fails:FAILED:
lib/libgpiod.so.3.1.2
[...] crtbeginT.o: relocationR_ARC_32_MEagainst `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
This is a reply to a previous thead again. :(
My bad. The In-Reply-To was embedded into the patch file so I missed it :-(
Please consider using b4 for managing patches.
Interesting tool. Thanks for the hint.
Yegor