diff mbox series

[oe,meta-oe,5/8] luajit: Dont use BUILD_LDFLAGS when compiling host binaries

Message ID 20180512030758.31409-5-raj.khem@gmail.com
State Accepted
Commit ebe6c9570c16defaa68628e57b537ce426ec09ec
Headers show
Series [oe,meta-networking,1/8] netkit-rusers: Fix build when libc does not have nis builtin | expand

Commit Message

Khem Raj May 12, 2018, 3:07 a.m. UTC
BUILD_LDFLAGS add --dynamic-linker to point to uninative but
some binaries in luajit are for 32bit build host, so even if
your host has the needed runtime, it will fail to execute because
uninative ldso doesn't know about multilib

we get cyptic errors like

| make[1]: execvp: host/minilua: Accessing a corrupted shared library
| make[1]: *** [Makefile:610: host/buildvm_arch.h] Error 127

Switch to using git for SRC_URI, master is pointing to latest
2.0 stable, it gets us all the patches done since last 2.0.5 relases
in 2017

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 meta-oe/recipes-devtools/luajit/luajit_2.0.5.bb | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

-- 
2.17.0

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

Comments

Carlos Alberto Lopez Perez May 18, 2018, 4:38 a.m. UTC | #1
On 12/05/18 05:07, Khem Raj wrote:
> BUILD_LDFLAGS add --dynamic-linker to point to uninative but

> some binaries in luajit are for 32bit build host, so even if

> your host has the needed runtime, it will fail to execute because

> uninative ldso doesn't know about multilib

> 

> we get cyptic errors like

> 

> | make[1]: execvp: host/minilua: Accessing a corrupted shared library

> | make[1]: *** [Makefile:610: host/buildvm_arch.h] Error 127

> 

> Switch to using git for SRC_URI, master is pointing to latest

> 2.0 stable, it gets us all the patches done since last 2.0.5 relases

> in 2017

> 

> Signed-off-by: Khem Raj <raj.khem@gmail.com>

> ---

>  meta-oe/recipes-devtools/luajit/luajit_2.0.5.bb | 9 ++++-----

>  1 file changed, 4 insertions(+), 5 deletions(-)

> 


I think HOST_LDFLAGS should remain for the native class.

Otherwise building luajit-native might fail.

I suggest adding something like this:

EXTRA_OEMAKE_remove_class-target = "'HOST_LDFLAGS=${BUILD_LDFLAGS}'"
-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Khem Raj May 18, 2018, 4:44 a.m. UTC | #2
Hi Carlos

Thanks for your review

On 5/17/18 9:38 PM, Carlos Alberto Lopez Perez wrote:
> On 12/05/18 05:07, Khem Raj wrote:

>> BUILD_LDFLAGS add --dynamic-linker to point to uninative but

>> some binaries in luajit are for 32bit build host, so even if

>> your host has the needed runtime, it will fail to execute because

>> uninative ldso doesn't know about multilib

>>

>> we get cyptic errors like

>>

>> | make[1]: execvp: host/minilua: Accessing a corrupted shared library

>> | make[1]: *** [Makefile:610: host/buildvm_arch.h] Error 127

>>

>> Switch to using git for SRC_URI, master is pointing to latest

>> 2.0 stable, it gets us all the patches done since last 2.0.5 relases

>> in 2017

>>

>> Signed-off-by: Khem Raj <raj.khem@gmail.com>

>> ---

>>   meta-oe/recipes-devtools/luajit/luajit_2.0.5.bb | 9 ++++-----

>>   1 file changed, 4 insertions(+), 5 deletions(-)

>>

> 

> I think HOST_LDFLAGS should remain for the native class.

> 

> Otherwise building luajit-native might fail.

> 

> I suggest adding something like this:

> 

> EXTRA_OEMAKE_remove_class-target = "'HOST_LDFLAGS=${BUILD_LDFLAGS}'"

> 


This would be a general case where we have bbclassextend for native
luajit is a special case however, where the needed build time tools
are built along the target build, thats why this fix.  The change you
you proposed might not work in this case.
-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Carlos Alberto Lopez Perez May 18, 2018, 1:27 p.m. UTC | #3
On 18/05/18 06:44, Khem Raj wrote:
>> I suggest adding something like this:

>>

>> EXTRA_OEMAKE_remove_class-target = "'HOST_LDFLAGS=${BUILD_LDFLAGS}'"

