* [Buildroot] [PATCH 1/2] package/erlang-jiffy: fix build failure due to lack of -fPIC @ 2021-10-14 21:54 Giulio Benetti 2021-10-14 21:54 ` [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9 Giulio Benetti ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Giulio Benetti @ 2021-10-14 21:54 UTC (permalink / raw) To: buildroot; +Cc: Giulio Benetti, Will Newton, Johan Oudinet Package erlang-jiffy needs to be linked with -fPIC otherwise it throws linker error: ``` failed with return code 1 and the following output: /home/giuliobenetti/br_reproduce/60296a48210e7ffc6bc9fa50ee586441a8957e85/output/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/9.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld: /tmp/jiffy.so.FCaOXC.ltrans1.ltrans.o: relocation R_X86_64_PC32 against symbol `dec_destroy' can not be used when making a shared object; recompile with -fPIC ``` This is architecture indipendent, so let's add -fPIC flag to LDFLAGS in any case. Fixes: http://autobuild.buildroot.net/results/602/60296a48210e7ffc6bc9fa50ee586441a8957e85/ Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> --- package/erlang-jiffy/erlang-jiffy.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/erlang-jiffy/erlang-jiffy.mk b/package/erlang-jiffy/erlang-jiffy.mk index e50a5f598f..dce6a0f8b3 100644 --- a/package/erlang-jiffy/erlang-jiffy.mk +++ b/package/erlang-jiffy/erlang-jiffy.mk @@ -11,4 +11,7 @@ ERLANG_JIFFY_LICENSE = MIT (core), \ BSD-3-Clause (tests) ERLANG_JIFFY_LICENSE_FILES = LICENSE +# erlang-jiffy needs -fPIC to link succesfully +ERLANG_JIFFY_REBAR_ENV += LDFLAGS="-fPIC" + $(eval $(rebar-package)) -- 2.25.1 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9 2021-10-14 21:54 [Buildroot] [PATCH 1/2] package/erlang-jiffy: fix build failure due to lack of -fPIC Giulio Benetti @ 2021-10-14 21:54 ` Giulio Benetti 2021-12-20 9:34 ` Giulio Benetti 2021-12-28 22:06 ` Thomas Petazzoni 2021-10-14 21:54 ` [Buildroot] [PATCH 2/2] package/erlang-jiffy: fix build failure due to lack of -fPIC Giulio Benetti 2021-10-18 20:14 ` [Buildroot] [PATCH 1/2] " Thomas Petazzoni 2 siblings, 2 replies; 13+ messages in thread From: Giulio Benetti @ 2021-10-14 21:54 UTC (permalink / raw) To: buildroot; +Cc: Giulio Benetti, Will Newton, Johan Oudinet Bump version to 1.0.9 Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> --- package/erlang-jiffy/erlang-jiffy.hash | 2 +- package/erlang-jiffy/erlang-jiffy.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/erlang-jiffy/erlang-jiffy.hash b/package/erlang-jiffy/erlang-jiffy.hash index 19e4f96012..93c5e1f8c8 100644 --- a/package/erlang-jiffy/erlang-jiffy.hash +++ b/package/erlang-jiffy/erlang-jiffy.hash @@ -1,3 +1,3 @@ # Locally computed -sha256 7cf67840c58b8732e12c84c8a3b714774da2601ae5e6a57f286273e25b205516 erlang-jiffy-1.0.6.tar.gz +sha256 45c224afe0ea2d3ece39e227f01f5585ad53b8b91d2d6924f9f50548874ae879 erlang-jiffy-1.0.9.tar.gz sha256 0fa8afad2f02c08850a16e36fe55376ee19732b3a116a0207f2a73c857777a49 LICENSE diff --git a/package/erlang-jiffy/erlang-jiffy.mk b/package/erlang-jiffy/erlang-jiffy.mk index dce6a0f8b3..25e7227c39 100644 --- a/package/erlang-jiffy/erlang-jiffy.mk +++ b/package/erlang-jiffy/erlang-jiffy.mk @@ -4,7 +4,7 @@ # ################################################################################ -ERLANG_JIFFY_VERSION = 1.0.6 +ERLANG_JIFFY_VERSION = 1.0.9 ERLANG_JIFFY_SITE = $(call github,davisp,jiffy,$(ERLANG_JIFFY_VERSION)) ERLANG_JIFFY_LICENSE = MIT (core), \ BSD-3-Clause (Google double conversion library), \ -- 2.25.1 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9 2021-10-14 21:54 ` [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9 Giulio Benetti @ 2021-12-20 9:34 ` Giulio Benetti 2021-12-28 22:06 ` Thomas Petazzoni 1 sibling, 0 replies; 13+ messages in thread From: Giulio Benetti @ 2021-12-20 9:34 UTC (permalink / raw) To: buildroot; +Cc: Will Newton, Johan Oudinet Kindly ping On 14/10/21 23:54, Giulio Benetti wrote: > Bump version to 1.0.9 > > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> > --- > package/erlang-jiffy/erlang-jiffy.hash | 2 +- > package/erlang-jiffy/erlang-jiffy.mk | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/package/erlang-jiffy/erlang-jiffy.hash b/package/erlang-jiffy/erlang-jiffy.hash > index 19e4f96012..93c5e1f8c8 100644 > --- a/package/erlang-jiffy/erlang-jiffy.hash > +++ b/package/erlang-jiffy/erlang-jiffy.hash > @@ -1,3 +1,3 @@ > # Locally computed > -sha256 7cf67840c58b8732e12c84c8a3b714774da2601ae5e6a57f286273e25b205516 erlang-jiffy-1.0.6.tar.gz > +sha256 45c224afe0ea2d3ece39e227f01f5585ad53b8b91d2d6924f9f50548874ae879 erlang-jiffy-1.0.9.tar.gz > sha256 0fa8afad2f02c08850a16e36fe55376ee19732b3a116a0207f2a73c857777a49 LICENSE > diff --git a/package/erlang-jiffy/erlang-jiffy.mk b/package/erlang-jiffy/erlang-jiffy.mk > index dce6a0f8b3..25e7227c39 100644 > --- a/package/erlang-jiffy/erlang-jiffy.mk > +++ b/package/erlang-jiffy/erlang-jiffy.mk > @@ -4,7 +4,7 @@ > # > ################################################################################ > > -ERLANG_JIFFY_VERSION = 1.0.6 > +ERLANG_JIFFY_VERSION = 1.0.9 > ERLANG_JIFFY_SITE = $(call github,davisp,jiffy,$(ERLANG_JIFFY_VERSION)) > ERLANG_JIFFY_LICENSE = MIT (core), \ > BSD-3-Clause (Google double conversion library), \ > -- Giulio Benetti Benetti Engineering sas _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9 2021-10-14 21:54 ` [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9 Giulio Benetti 2021-12-20 9:34 ` Giulio Benetti @ 2021-12-28 22:06 ` Thomas Petazzoni 1 sibling, 0 replies; 13+ messages in thread From: Thomas Petazzoni @ 2021-12-28 22:06 UTC (permalink / raw) To: Giulio Benetti; +Cc: Will Newton, Johan Oudinet, buildroot On Thu, 14 Oct 2021 23:54:54 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote: > Bump version to 1.0.9 > > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> > --- > package/erlang-jiffy/erlang-jiffy.hash | 2 +- > package/erlang-jiffy/erlang-jiffy.mk | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) Applied to master, thanks. Thomas -- Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Buildroot] [PATCH 2/2] package/erlang-jiffy: fix build failure due to lack of -fPIC 2021-10-14 21:54 [Buildroot] [PATCH 1/2] package/erlang-jiffy: fix build failure due to lack of -fPIC Giulio Benetti 2021-10-14 21:54 ` [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9 Giulio Benetti @ 2021-10-14 21:54 ` Giulio Benetti 2021-10-14 21:57 ` Giulio Benetti 2021-10-18 20:14 ` [Buildroot] [PATCH 1/2] " Thomas Petazzoni 2 siblings, 1 reply; 13+ messages in thread From: Giulio Benetti @ 2021-10-14 21:54 UTC (permalink / raw) To: buildroot; +Cc: Giulio Benetti, Will Newton, Johan Oudinet Package erlang-jiffy needs to be linked with -fPIC otherwise it throws linker error: ``` failed with return code 1 and the following output: /home/giuliobenetti/br_reproduce/60296a48210e7ffc6bc9fa50ee586441a8957e85/output/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/9.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld: /tmp/jiffy.so.FCaOXC.ltrans1.ltrans.o: relocation R_X86_64_PC32 against symbol `dec_destroy' can not be used when making a shared object; recompile with -fPIC ``` This is architecture indipendent, so let's add -fPIC flag to LDFLAGS in any case. Fixes: http://autobuild.buildroot.net/results/602/60296a48210e7ffc6bc9fa50ee586441a8957e85/ Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> --- package/erlang-jiffy/erlang-jiffy.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/erlang-jiffy/erlang-jiffy.mk b/package/erlang-jiffy/erlang-jiffy.mk index cd94632962..25e7227c39 100644 --- a/package/erlang-jiffy/erlang-jiffy.mk +++ b/package/erlang-jiffy/erlang-jiffy.mk @@ -11,4 +11,7 @@ ERLANG_JIFFY_LICENSE = MIT (core), \ BSD-3-Clause (tests) ERLANG_JIFFY_LICENSE_FILES = LICENSE +# erlang-jiffy needs -fPIC to link succesfully +ERLANG_JIFFY_REBAR_ENV += LDFLAGS="-fPIC" + $(eval $(rebar-package)) -- 2.25.1 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Buildroot] [PATCH 2/2] package/erlang-jiffy: fix build failure due to lack of -fPIC 2021-10-14 21:54 ` [Buildroot] [PATCH 2/2] package/erlang-jiffy: fix build failure due to lack of -fPIC Giulio Benetti @ 2021-10-14 21:57 ` Giulio Benetti 0 siblings, 0 replies; 13+ messages in thread From: Giulio Benetti @ 2021-10-14 21:57 UTC (permalink / raw) To: buildroot; +Cc: Will Newton, Johan Oudinet I was too fast and made a mistake, please drop this patch in favour of this patchset: https://patchwork.ozlabs.org/project/buildroot/list/?series=267107 Sorry for the noise! Best regards -- Giulio Benetti Benetti Engineering sas On 10/14/21 11:54 PM, Giulio Benetti wrote: > Package erlang-jiffy needs to be linked with -fPIC otherwise it throws > linker error: > ``` > failed with return code 1 and the following output: > /home/giuliobenetti/br_reproduce/60296a48210e7ffc6bc9fa50ee586441a8957e85/output/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/9.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld: /tmp/jiffy.so.FCaOXC.ltrans1.ltrans.o: relocation R_X86_64_PC32 against symbol `dec_destroy' can not be used when making a shared object; > recompile with -fPIC > ``` > > This is architecture indipendent, so let's add -fPIC flag to LDFLAGS in any > case. > > Fixes: > http://autobuild.buildroot.net/results/602/60296a48210e7ffc6bc9fa50ee586441a8957e85/ > > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> > --- > package/erlang-jiffy/erlang-jiffy.mk | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/package/erlang-jiffy/erlang-jiffy.mk b/package/erlang-jiffy/erlang-jiffy.mk > index cd94632962..25e7227c39 100644 > --- a/package/erlang-jiffy/erlang-jiffy.mk > +++ b/package/erlang-jiffy/erlang-jiffy.mk > @@ -11,4 +11,7 @@ ERLANG_JIFFY_LICENSE = MIT (core), \ > BSD-3-Clause (tests) > ERLANG_JIFFY_LICENSE_FILES = LICENSE > > +# erlang-jiffy needs -fPIC to link succesfully > +ERLANG_JIFFY_REBAR_ENV += LDFLAGS="-fPIC" > + > $(eval $(rebar-package)) > _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/erlang-jiffy: fix build failure due to lack of -fPIC 2021-10-14 21:54 [Buildroot] [PATCH 1/2] package/erlang-jiffy: fix build failure due to lack of -fPIC Giulio Benetti 2021-10-14 21:54 ` [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9 Giulio Benetti 2021-10-14 21:54 ` [Buildroot] [PATCH 2/2] package/erlang-jiffy: fix build failure due to lack of -fPIC Giulio Benetti @ 2021-10-18 20:14 ` Thomas Petazzoni 2021-12-17 20:49 ` Thomas Petazzoni 2 siblings, 1 reply; 13+ messages in thread From: Thomas Petazzoni @ 2021-10-18 20:14 UTC (permalink / raw) To: Giulio Benetti; +Cc: Yann E. MORIN, Will Newton, Johan Oudinet, buildroot Hello Giulio, On Thu, 14 Oct 2021 23:54:53 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote: > Package erlang-jiffy needs to be linked with -fPIC otherwise it throws > linker error: > ``` > failed with return code 1 and the following output: > /home/giuliobenetti/br_reproduce/60296a48210e7ffc6bc9fa50ee586441a8957e85/output/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/9.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld: /tmp/jiffy.so.FCaOXC.ltrans1.ltrans.o: relocation R_X86_64_PC32 against symbol `dec_destroy' can not be used when making a shared object; > recompile with -fPIC > ``` > > This is architecture indipendent, so let's add -fPIC flag to LDFLAGS in any > case. > > Fixes: > http://autobuild.buildroot.net/results/602/60296a48210e7ffc6bc9fa50ee586441a8957e85/ > > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> Thanks! However, did you review the discussion at: https://lore.kernel.org/buildroot/20201224101440.3427472-1-fontaine.fabrice@gmail.com/ Especially the feedback from Arnout around the end of the thread? Thomas -- Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/erlang-jiffy: fix build failure due to lack of -fPIC 2021-10-18 20:14 ` [Buildroot] [PATCH 1/2] " Thomas Petazzoni @ 2021-12-17 20:49 ` Thomas Petazzoni 2021-12-17 21:14 ` Giulio Benetti 2021-12-19 7:03 ` [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library Giulio Benetti 0 siblings, 2 replies; 13+ messages in thread From: Thomas Petazzoni @ 2021-12-17 20:49 UTC (permalink / raw) To: Giulio Benetti; +Cc: buildroot, Yann E. MORIN, Johan Oudinet, Will Newton On Mon, 18 Oct 2021 22:14:15 +0200 Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > Thanks! However, did you review the discussion at: > > https://lore.kernel.org/buildroot/20201224101440.3427472-1-fontaine.fabrice@gmail.com/ > > Especially the feedback from Arnout around the end of the thread? Ping? Thomas -- Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/erlang-jiffy: fix build failure due to lack of -fPIC 2021-12-17 20:49 ` Thomas Petazzoni @ 2021-12-17 21:14 ` Giulio Benetti 2021-12-19 7:03 ` [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library Giulio Benetti 1 sibling, 0 replies; 13+ messages in thread From: Giulio Benetti @ 2021-12-17 21:14 UTC (permalink / raw) To: Thomas Petazzoni; +Cc: Will Newton, Yann E. MORIN, Johan Oudinet, buildroot Hi Thomas, > Il giorno 17 dic 2021, alle ore 21:50, Thomas Petazzoni <thomas.petazzoni@bootlin.com> ha scritto: > > On Mon, 18 Oct 2021 22:14:15 +0200 > Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > >> Thanks! However, did you review the discussion at: >> >> https://lore.kernel.org/buildroot/20201224101440.3427472-1-fontaine.fabrice@gmail.com/ >> >> Especially the feedback from Arnout around the end of the thread? > > Ping? Yes and I’ve reproduced that problem caused by rebar. I’ve dealt with that three times and I couldn’t find how to emit that damn -fPIC on CFLAGS too and not only on LDFLAGS. Rebar is the problem, I totally confirm. During this weekend I will try to give the last try to fix rebar and send a local patch for it. Honestly it’s something I can’t stand to not fix it and I want to. One “not good way” to work-around the problem could be applying this patch for the moment and once I fix rebar we remove it with the rebar patch. But soon or late I want to fix it. I also have to write the l’Inter for genimage and I’ve only begun. Giulio > > Thomas > -- > Thomas Petazzoni, co-owner and CEO, Bootlin > Embedded Linux and Kernel engineering and training > https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library 2021-12-17 20:49 ` Thomas Petazzoni 2021-12-17 21:14 ` Giulio Benetti @ 2021-12-19 7:03 ` Giulio Benetti 2021-12-19 8:08 ` Yann E. MORIN 2021-12-28 21:49 ` Yann E. MORIN 1 sibling, 2 replies; 13+ messages in thread From: Giulio Benetti @ 2021-12-19 7:03 UTC (permalink / raw) To: buildroot, Thomas Petazzoni Cc: Giulio Benetti, Yann E . MORIN, Johan Oudinet, Will Newton Add patch to fix linking failure while creating shared library. As explained in the patch itself, there is no specific variable for when we link a shared library and rebar itself rely on the default LDFLAGS. Since by default every CFLAGS is filled with -fPIC we need to make sure that every LDFLAGS is the same, so not having any other *_LDFLAGS variable to fille with -fPIC let's add it to the main LDFLAGS. Fixes: http://autobuild.buildroot.net/results/602/60296a48210e7ffc6bc9fa50ee586441a8957e85/ Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> --- ...ompiler-add-fPIC-to-LDFLAGS-by-defau.patch | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch diff --git a/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch b/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch new file mode 100644 index 0000000000..a9c1670a1f --- /dev/null +++ b/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch @@ -0,0 +1,35 @@ +From 7f54d48ee5db037778ead310e0b8278f3fe70b41 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <giulio.benetti@benettiengineering.com> +Date: Sun, 19 Dec 2021 07:52:55 +0100 +Subject: [PATCH] src/rebar_port_compiler: add -fPIC to LDFLAGS by default + +Since both DRV_CFLAGS and EXE_CFLAGS list -fPIC we need also the LDFLAGS +to follow them. Unfortunately adding -fPIC only to DRV_LDFLAGS and +EXE_LDFLAGS is not sufficient, since when linking as a library(.so) it +doesn't take into account those variables. Since -fPIC is needed by default +by any kind of linking, let's add it to the general -fPIC. Rebar seems to +link libraries without taking into account any variable listed in: +src/rebar_port_compiler.erl +this after testing and tracing for every variable. + +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> +--- + src/rebar_port_compiler.erl | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl +index 9679c80..bd08b21 100644 +--- a/src/rebar_port_compiler.erl ++++ b/src/rebar_port_compiler.erl +@@ -645,6 +645,8 @@ default_env() -> + {"OBJCOPY", get_tool(Arch, "objcopy", "objcopy")}, + {"OBJDUMP", get_tool(Arch, "objdump", "objdump")}, + ++ {"LDFLAGS", "-fPIC $LDFLAGS"}, ++ + {"DRV_CXX_TEMPLATE", + "$CXX -c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, + {"DRV_CC_TEMPLATE", +-- +2.25.1 + -- 2.25.1 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library 2021-12-19 7:03 ` [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library Giulio Benetti @ 2021-12-19 8:08 ` Yann E. MORIN 2021-12-27 0:08 ` Giulio Benetti 2021-12-28 21:49 ` Yann E. MORIN 1 sibling, 1 reply; 13+ messages in thread From: Yann E. MORIN @ 2021-12-19 8:08 UTC (permalink / raw) To: Giulio Benetti; +Cc: Johan Oudinet, Will Newton, Thomas Petazzoni, buildroot Giulio, All, On 2021-12-19 08:03 +0100, Giulio Benetti spake thusly: > Add patch to fix linking failure while creating shared library. As > explained in the patch itself, there is no specific variable for when we > link a shared library and rebar itself rely on the default LDFLAGS. Since > by default every CFLAGS is filled with -fPIC we need to make sure that > every LDFLAGS is the same, so not having any other *_LDFLAGS variable to > fille with -fPIC let's add it to the main LDFLAGS. OK, I think I got the hang of it. But see below... > Fixes: > http://autobuild.buildroot.net/results/602/60296a48210e7ffc6bc9fa50ee586441a8957e85/ > > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> > --- > ...ompiler-add-fPIC-to-LDFLAGS-by-defau.patch | 35 +++++++++++++++++++ > 1 file changed, 35 insertions(+) > create mode 100644 package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch > > diff --git a/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch b/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch > new file mode 100644 > index 0000000000..a9c1670a1f > --- /dev/null > +++ b/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch > @@ -0,0 +1,35 @@ > +From 7f54d48ee5db037778ead310e0b8278f3fe70b41 Mon Sep 17 00:00:00 2001 > +From: Giulio Benetti <giulio.benetti@benettiengineering.com> > +Date: Sun, 19 Dec 2021 07:52:55 +0100 > +Subject: [PATCH] src/rebar_port_compiler: add -fPIC to LDFLAGS by default > + > +Since both DRV_CFLAGS and EXE_CFLAGS list -fPIC we need also the LDFLAGS > +to follow them. Unfortunately adding -fPIC only to DRV_LDFLAGS and > +EXE_LDFLAGS is not sufficient, since when linking as a library(.so) it > +doesn't take into account those variables. Since -fPIC is needed by default > +by any kind of linking, let's add it to the general -fPIC. Rebar seems to > +link libraries without taking into account any variable listed in: > +src/rebar_port_compiler.erl > +this after testing and tracing for every variable. > + > +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> > +--- > + src/rebar_port_compiler.erl | 2 ++ > + 1 file changed, 2 insertions(+) > + > +diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl > +index 9679c80..bd08b21 100644 > +--- a/src/rebar_port_compiler.erl > ++++ b/src/rebar_port_compiler.erl > +@@ -645,6 +645,8 @@ default_env() -> > + {"OBJCOPY", get_tool(Arch, "objcopy", "objcopy")}, > + {"OBJDUMP", get_tool(Arch, "objdump", "objdump")}, > + > ++ {"LDFLAGS", "-fPIC $LDFLAGS"}, Don't we want to match EXE_CFLAGS and DRV_CFLAGS, and use DRV_LDFLAGS and EXE_LDFLAGS instwead of the generic LDFLAGS? This way, LDFLAGS is left alone, like are CFLAGS and CXXFLAGS, and the internal variables are used. EXE_LDFLAGS and DRV_LDFLAGS are already defined, lines 665 and 667. Regards, Yann E. MORIN. > + {"DRV_CXX_TEMPLATE", > + "$CXX -c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, > + {"DRV_CC_TEMPLATE", > +-- > +2.25.1 > + > -- > 2.25.1 > -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library 2021-12-19 8:08 ` Yann E. MORIN @ 2021-12-27 0:08 ` Giulio Benetti 0 siblings, 0 replies; 13+ messages in thread From: Giulio Benetti @ 2021-12-27 0:08 UTC (permalink / raw) To: Yann E. MORIN; +Cc: Thomas Petazzoni, Will Newton, Johan Oudinet, buildroot Hi Yann, All, On 19/12/21 09:08, Yann E. MORIN wrote: I've missed this e-mail :-/ ... > Giulio, All, > > On 2021-12-19 08:03 +0100, Giulio Benetti spake thusly: >> Add patch to fix linking failure while creating shared library. As >> explained in the patch itself, there is no specific variable for when we >> link a shared library and rebar itself rely on the default LDFLAGS. Since >> by default every CFLAGS is filled with -fPIC we need to make sure that >> every LDFLAGS is the same, so not having any other *_LDFLAGS variable to >> fille with -fPIC let's add it to the main LDFLAGS. > > OK, I think I got the hang of it. But see below... > >> Fixes: >> http://autobuild.buildroot.net/results/602/60296a48210e7ffc6bc9fa50ee586441a8957e85/ >> >> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> >> --- >> ...ompiler-add-fPIC-to-LDFLAGS-by-defau.patch | 35 +++++++++++++++++++ >> 1 file changed, 35 insertions(+) >> create mode 100644 package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch >> >> diff --git a/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch b/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch >> new file mode 100644 >> index 0000000000..a9c1670a1f >> --- /dev/null >> +++ b/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch >> @@ -0,0 +1,35 @@ >> +From 7f54d48ee5db037778ead310e0b8278f3fe70b41 Mon Sep 17 00:00:00 2001 >> +From: Giulio Benetti <giulio.benetti@benettiengineering.com> >> +Date: Sun, 19 Dec 2021 07:52:55 +0100 >> +Subject: [PATCH] src/rebar_port_compiler: add -fPIC to LDFLAGS by default >> + >> +Since both DRV_CFLAGS and EXE_CFLAGS list -fPIC we need also the LDFLAGS >> +to follow them. Unfortunately adding -fPIC only to DRV_LDFLAGS and >> +EXE_LDFLAGS is not sufficient, since when linking as a library(.so) it >> +doesn't take into account those variables. Since -fPIC is needed by default >> +by any kind of linking, let's add it to the general -fPIC. Rebar seems to >> +link libraries without taking into account any variable listed in: >> +src/rebar_port_compiler.erl >> +this after testing and tracing for every variable. >> + >> +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> >> +--- >> + src/rebar_port_compiler.erl | 2 ++ >> + 1 file changed, 2 insertions(+) >> + >> +diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl >> +index 9679c80..bd08b21 100644 >> +--- a/src/rebar_port_compiler.erl >> ++++ b/src/rebar_port_compiler.erl >> +@@ -645,6 +645,8 @@ default_env() -> >> + {"OBJCOPY", get_tool(Arch, "objcopy", "objcopy")}, >> + {"OBJDUMP", get_tool(Arch, "objdump", "objdump")}, >> + >> ++ {"LDFLAGS", "-fPIC $LDFLAGS"}, > > Don't we want to match EXE_CFLAGS and DRV_CFLAGS, and use DRV_LDFLAGS > and EXE_LDFLAGS instwead of the generic LDFLAGS? This way, LDFLAGS is > left alone, like are CFLAGS and CXXFLAGS, and the internal variables > are used. > > EXE_LDFLAGS and DRV_LDFLAGS are already defined, lines 665 and 667. ...here the problem I've noticed is that nor EXE_LDFLAGS and neither DRV_LDFLAGS are used when linking a shared library. They are only used for the executables. I've tried in all the ways, and the solution seemed trivial like you point, but in the end the only way I've found for shared libraries to be linked with -fPIC is adding it to LDFLAGS. So basically there had to be a specific LIB_LDFLAGS(for example) dedicated to it, but rebar is archived in favor of rebar3 and I see this as the easiest solution. Kind regards -- Giulio Benetti Benetti Engineering sas > Regards, > Yann E. MORIN. > >> + {"DRV_CXX_TEMPLATE", >> + "$CXX -c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, >> + {"DRV_CC_TEMPLATE", >> +-- >> +2.25.1 >> + >> -- >> 2.25.1 >> > _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library 2021-12-19 7:03 ` [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library Giulio Benetti 2021-12-19 8:08 ` Yann E. MORIN @ 2021-12-28 21:49 ` Yann E. MORIN 1 sibling, 0 replies; 13+ messages in thread From: Yann E. MORIN @ 2021-12-28 21:49 UTC (permalink / raw) To: Giulio Benetti; +Cc: Will Newton, Johan Oudinet, Thomas Petazzoni, buildroot Giulio, All, On 2021-12-19 08:03 +0100, Giulio Benetti spake thusly: > Add patch to fix linking failure while creating shared library. As > explained in the patch itself, there is no specific variable for when we > link a shared library and rebar itself rely on the default LDFLAGS. Since > by default every CFLAGS is filled with -fPIC we need to make sure that > every LDFLAGS is the same, so not having any other *_LDFLAGS variable to > fille with -fPIC let's add it to the main LDFLAGS. > > Fixes: > http://autobuild.buildroot.net/results/602/60296a48210e7ffc6bc9fa50ee586441a8957e85/ > > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> Even though I was not very happy with that solution, there is really no better way, so: applied to master, thanks. Regards, Yann E. MORIN. > --- > ...ompiler-add-fPIC-to-LDFLAGS-by-defau.patch | 35 +++++++++++++++++++ > 1 file changed, 35 insertions(+) > create mode 100644 package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch > > diff --git a/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch b/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch > new file mode 100644 > index 0000000000..a9c1670a1f > --- /dev/null > +++ b/package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch > @@ -0,0 +1,35 @@ > +From 7f54d48ee5db037778ead310e0b8278f3fe70b41 Mon Sep 17 00:00:00 2001 > +From: Giulio Benetti <giulio.benetti@benettiengineering.com> > +Date: Sun, 19 Dec 2021 07:52:55 +0100 > +Subject: [PATCH] src/rebar_port_compiler: add -fPIC to LDFLAGS by default > + > +Since both DRV_CFLAGS and EXE_CFLAGS list -fPIC we need also the LDFLAGS > +to follow them. Unfortunately adding -fPIC only to DRV_LDFLAGS and > +EXE_LDFLAGS is not sufficient, since when linking as a library(.so) it > +doesn't take into account those variables. Since -fPIC is needed by default > +by any kind of linking, let's add it to the general -fPIC. Rebar seems to > +link libraries without taking into account any variable listed in: > +src/rebar_port_compiler.erl > +this after testing and tracing for every variable. > + > +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> > +--- > + src/rebar_port_compiler.erl | 2 ++ > + 1 file changed, 2 insertions(+) > + > +diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl > +index 9679c80..bd08b21 100644 > +--- a/src/rebar_port_compiler.erl > ++++ b/src/rebar_port_compiler.erl > +@@ -645,6 +645,8 @@ default_env() -> > + {"OBJCOPY", get_tool(Arch, "objcopy", "objcopy")}, > + {"OBJDUMP", get_tool(Arch, "objdump", "objdump")}, > + > ++ {"LDFLAGS", "-fPIC $LDFLAGS"}, > ++ > + {"DRV_CXX_TEMPLATE", > + "$CXX -c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, > + {"DRV_CC_TEMPLATE", > +-- > +2.25.1 > + > -- > 2.25.1 > > _______________________________________________ > buildroot mailing list > buildroot@buildroot.org > https://lists.buildroot.org/mailman/listinfo/buildroot -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2021-12-28 22:06 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-10-14 21:54 [Buildroot] [PATCH 1/2] package/erlang-jiffy: fix build failure due to lack of -fPIC Giulio Benetti 2021-10-14 21:54 ` [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9 Giulio Benetti 2021-12-20 9:34 ` Giulio Benetti 2021-12-28 22:06 ` Thomas Petazzoni 2021-10-14 21:54 ` [Buildroot] [PATCH 2/2] package/erlang-jiffy: fix build failure due to lack of -fPIC Giulio Benetti 2021-10-14 21:57 ` Giulio Benetti 2021-10-18 20:14 ` [Buildroot] [PATCH 1/2] " Thomas Petazzoni 2021-12-17 20:49 ` Thomas Petazzoni 2021-12-17 21:14 ` Giulio Benetti 2021-12-19 7:03 ` [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library Giulio Benetti 2021-12-19 8:08 ` Yann E. MORIN 2021-12-27 0:08 ` Giulio Benetti 2021-12-28 21:49 ` Yann E. MORIN
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.