* [libgpiod][PATCH 1/1] dbus: manager: fix linker not finding libgpiod.so @ 2024-10-30 16:49 Boerge Struempfel 2024-11-04 9:38 ` Bartosz Golaszewski 0 siblings, 1 reply; 6+ messages in thread From: Boerge Struempfel @ 2024-10-30 16:49 UTC (permalink / raw) To: linux-gpio, Bartosz Golaszewski; +Cc: Boerge Struempfel, Boerge Struempfel When crosscompiling, the linker isn't finding libpgiod.so while linking the manager to libgpiod-glib.so. In order to fix this issue, we manually force the linker to look in the corresponding folder for needed shared libraries, when building the manager. Signed-off-by: Boerge Struempfel <boerge.struempfel@gmail.com> --- dbus/manager/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/dbus/manager/Makefile.am b/dbus/manager/Makefile.am index d1cef8e..32c9e30 100644 --- a/dbus/manager/Makefile.am +++ b/dbus/manager/Makefile.am @@ -9,6 +9,7 @@ AM_CFLAGS += -DG_LOG_DOMAIN=\"gpio-manager\" AM_CFLAGS += $(PROFILING_CFLAGS) AM_LDFLAGS = $(GLIB_LIBS) $(GIO_LIBS) $(GIO_UNIX_LIBS) $(GUDEV_LIBS) AM_LDFLAGS += $(PROFILING_LDFLAGS) +AM_LDFLAGS += -Wl,-rpath,$(top_builddir)/lib/.libs LDADD = $(top_builddir)/bindings/glib/libgpiod-glib.la LDADD += $(top_builddir)/dbus/lib/libgpiodbus.la -- 2.43.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [libgpiod][PATCH 1/1] dbus: manager: fix linker not finding libgpiod.so 2024-10-30 16:49 [libgpiod][PATCH 1/1] dbus: manager: fix linker not finding libgpiod.so Boerge Struempfel @ 2024-11-04 9:38 ` Bartosz Golaszewski 2024-11-04 11:18 ` Börge Strümpfel 0 siblings, 1 reply; 6+ messages in thread From: Bartosz Golaszewski @ 2024-11-04 9:38 UTC (permalink / raw) To: Boerge Struempfel; +Cc: linux-gpio, Bartosz Golaszewski, Boerge Struempfel On Wed, Oct 30, 2024 at 5:49 PM Boerge Struempfel <boerge.struempfel@gmail.com> wrote: > > When crosscompiling, the linker isn't finding libpgiod.so while linking > the manager to libgpiod-glib.so. > > In order to fix this issue, we manually force the linker to look in > the corresponding folder for needed shared libraries, when building the > manager. > > Signed-off-by: Boerge Struempfel <boerge.struempfel@gmail.com> > --- > dbus/manager/Makefile.am | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/dbus/manager/Makefile.am b/dbus/manager/Makefile.am > index d1cef8e..32c9e30 100644 > --- a/dbus/manager/Makefile.am > +++ b/dbus/manager/Makefile.am > @@ -9,6 +9,7 @@ AM_CFLAGS += -DG_LOG_DOMAIN=\"gpio-manager\" > AM_CFLAGS += $(PROFILING_CFLAGS) > AM_LDFLAGS = $(GLIB_LIBS) $(GIO_LIBS) $(GIO_UNIX_LIBS) $(GUDEV_LIBS) > AM_LDFLAGS += $(PROFILING_LDFLAGS) > +AM_LDFLAGS += -Wl,-rpath,$(top_builddir)/lib/.libs > LDADD = $(top_builddir)/bindings/glib/libgpiod-glib.la > LDADD += $(top_builddir)/dbus/lib/libgpiodbus.la > > -- > 2.43.0 > > Can you give me more info on your environment? I'm cross-compiling just fine and the: LDADD += $(top_builddir)/dbus/lib/libgpiodbus.la bit should be enough for linking. Bart ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libgpiod][PATCH 1/1] dbus: manager: fix linker not finding libgpiod.so 2024-11-04 9:38 ` Bartosz Golaszewski @ 2024-11-04 11:18 ` Börge Strümpfel 2025-02-05 23:46 ` Börge Strümpfel 0 siblings, 1 reply; 6+ messages in thread From: Börge Strümpfel @ 2024-11-04 11:18 UTC (permalink / raw) To: Bartosz Golaszewski; +Cc: linux-gpio, Bartosz Golaszewski, Boerge Struempfel Hi Bart, thank you for your reply. you are in fact correct and the LDADD is enough. There seems to be an issue with the sdk I was using. After manually crosscompiling using a different sdk, I no longer get the error that libgpiod.so can not be found by the linker. The sdk with which I got the error was generated using buildroot version 2024.01. However the error does not occur on the current buildroot master version. Therefore you can ignore this patch. Kind Regards, Boerge On Mon, Nov 4, 2024 at 10:39 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > On Wed, Oct 30, 2024 at 5:49 PM Boerge Struempfel > <boerge.struempfel@gmail.com> wrote: > > > > When crosscompiling, the linker isn't finding libpgiod.so while linking > > the manager to libgpiod-glib.so. > > > > In order to fix this issue, we manually force the linker to look in > > the corresponding folder for needed shared libraries, when building the > > manager. > > > > Signed-off-by: Boerge Struempfel <boerge.struempfel@gmail.com> > > --- > > dbus/manager/Makefile.am | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/dbus/manager/Makefile.am b/dbus/manager/Makefile.am > > index d1cef8e..32c9e30 100644 > > --- a/dbus/manager/Makefile.am > > +++ b/dbus/manager/Makefile.am > > @@ -9,6 +9,7 @@ AM_CFLAGS += -DG_LOG_DOMAIN=\"gpio-manager\" > > AM_CFLAGS += $(PROFILING_CFLAGS) > > AM_LDFLAGS = $(GLIB_LIBS) $(GIO_LIBS) $(GIO_UNIX_LIBS) $(GUDEV_LIBS) > > AM_LDFLAGS += $(PROFILING_LDFLAGS) > > +AM_LDFLAGS += -Wl,-rpath,$(top_builddir)/lib/.libs > > LDADD = $(top_builddir)/bindings/glib/libgpiod-glib.la > > LDADD += $(top_builddir)/dbus/lib/libgpiodbus.la > > > > -- > > 2.43.0 > > > > > > Can you give me more info on your environment? I'm cross-compiling > just fine and the: > > LDADD += $(top_builddir)/dbus/lib/libgpiodbus.la > > bit should be enough for linking. > > Bart ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libgpiod][PATCH 1/1] dbus: manager: fix linker not finding libgpiod.so 2024-11-04 11:18 ` Börge Strümpfel @ 2025-02-05 23:46 ` Börge Strümpfel 2025-02-06 8:48 ` Bartosz Golaszewski 0 siblings, 1 reply; 6+ messages in thread From: Börge Strümpfel @ 2025-02-05 23:46 UTC (permalink / raw) To: Bartosz Golaszewski; +Cc: linux-gpio, Bartosz Golaszewski, Boerge Struempfel Hi Bart, While preparing a patch to add gpio-manager to mainline Buildroot, I encountered this issue again. That is, I can successfully compile the gpio-manager manually (using autotools/gcc/ld provided by ubuntu 2024) however, when using the Buildroot infrastructure, I get a compiler error, stating that the libgpiod.so.3 cannot be found. After further investigation, I'm increasingly unsure on how the libgpiod.so.3 is supposed to be found by the linker in the first place: From what I see, gpio-manager depends on: - bindings/glib/libgpiod-glib - dbus/lib/libgpiodbus - lib/libgpiod However, I see no direct reference in dbus/manager/Makefile.am, nor can I see an indirect reference via the Makefile.am files used to generate: - bindings/glib/libgpiod-glib.la - dbus/lib/libgpiodbus.la Am I missing something obvious? Furthermore upon review, I believe the solution I proposed last October was flawed - I should have used: LDADD += $(top_builddir)/lib/libgpiod.la instead of directly modifying the linker via: AM_LDFLAGS += -Wl,-rpath,$(top_builddir)/lib/.libs Kind regards, Boerge Struempfel On Mon, Nov 4, 2024 at 12:18 PM Börge Strümpfel <boerge.struempfel@gmail.com> wrote: > > Hi Bart, > > thank you for your reply. > > you are in fact correct and the LDADD is enough. There seems to be an > issue with the sdk I was using. After manually crosscompiling using a > different sdk, I no longer get the error that libgpiod.so can not be > found by the linker. > > The sdk with which I got the error was generated using buildroot version > 2024.01. However the error does not occur on the current buildroot > master version. Therefore you can ignore this patch. > > Kind Regards, > Boerge > > On Mon, Nov 4, 2024 at 10:39 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > > > On Wed, Oct 30, 2024 at 5:49 PM Boerge Struempfel > > <boerge.struempfel@gmail.com> wrote: > > > > > > When crosscompiling, the linker isn't finding libpgiod.so while linking > > > the manager to libgpiod-glib.so. > > > > > > In order to fix this issue, we manually force the linker to look in > > > the corresponding folder for needed shared libraries, when building the > > > manager. > > > > > > Signed-off-by: Boerge Struempfel <boerge.struempfel@gmail.com> > > > --- > > > dbus/manager/Makefile.am | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/dbus/manager/Makefile.am b/dbus/manager/Makefile.am > > > index d1cef8e..32c9e30 100644 > > > --- a/dbus/manager/Makefile.am > > > +++ b/dbus/manager/Makefile.am > > > @@ -9,6 +9,7 @@ AM_CFLAGS += -DG_LOG_DOMAIN=\"gpio-manager\" > > > AM_CFLAGS += $(PROFILING_CFLAGS) > > > AM_LDFLAGS = $(GLIB_LIBS) $(GIO_LIBS) $(GIO_UNIX_LIBS) $(GUDEV_LIBS) > > > AM_LDFLAGS += $(PROFILING_LDFLAGS) > > > +AM_LDFLAGS += -Wl,-rpath,$(top_builddir)/lib/.libs > > > LDADD = $(top_builddir)/bindings/glib/libgpiod-glib.la > > > LDADD += $(top_builddir)/dbus/lib/libgpiodbus.la > > > > > > -- > > > 2.43.0 > > > > > > > > > > Can you give me more info on your environment? I'm cross-compiling > > just fine and the: > > > > LDADD += $(top_builddir)/dbus/lib/libgpiodbus.la > > > > bit should be enough for linking. > > > > Bart ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libgpiod][PATCH 1/1] dbus: manager: fix linker not finding libgpiod.so 2025-02-05 23:46 ` Börge Strümpfel @ 2025-02-06 8:48 ` Bartosz Golaszewski 2025-02-07 15:45 ` Börge Strümpfel 0 siblings, 1 reply; 6+ messages in thread From: Bartosz Golaszewski @ 2025-02-06 8:48 UTC (permalink / raw) To: Börge Strümpfel Cc: linux-gpio, Bartosz Golaszewski, Boerge Struempfel On Thu, Feb 6, 2025 at 12:46 AM Börge Strümpfel <boerge.struempfel@gmail.com> wrote: > > Hi Bart, > > While preparing a patch to add gpio-manager to mainline Buildroot, I > encountered this issue again. That is, I can successfully compile the > gpio-manager manually (using autotools/gcc/ld provided by ubuntu 2024) however, > when using the Buildroot infrastructure, I get a compiler error, stating that > the libgpiod.so.3 cannot be found. > > After further investigation, I'm increasingly unsure on how the > libgpiod.so.3 is supposed to be found by the linker in the first place: > > From what I see, gpio-manager depends on: > - bindings/glib/libgpiod-glib > - dbus/lib/libgpiodbus Correct. > - lib/libgpiod This one is an indirect dependency, it's already pulled in by libgpiod-glib.so. > > However, I see no direct reference in dbus/manager/Makefile.am, nor can I see > an indirect reference via the Makefile.am files used to generate: > - bindings/glib/libgpiod-glib.la > - dbus/lib/libgpiodbus.la > > Am I missing something obvious? > These are generated in different directories, the Makefiles in there take care of this. > Furthermore upon review, I believe the solution I proposed last October was > flawed - I should have used: > LDADD += $(top_builddir)/lib/libgpiod.la On Ubuntu, I see that gpio-manager is only linked against libgpiod-glib.so and libgpiodbus.so. However if I cross-compile on yocto, it's linked against libgpiod.so as well. I don't know exactly what the differences in linker setup are but yocto is able to find libgpiod without problems. Before we add an unnecessary flag, may I suggest looking into how yocto does the linking? Bart ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libgpiod][PATCH 1/1] dbus: manager: fix linker not finding libgpiod.so 2025-02-06 8:48 ` Bartosz Golaszewski @ 2025-02-07 15:45 ` Börge Strümpfel 0 siblings, 0 replies; 6+ messages in thread From: Börge Strümpfel @ 2025-02-07 15:45 UTC (permalink / raw) To: Bartosz Golaszewski; +Cc: linux-gpio, Bartosz Golaszewski, Boerge Struempfel Hi Bart, On Thu, Feb 6, 2025 at 9:48 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > On Thu, Feb 6, 2025 at 12:46 AM Börge Strümpfel > <boerge.struempfel@gmail.com> wrote: > > > > Hi Bart, > > > > While preparing a patch to add gpio-manager to mainline Buildroot, I > > encountered this issue again. That is, I can successfully compile the > > gpio-manager manually (using autotools/gcc/ld provided by ubuntu 2024) however, > > when using the Buildroot infrastructure, I get a compiler error, stating that > > the libgpiod.so.3 cannot be found. > > > > After further investigation, I'm increasingly unsure on how the > > libgpiod.so.3 is supposed to be found by the linker in the first place: > > > > From what I see, gpio-manager depends on: > > - bindings/glib/libgpiod-glib > > - dbus/lib/libgpiodbus > > Correct. > > > - lib/libgpiod > > This one is an indirect dependency, it's already pulled in by libgpiod-glib.so. > Yes. You are right - there are no direct calls into the libgpiod library only via libgpiod-glib.so. I also verified that the libgpiod is properly build and linked against the libgpiod.so. > > > > However, I see no direct reference in dbus/manager/Makefile.am, nor can I see > > an indirect reference via the Makefile.am files used to generate: > > - bindings/glib/libgpiod-glib.la > > - dbus/lib/libgpiodbus.la > > > > Am I missing something obvious? > > > > These are generated in different directories, the Makefiles in there > take care of this. > > > Furthermore upon review, I believe the solution I proposed last October was > > flawed - I should have used: > > LDADD += $(top_builddir)/lib/libgpiod.la > > On Ubuntu, I see that gpio-manager is only linked against > libgpiod-glib.so and libgpiodbus.so. However if I cross-compile on > yocto, it's linked against libgpiod.so as well. I don't know exactly > what the differences in linker setup are but yocto is able to find > libgpiod without problems. Before we add an unnecessary flag, may I > suggest looking into how yocto does the linking? Here is what I have figured out so far: - whether libgpiod.so is linked to the final execuatble seems to be at least partially dependent on the version of autotools and/or libtools. (Tested by backporting yocto's autotools and libtools) - there is a fix in the yocto recipe for finding the libgpiod.so bit it conserns only gobject introspection, which is not the problem I am facing with buildroot - The behaviour of the problem I am facing in buildroot does not depend on gobject introspection as far as I can tell, since the error happens independent of it. (which is good in my understanding, since it is what I would expect) - there is a flag in the libtool "link_all_deplibs" which yocto sets to "unknown" and which in buildroot is set to "no" after the configure step (I couldn't figure out the reason for this yet) If I manually tweek this value in buildroot between the configure and build steps, the gpio-manager is build successfully (with or without an explicit link to libgpiod.so depending on the version of libtools used). However setting this flag to "no" in yocto, still leads to a successful build. Therefore I don't think, this is the root-cause of this problem. By now I fully agree with you, that gpio-manager should not get libgpiod.so as a dependency even if I don't know yet where this error is coming from. Kind Regards, and thanks for your support, Boerge ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-07 15:45 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-10-30 16:49 [libgpiod][PATCH 1/1] dbus: manager: fix linker not finding libgpiod.so Boerge Struempfel 2024-11-04 9:38 ` Bartosz Golaszewski 2024-11-04 11:18 ` Börge Strümpfel 2025-02-05 23:46 ` Börge Strümpfel 2025-02-06 8:48 ` Bartosz Golaszewski 2025-02-07 15:45 ` Börge Strümpfel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).