>>

> 

> This would be a general case where we have bbclassextend for native

> luajit is a special case however, where the needed build time tools

> are built along the target build, thats why this fix.  The change you

> you proposed might not work in this case.


I'm carrying this change here [1]:

First I tried setting the removal without specifying a target, like in

EXTRA_OEMAKE_remove = "'HOST_LDFLAGS=${BUILD_LDFLAGS}'"

But then doing:

bitbake -f -c cleanall luajit-native
bitbake luajit-native

Will fail.

Specifying the removal only for the target class is what allowed this to
work for both luajit and luajit-native
(just in case is relevant, my target machine is a raspberrypi3 (32-bit))


Regards
-------

[1]
https://github.com/Igalia/meta-webkit/blob/master/recipes-devtools/luajit/luajit_2.0.5.bbappend
-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Andre McCurdy May 18, 2018, 6:46 p.m. UTC | #4
On Fri, May 18, 2018 at 6:27 AM, Carlos Alberto Lopez Perez
<clopez@igalia.com> wrote:
> On 18/05/18 06:44, Khem Raj wrote:

>>> I suggest adding something like this:

>>>

>>> EXTRA_OEMAKE_remove_class-target = "'HOST_LDFLAGS=${BUILD_LDFLAGS}'"

>>>


This idea looks right, but be aware that ${BUILD_LDFLAGS} will be
expanded before being processed by _remove. Therefore any individual
string within ${BUILD_LDFLAGS} will be removed from the final value of
EXTRA_OEMAKE, even if it occurs somewhere other than in the value of
HOST_LDFLAGS. For example:

  BUILD_CFLAGS = "one two three"
  BUILD_LDFLAGS = "one two three"

  FOO = " \
    'HOST_CFLAGS=${BUILD_CFLAGS}' \
    'HOST_LDFLAGS=${BUILD_LDFLAGS}' \
  "

  FOO_remove_class-target = "'HOST_LDFLAGS=${BUILD_LDFLAGS}'"

  $ bitbake recipe -e | grep ^FOO=

  FOO="'HOST_CFLAGS=one three'"

Notice how "two" has been removed from the final value of HOST_CFLAGS
set within FOO.

In this case, if you want to have a HOST_LDFLAGS='...' only for native
builds, it's better to use _append_class-native as required.

In general, it's usually a bug (or at least bad form) to use _remove
in a recipe. It's usually reserved for custom changes in a .bbappend
etc.
-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Carlos Alberto Lopez Perez May 20, 2018, 7:02 p.m. UTC | #5
On 18/05/18 20:46, Andre McCurdy wrote:
> On Fri, May 18, 2018 at 6:27 AM, Carlos Alberto Lopez Perez

> <clopez@igalia.com> wrote:

>> On 18/05/18 06:44, Khem Raj wrote:

>>>> I suggest adding something like this:

>>>>

>>>> EXTRA_OEMAKE_remove_class-target = "'HOST_LDFLAGS=${BUILD_LDFLAGS}'"

>>>>

> 

> This idea looks right, but be aware that ${BUILD_LDFLAGS} will be

> expanded before being processed by _remove. Therefore any individual

> string within ${BUILD_LDFLAGS} will be removed from the final value of

> EXTRA_OEMAKE, even if it occurs somewhere other than in the value of

> HOST_LDFLAGS. For example:

> 

>   BUILD_CFLAGS = "one two three"

>   BUILD_LDFLAGS = "one two three"

> 

>   FOO = " \

>     'HOST_CFLAGS=${BUILD_CFLAGS}' \

>     'HOST_LDFLAGS=${BUILD_LDFLAGS}' \

>   "

> 

>   FOO_remove_class-target = "'HOST_LDFLAGS=${BUILD_LDFLAGS}'"

> 

>   $ bitbake recipe -e | grep ^FOO=

> 

>   FOO="'HOST_CFLAGS=one three'"

> 

> Notice how "two" has been removed from the final value of HOST_CFLAGS

> set within FOO.

> 


Interesting.. didn't knew this.

Is there any way to tell _remove to only remove a string if it matches
as a whole instead of removing the individual words separated by spaces?
I tried escaping the quotes but didn't worked :?


> In this case, if you want to have a HOST_LDFLAGS='...' only for native

> builds, it's better to use _append_class-native as required.

