package/erlang-jiffy: fix build failure due to lack of -fPIC
PATCH 1/2 package/erlang-jiffy: fix build failure due to lack of -fPIC
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/
--- package/erlang-jiffy/erlang-jiffy.mk | 3 +++ 1 file changed, 3 insertions(+)
package/erlang-jiffy/erlang-jiffy.mk +3 -0
@@ -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))
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/erlang-jiffy: bump version to 1.0.9
Bump version to 1.0.9
--- package/erlang-jiffy/erlang-jiffy.hash | 2 +- package/erlang-jiffy/erlang-jiffy.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
package/erlang-jiffy/erlang-jiffy.hash +1 -1
@@ -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
package/erlang-jiffy/erlang-jiffy.mk +1 -1
@@ -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), \
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9
Kindly ping
Quoted 31 lines · Giulio Benetti
Bump version to 1.0.9
Signed-off-by Giulio Benetti <[email protected]>--- package/erlang-jiffy/erlang-jiffy.hash | 2 +- package/erlang-jiffy/erlang-jiffy.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)package/erlang-jiffy/erlang-jiffy.hash +1
-1@@ -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 LICENSEpackage/erlang-jiffy/erlang-jiffy.mk +1
-1@@ -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), \
Signature · 6 lines
Giulio Benetti Benetti Engineering sas _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni
AppliedRe: [Buildroot] [PATCH 2/2] package/erlang-jiffy: bump version to 1.0.9
In reply to Giulio BenettiQuoted 7 lines · On Thu, 14 Oct 2021 23:54:54 +0200 Giulio Benetti…
Bump version to 1.0.9
Signed-off-by Giulio Benetti <[email protected]>--- 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
Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/erlang-jiffy: fix build failure due to lack of -fPIC
In reply to Giulio BenettiPackage 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/
--- package/erlang-jiffy/erlang-jiffy.mk | 3 +++ 1 file changed, 3 insertions(+)
package/erlang-jiffy/erlang-jiffy.mk +3 -0
@@ -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))
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
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
Signature · 2 lines
Giulio Benetti Benetti Engineering sas
Quoted 25 lines · Giulio Benetti
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 <[email protected]>--- package/erlang-jiffy/erlang-jiffy.mk | 3 +++ 1 file changed, 3 insertions(+)package/erlang-jiffy/erlang-jiffy.mk +0
-0
package/erlang-jiffy/erlang-jiffy.mk ERLANG_JIFFY_LICENSE = MIT (core), \ · line 17
Quoted 7 lines
package/erlang-jiffy/erlang-jiffy.mk +3
-0@@ -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
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Giulio,
Quoted 8 lines · On Thu, 14 Oct 2021 23:54:53 +0200 Giulio Benetti…
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 ```
Quoted 7 lines
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 <[email protected]>
Thanks! However, did you review the discussion at:
https://lore.kernel.org/buildroot/[email protected]/
Especially the feedback from Arnout around the end of the thread?
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 5 lines · On Mon, 18 Oct 2021 22:14:15 +0200 Thomas Petazzoni…
Thanks! However, did you review the discussion at:
https://lore.kernel.org/buildroot/[email protected]/
Especially the feedback from Arnout around the end of the thread?
Ping?
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Thomas,
Quoted 5 lines
Il giorno 17 dic 2021, alle ore 21:50, Thomas Petazzoni <[email protected]> ha scritto:
On Mon, 18 Oct 2021 22:14:15 +0200
Thomas Petazzoni <[email protected]> wrote:
Quoted 7 lines
Quoted 5 lines
Thanks! However, did you review the discussion at:
https://lore.kernel.org/buildroot/[email protected]/
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
Quoted 6 lines
Thomas
Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/1 package/erlang-rebar: fix linking failure on shared library
In reply to Thomas PetazzoniAdd 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/
--- ...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
package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 7f54d48ee5db037778ead310e0b8278f3fe70b41 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +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 <[email protected]> +--- + 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 +
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library
Giulio, All,
On 2021-12-19 08:03 +0100, Giulio Benetti spake thusly:
Quoted 6 lines
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
*_LDFLAGSvariable to fille with -fPIC let's add it to the main LDFLAGS.
OK, I think I got the hang of it. But see below...
Quoted 33 lines
Fixes:
http://autobuild.buildroot.net/results/602/60296a48210e7ffc6bc9fa50ee586441a8957e85/Signed-off-by Giulio Benetti <[email protected]>--- ...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.patchpackage/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch new file +18
-0@@ -0,0 +1,35 @@ +From 7f54d48ee5db037778ead310e0b8278f3fe70b41 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +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 <[email protected]> +--- + src/rebar_port_compiler.erl | 2 ++ + 1 file changed, 2 insertions(+)
package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch line 28
Quoted 10 lines
package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch new file +10
-0+ +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.
Quoted 9 lines
package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch new file +6
-0+ {"DRV_CXX_TEMPLATE", + "$CXX -c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, + {"DRV_CC_TEMPLATE", +-- +2.25.1 +Signature · 1 line
2.25.1
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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 [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library
Hi Yann, All,
On 19/12/21 09:08, Yann E. MORIN wrote:
I've missed this e-mail :-/ ...
Quoted 61 lines
Giulio, All,
On 2021-12-19 08:03 +0100, Giulio Benetti spake thusly:
Quoted 6 lines
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
*_LDFLAGSvariable to fille with -fPIC let's add it to the main LDFLAGS.OK, I think I got the hang of it. But see below...
Quoted 33 lines
Fixes:
http://autobuild.buildroot.net/results/602/60296a48210e7ffc6bc9fa50ee586441a8957e85/Signed-off-by Giulio Benetti <[email protected]>--- ...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.patchpackage/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch new file +18
-0@@ -0,0 +1,35 @@ +From 7f54d48ee5db037778ead310e0b8278f3fe70b41 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +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 <[email protected]> +--- + src/rebar_port_compiler.erl | 2 ++ + 1 file changed, 2 insertions(+)package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch line 28
Quoted 10 lines
package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch new file +10
-0+ +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_CFLAGSandDRV_CFLAGS, and useDRV_LDFLAGSandEXE_LDFLAGSinstwead of the generic LDFLAGS? This way, LDFLAGS is left alone, like are CFLAGS and CXXFLAGS, and the internal variables are used.
Quoted 1 line
EXE_LDFLAGSandDRV_LDFLAGSare 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
Signature · 2 lines
Giulio Benetti Benetti Engineering sas
Quoted 13 lines
Regards,
Yann E. MORIN.Quoted 9 lines
package/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch new file +6
-0+ {"DRV_CXX_TEMPLATE", + "$CXX -c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, + {"DRV_CC_TEMPLATE", +-- +2.25.1 +Signature · 1 line
2.25.1
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH] package/erlang-rebar: fix linking failure on shared library
In reply to Giulio BenettiGiulio, All,
On 2021-12-19 08:03 +0100, Giulio Benetti spake thusly:
Quoted 11 lines
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
*_LDFLAGSvariable 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 <[email protected]>
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.
Quoted 53 lines
--- ...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.patchpackage/erlang-rebar/0001-src-rebar_port_compiler-add-fPIC-to-LDFLAGS-by-defau.patch new file +35
-0@@ -0,0 +1,35 @@ +From 7f54d48ee5db037778ead310e0b8278f3fe70b41 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +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 <[email protected]> +--- + 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 +Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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 [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot