Message ID | 20200621131038.1031282-1-b.bilas@grinn-global.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/2] package/irrlicht: fix libraries linking | expand |
Bartosz, All, On 2020-06-21 15:10 +0200, Bartosz Bilas spake thusly: > Fixes: > /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `XSetSelectionOwner' [--SNIP--] > Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com> [--SNIP--] > +diff --git a/source/Irrlicht/Makefile b/source/Irrlicht/Makefile > +index 9a1bdbc..85eb264 100644 > +--- a/source/Irrlicht/Makefile > ++++ b/source/Irrlicht/Makefile > +@@ -88,7 +88,7 @@ STATIC_LIB = libIrrlicht.a > + LIB_PATH = ../../lib/$(SYSTEM) > + INSTALL_DIR = /usr/local/lib > + sharedlib install: SHARED_LIB = libIrrlicht.so > +-sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm > ++sharedlib: override LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm That's definitely incorrect: we do not want to use a library path that points to the host system libraries. I wonder why our paranoid wrapper does not catches that... :-/ So far, it would not catch it, because the LDFLAGS are from the command line, so the -L/usr/X11R6/lib is not used. But with your patch, it would be used now... > + staticlib sharedlib: CXXINCS += -I/usr/X11R6/include Ditto, we do not want to use include paths that points to the host system headers. Ah, I got it now: the wrapper only checks for a select list of known host paths, but neither /usr/X11R6/include nor /usr/X11R6/lib are in that list... But now I see that your second patch does fix that for the linker, but that's not our paranoid wrapper doing the check, but really the cross linker ld. Sigh... We need to expand our wrapper with those two paths... Anyway: you should merge the two patches together into a single one, and explain the above in thecommit log. Also, could you investigate removing the CXXINCS += -I/usr/X11R6/include line too? Normally, we should have the proper search paths already. Oh, and one last point: in a post-commit message (after the --- line), add a note that irrlicht uses CRLF line endings, and that the patch will have to be fixed when applying, because patchwork drops all the CR and keeps on LF. Care to respin, please? In the meantime, I'll send a patch to extend the list of unsafe paths in our toolchain wrapper... Thanks! :-) Regards, Yann E. MORIN. > + #OSX specific options > +-- > +2.27.0 > + > diff --git a/package/irrlicht/irrlicht.mk b/package/irrlicht/irrlicht.mk > index bd82815cde..e12d802ee7 100644 > --- a/package/irrlicht/irrlicht.mk > +++ b/package/irrlicht/irrlicht.mk > @@ -38,12 +38,14 @@ ifeq ($(BR2_STATIC_LIBS),) > IRRLICHT_CONF_OPTS += sharedlib > endif > > +# set correct path for libraries linking > +IRRLICHT_CONF_OPTS += LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" > # Irrlicht fail to detect properly the NEON support on aarch64 or ARM with NEON FPU support. > # While linking an application with libIrrlicht.so, we get an undefined reference to > # png_init_filter_functions_neon. > # Some files are missing in the libpng bundled in Irrlicht, in particular arm/arm_init.c, > # so disable NEON support completely. > -IRRLICHT_CONF_OPTS += CPPFLAGS="$(TARGET_CPPFLAGS) -DPNG_ARM_NEON_OPT=0" > +IRRLICHT_CONF_OPTS += CPPFLAGS="$(TARGET_CPPFLAGS) -DPNG_ARM_NEON_OPT=0 -I$(STAGING_DIR)/usr/include/X11" > > define IRRLICHT_BUILD_CMDS > $(TARGET_MAKE_ENV) > -- > 2.27.0 > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
Hello Yann, On 21.06.2020 22:02, Yann E. MORIN wrote: > Bartosz, All, > > On 2020-06-21 15:10 +0200, Bartosz Bilas spake thusly: >> Fixes: >> /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `XSetSelectionOwner' > [--SNIP--] >> Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com> > [--SNIP--] >> +diff --git a/source/Irrlicht/Makefile b/source/Irrlicht/Makefile >> +index 9a1bdbc..85eb264 100644 >> +--- a/source/Irrlicht/Makefile >> ++++ b/source/Irrlicht/Makefile >> +@@ -88,7 +88,7 @@ STATIC_LIB = libIrrlicht.a >> + LIB_PATH = ../../lib/$(SYSTEM) >> + INSTALL_DIR = /usr/local/lib >> + sharedlib install: SHARED_LIB = libIrrlicht.so >> +-sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm >> ++sharedlib: override LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm > That's definitely incorrect: we do not want to use a library path that > points to the host system libraries. > > I wonder why our paranoid wrapper does not catches that... :-/ > So far, it would not catch it, because the LDFLAGS are from the command > line, so the -L/usr/X11R6/lib is not used. But with your patch, it would > be used now... > >> + staticlib sharedlib: CXXINCS += -I/usr/X11R6/include > Ditto, we do not want to use include paths that points to the host > system headers. I didn't want to combine everything in one patch therefore there is a second one there. > > Ah, I got it now: the wrapper only checks for a select list of known > host paths, but neither /usr/X11R6/include nor /usr/X11R6/lib are in > that list... > > But now I see that your second patch does fix that for the linker, but > that's not our paranoid wrapper doing the check, but really the > cross linker ld. > > Sigh... We need to expand our wrapper with those two paths... > > Anyway: you should merge the two patches together into a single one, and > explain the above in thecommit log. Should I split the makefile patches to the separate ones or just do everything in one? I mean adding override flag and removing those obsolete host paths. > > Also, could you investigate removing the CXXINCS += -I/usr/X11R6/include > line too? Normally, we should have the proper search paths already. Sure, I guess I did it but I've forgotten to include it in a patch :/ > > Oh, and one last point: in a post-commit message (after the --- line), > add a note that irrlicht uses CRLF line endings, and that the patch > will have to be fixed when applying, because patchwork drops all the > CR and keeps on LF. > > Care to respin, please? Yes, I'll do that :) > > In the meantime, I'll send a patch to extend the list of unsafe paths in > our toolchain wrapper... Good ;) > > Thanks! :-) > > Regards, > Yann E. MORIN. > >> + #OSX specific options >> +-- >> +2.27.0 >> + >> diff --git a/package/irrlicht/irrlicht.mk b/package/irrlicht/irrlicht.mk >> index bd82815cde..e12d802ee7 100644 >> --- a/package/irrlicht/irrlicht.mk >> +++ b/package/irrlicht/irrlicht.mk >> @@ -38,12 +38,14 @@ ifeq ($(BR2_STATIC_LIBS),) >> IRRLICHT_CONF_OPTS += sharedlib >> endif >> >> +# set correct path for libraries linking >> +IRRLICHT_CONF_OPTS += LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" >> # Irrlicht fail to detect properly the NEON support on aarch64 or ARM with NEON FPU support. >> # While linking an application with libIrrlicht.so, we get an undefined reference to >> # png_init_filter_functions_neon. >> # Some files are missing in the libpng bundled in Irrlicht, in particular arm/arm_init.c, >> # so disable NEON support completely. >> -IRRLICHT_CONF_OPTS += CPPFLAGS="$(TARGET_CPPFLAGS) -DPNG_ARM_NEON_OPT=0" >> +IRRLICHT_CONF_OPTS += CPPFLAGS="$(TARGET_CPPFLAGS) -DPNG_ARM_NEON_OPT=0 -I$(STAGING_DIR)/usr/include/X11" >> >> define IRRLICHT_BUILD_CMDS >> $(TARGET_MAKE_ENV) >> -- >> 2.27.0 >> >> _______________________________________________ >> buildroot mailing list >> buildroot@busybox.net >> http://lists.busybox.net/mailman/listinfo/buildroot Best Bartek
diff --git a/package/irrlicht/0003-makefile-override-LDFLAGS.patch b/package/irrlicht/0003-makefile-override-LDFLAGS.patch new file mode 100644 index 0000000000..16c38d5baa --- /dev/null +++ b/package/irrlicht/0003-makefile-override-LDFLAGS.patch @@ -0,0 +1,29 @@ +From f597ac417f0eefab8f388afe617a0d07d08d87bb Mon Sep 17 00:00:00 2001 +From: Bartosz Bilas <b.bilas@grinn-global.com> +Date: Sun, 21 Jun 2020 12:57:47 +0200 +Subject: [PATCH] makefile: override LDFLAGS + +That's needed to fix proper linking to X11 libraries +within package makefile. + +Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com> +--- + source/Irrlicht/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/source/Irrlicht/Makefile b/source/Irrlicht/Makefile +index 9a1bdbc..85eb264 100644 +--- a/source/Irrlicht/Makefile ++++ b/source/Irrlicht/Makefile +@@ -88,7 +88,7 @@ STATIC_LIB = libIrrlicht.a + LIB_PATH = ../../lib/$(SYSTEM) + INSTALL_DIR = /usr/local/lib + sharedlib install: SHARED_LIB = libIrrlicht.so +-sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm ++sharedlib: override LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm + staticlib sharedlib: CXXINCS += -I/usr/X11R6/include + + #OSX specific options +-- +2.27.0 + diff --git a/package/irrlicht/irrlicht.mk b/package/irrlicht/irrlicht.mk index bd82815cde..e12d802ee7 100644 --- a/package/irrlicht/irrlicht.mk +++ b/package/irrlicht/irrlicht.mk @@ -38,12 +38,14 @@ ifeq ($(BR2_STATIC_LIBS),) IRRLICHT_CONF_OPTS += sharedlib endif +# set correct path for libraries linking +IRRLICHT_CONF_OPTS += LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" # Irrlicht fail to detect properly the NEON support on aarch64 or ARM with NEON FPU support. # While linking an application with libIrrlicht.so, we get an undefined reference to # png_init_filter_functions_neon. # Some files are missing in the libpng bundled in Irrlicht, in particular arm/arm_init.c, # so disable NEON support completely. -IRRLICHT_CONF_OPTS += CPPFLAGS="$(TARGET_CPPFLAGS) -DPNG_ARM_NEON_OPT=0" +IRRLICHT_CONF_OPTS += CPPFLAGS="$(TARGET_CPPFLAGS) -DPNG_ARM_NEON_OPT=0 -I$(STAGING_DIR)/usr/include/X11" define IRRLICHT_BUILD_CMDS $(TARGET_MAKE_ENV)
Fixes: /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `XSetSelectionOwner' /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `glXGetProcAddress' /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `glXMakeCurrent' /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `XF86VidModeSetViewPort' /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `XF86VidModeSwitchToMode' /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `glClearDepth' /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `XGetVisualInfo' /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `XGrabKeyboard' /home/bartekk/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/9.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/bartekk/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libIrrlicht.so: undefined reference to `glMatrixMode' Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com> --- .../0003-makefile-override-LDFLAGS.patch | 29 +++++++++++++++++++ package/irrlicht/irrlicht.mk | 4 ++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 package/irrlicht/0003-makefile-override-LDFLAGS.patch