> 

> In general, it's usually a bug (or at least bad form) to use _remove

> in a recipe. It's usually reserved for custom changes in a .bbappend

> etc.

> 


Indeed. And it seems this is what caused the issue with the native class
for me.

Just removing the 'HOST_LDFLAGS=${BUILD_LDFLAGS}' entry directly in the
luajit recipe (without a bbappend) like the original patch from Khem Raj
proposed works fine.

I just checked that doing that way I can't reproduce the breakage of the
native class. So please commit this original patch from Khem Raj.
It is the right fix.

Thanks
-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Andre McCurdy May 21, 2018, 10:33 p.m. UTC | #6
On Sun, May 20, 2018 at 12:02 PM, Carlos Alberto Lopez Perez
<clopez@igalia.com> wrote:
> On 18/05/18 20:46, Andre McCurdy wrote:

>> On Fri, May 18, 2018 at 6:27 AM, Carlos Alberto Lopez Perez

>> <clopez@igalia.com> wrote:

>>> On 18/05/18 06:44, Khem Raj wrote:

>>>>> I suggest adding something like this:

>>>>>

>>>>> EXTRA_OEMAKE_remove_class-target = "'HOST_LDFLAGS=${BUILD_LDFLAGS}'"

>>

>> This idea looks right, but be aware that ${BUILD_LDFLAGS} will be

>> expanded before being processed by _remove. Therefore any individual

>> string within ${BUILD_LDFLAGS} will be removed from the final value of

>> EXTRA_OEMAKE, even if it occurs somewhere other than in the value of

>> HOST_LDFLAGS. For example:

>>

>>   BUILD_CFLAGS = "one two three"

>>   BUILD_LDFLAGS = "one two three"

>>

>>   FOO = " \

>>     'HOST_CFLAGS=${BUILD_CFLAGS}' \

>>     'HOST_LDFLAGS=${BUILD_LDFLAGS}' \

>>   "

>>

>>   FOO_remove_class-target = "'HOST_LDFLAGS=${BUILD_LDFLAGS}'"

>>

>>   $ bitbake recipe -e | grep ^FOO=

>>

>>   FOO="'HOST_CFLAGS=one three'"

>>

>> Notice how "two" has been removed from the final value of HOST_CFLAGS

>> set within FOO.

>

> Interesting.. didn't knew this.

>

> Is there any way to tell _remove to only remove a string if it matches

> as a whole instead of removing the individual words separated by spaces?

> I tried escaping the quotes but didn't worked :?


I don't think there's a way to do that.
-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/luajit/luajit_2.0.5.bb b/meta-oe/recipes-devtools/luajit/luajit_2.0.5.bb
index 1d69b3c12c..3052eb0484 100644
--- a/meta-oe/recipes-devtools/luajit/luajit_2.0.5.bb
+++ b/meta-oe/recipes-devtools/luajit/luajit_2.0.5.bb
@@ -3,14 +3,14 @@  LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=10a96c93403affcc34765f4c2612bc22"
 HOMEPAGE = "http://luajit.org"
 
-SRC_URI = "http://luajit.org/download/LuaJIT-${PV}.tar.gz \
+PV .= "+git${SRCPV}"
+SRCREV = "02b521981a1ab919ff2cd4d9bcaee80baf77dce2"
+SRC_URI = "git://luajit.org/git/luajit-2.0.git;protocol=http \
            file://0001-Do-not-strip-automatically-this-leaves-the-stripping.patch \
            file://clang.patch \
 "
-SRC_URI[md5sum] = "48353202cbcacab84ee41a5a70ea0a2c"
-SRC_URI[sha256sum] = "874b1f8297c697821f561f9b73b57ffd419ed8f4278c82e05b48806d30c1e979"
 
-S = "${WORKDIR}/LuaJIT-${PV}"
+S = "${WORKDIR}/git"
 
 inherit pkgconfig binconfig siteinfo
 
@@ -49,7 +49,6 @@  EXTRA_OEMAKE = "\
     'TARGET_SHLDFLAGS=${LDFLAGS}' \
     'HOST_CC=${BUILD_CC}' \
     'HOST_CFLAGS=${BUILD_CFLAGS}' \
-    'HOST_LDFLAGS=${BUILD_LDFLAGS}' \
     \
     'PREFIX=${prefix}' \
     'MULTILIB=${baselib}' \