Skip to content

Commit

Permalink
bindings: cxx: link using the libtool archives
Browse files Browse the repository at this point in the history
When linking with internal dependencies that were built with libtool the
most reliable method is to use the libtool archive (.la) files.

When building with slibtool it fails when it doesn't find the -lgpiod
linker flag, but if libgpiod is already installed to the system it will
be built using the system version instead of the newly built libraries.

Link: https://bugs.gentoo.org/913899
Signed-off-by: orbea <orbea@riseup.net>
[Bartosz: fix a typo in tests Makefile]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
  • Loading branch information
orbea authored and Bartosz Golaszewski committed Mar 20, 2024
1 parent 0c75341 commit b10af6b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bindings/cxx/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ libgpiodcxx_la_CXXFLAGS = -Wall -Wextra -g -std=gnu++17
libgpiodcxx_la_CXXFLAGS += -fvisibility=hidden -I$(top_srcdir)/include/
libgpiodcxx_la_CXXFLAGS += $(PROFILING_CFLAGS)
libgpiodcxx_la_LDFLAGS = -version-info $(subst .,:,$(ABI_CXX_VERSION))
libgpiodcxx_la_LDFLAGS += -lgpiod -L$(top_builddir)/lib
libgpiodcxx_la_LDFLAGS += $(PROFILING_LDFLAGS)
libgpiodcxx_la_LIBADD = $(top_builddir)/lib/libgpiod.la

include_HEADERS = gpiod.hpp

Expand Down
2 changes: 1 addition & 1 deletion bindings/cxx/examples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

AM_CXXFLAGS = -I$(top_srcdir)/bindings/cxx/ -I$(top_srcdir)/include
AM_CXXFLAGS += -Wall -Wextra -g -std=gnu++17
AM_LDFLAGS = -lgpiodcxx -L$(top_builddir)/bindings/cxx/
LDADD = $(top_builddir)/bindings/cxx/libgpiodcxx.la

noinst_PROGRAMS = \
async_watch_line_value \
Expand Down
6 changes: 3 additions & 3 deletions bindings/cxx/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
AM_CXXFLAGS = -I$(top_srcdir)/bindings/cxx/ -I$(top_srcdir)/include
AM_CXXFLAGS += -I$(top_srcdir)/tests/gpiosim/
AM_CXXFLAGS += -Wall -Wextra -g -std=gnu++17 $(CATCH2_CFLAGS)
AM_LDFLAGS = -lgpiodcxx -L$(top_builddir)/bindings/cxx/
AM_LDFLAGS += -lgpiosim -L$(top_builddir)/tests/gpiosim/
AM_LDFLAGS += -pthread
AM_LDFLAGS = -pthread
LDADD = $(top_builddir)/bindings/cxx/libgpiodcxx.la
LDADD += $(top_builddir)/tests/gpiosim/libgpiosim.la

noinst_PROGRAMS = gpiod-cxx-test

Expand Down

0 comments on commit b10af6b

Please sign in to comment.