<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15032</bug_id>
          
          <creation_ts>2023-02-10 09:59:08 +0000</creation_ts>
          <short_desc>Failed to build libusb-compat-native with bitbake in crops/poky:ubuntu-18.04 container</short_desc>
          <delta_ts>2023-03-28 22:29:21 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>oe-core other</component>
          <version>4.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86_64</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.3 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Abderrahim BENAOUDA">abderrahim.benaouda</reporter>
          <assigned_to name="Yoann Congal">yoann.congal</assigned_to>
          <cc>paul</cc>
    
    <cc>pidge</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
    
    <cc>TicoTimo</cc>
    
    <cc>tim.orling</cc>
    
    <cc>yoann.congal</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94921</commentid>
    <comment_count>0</comment_count>
    <who name="Abderrahim BENAOUDA">abderrahim.benaouda</who>
    <bug_when>2023-02-10 09:59:08 +0000</bug_when>
    <thetext>Reproducing the Bug:
In crops/poky:ubuntu-18.04 container add meta-oe layer (found in meta-openembedded master branch), build libusb-compat-native package with bitbake

below is the build log:

NOTE: Executing Tasks
ERROR: libusb-compat-native-1_0.1.7-r0 do_compile: oe_runmake failed
ERROR: libusb-compat-native-1_0.1.7-r0 do_compile: ExecutionError(&apos;/workdir/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/temp/run.do_compile.175&apos;, 1, None, None)
ERROR: Logfile of failure stored in: /workdir/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/temp/log.do_compile.175
Log data follows:
| DEBUG: Executing python function autotools_aclocals
| DEBUG: SITE files [&apos;endian-little&apos;, &apos;common-linux&apos;, &apos;common-glibc&apos;, &apos;bit-64&apos;, &apos;x86_64-linux&apos;, &apos;common&apos;]
| DEBUG: Python function autotools_aclocals finished
| DEBUG: Executing shell function do_compile
| NOTE: make -j 8
| Makefile:282: *** missing separator.  Stop.
| ERROR: oe_runmake failed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94922</commentid>
    <comment_count>1</comment_count>
      <attachid>4930</attachid>
    <who name="Abderrahim BENAOUDA">abderrahim.benaouda</who>
    <bug_when>2023-02-10 10:52:43 +0000</bug_when>
    <thetext>Created attachment 4930
logfile of failure</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94923</commentid>
    <comment_count>2</comment_count>
    <who name="Abderrahim BENAOUDA">abderrahim.benaouda</who>
    <bug_when>2023-02-10 11:41:02 +0000</bug_when>
    <thetext>The generated Makefile by autotools is not correctly formatted. See lines 281 the &quot;./confest:\n&quot; should not be there.

280 LIBUSB_1_0_LIBS = -L/workdir/build/tmp/work/x86_64-linux/libusb-compat-nativ    e/1_0.1.7-r0/recipe-sysroot-native/usr/lib/pkgconfig/../../../usr/lib -lusb-    1.0
281 LIBUSB_1_0_SONAME = ./conftest:
282 libusb-1.0.so.0
283 LIPO =

The package libusb-compat-native builds successfully in the base container crops/yocto:ubuntu-18.04-base, with a correct Makefile:

280 LIBUSB_1_0_LIBS = -L/workdir/build/tmp/work/x86_64-linux/libusb-compat-nativ    e/1_0.1.7-r0/recipe-sysroot-native/usr/lib/pkgconfig/../../../usr/lib -lusb-    1.0
281 LIBUSB_1_0_SONAME = libusb-1.0.so.0
282 LIPO =

Also builds successfully on crops/poky:debian-10 container 

280 LIBUSB_1_0_LIBS = -L/workdir/build/tmp/work/x86_64-linux/libusb-compat-nativ    e/1_0.1.7-r0/recipe-sysroot-native/usr/lib/pkgconfig/../../../usr/lib -lusb-    1.0
281 LIBUSB_1_0_SONAME = 
282 LIPO =</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94938</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2023-02-16 15:34:01 +0000</bug_when>
    <thetext>&quot;./conftest:&quot; looks like the configure test is failing but the Makefile (or configure script) isn&apos;t catching the failure.  Reading the config.log would be interesting to see if that has any failures.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94939</commentid>
    <comment_count>4</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-02-16 15:35:21 +0000</bug_when>
    <thetext>Note: libusb-compat v0.1.8 released on Nov 18, 2022 : https://github.com/libusb/libusb-compat-0.1/releases/tag/v0.1.8

Maybe try to upgrade?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94968</commentid>
    <comment_count>5</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-02-18 16:00:12 +0000</bug_when>
    <thetext>&gt; Maybe try to upgrade [to v0.1.8] ?

Note: upgrading to v0.1.8 does not solve this problem.

&gt; &quot;./conftest:&quot; looks like the configure test is failing but the Makefile (or configure script) isn&apos;t catching the failure.  Reading the config.log would be interesting to see if that has any failures.

log.do_configure :
checking for SONAME of libusb-1.0... ./conftest:
libusb-1.0.so.0
checking for GNU extensions of errno.h... no
configure: WARNING: cache variable au_cv_lib_soname_LIBUSB_1_0 contains a newline


config.log:
configure:12984: checking for SONAME of libusb-1.0
configure:13016: gcc  -o conftest -isystem...poky/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/recipe-sysroot-native/usr/include -O2 -pipe -isystem...poky/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/recipe-sysroot-native/usr/include -L...poky/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/recipe-sysroot-native/usr/lib                         -L...poky/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,...poky/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,...poky/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/recipe-sysroot-native/lib                         -Wl,-rpath,...poky/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/recipe-sysroot-native/usr/lib                         -Wl,-rpath,...poky/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/recipe-sysroot-native/lib                         -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=...poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 conftest.c   -lusb-1.0 &gt;&amp;5
configure:13016: $? = 0
configure:13044: result: ./conftest:
libusb-1.0.so.0

After that the other conftest build fail because of the ill-formed #define LIBUSB_1_0_SONAME</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94974</commentid>
    <comment_count>6</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-02-19 17:25:20 +0000</bug_when>
    <thetext>libusb-compat tries to compute the libusb SO name by compiling a linking against is and then parsing the output of ldd on the resulting binary.

See https://github.com/libusb/libusb-compat-0.1/blob/v0.1.7/m4/au_check_lib_soname.m4#L29.

The suspicious line is :
  ldd conftest$ac_exeext | grep &apos;lib[$2]&apos;$shrext_regexp | sed &apos;s/^@&lt;:@ \t@:&gt;@*lib[$2]&apos;$shrext_regexp&apos;/lib[$2]&apos;$shrext_regexp&apos;/;s/@&lt;:@ \t@:&gt;@.*$//&apos;

Here&apos;s the output of ldd on an impacted system :
1 ./conftest: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34&apos; not found (required by ./conftest)
2 ./conftest: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34&apos; not found (required by .../poky/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/recipe-sysroot-native/usr/lib/libusb-1.0.so.0)
3 linux-vdso.so.1 (0x00007ffdd2bb6000)
4 libusb-1.0.so.0 =&gt; .../poky/build/tmp/work/x86_64-linux/libusb-compat-native/1_0.1.7-r0/recipe-sysroot-native/usr/lib/libusb-1.0.so.0 (0x00007fcd4b799000)
5 libc.so.6 =&gt; /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcd4b1a4000)
6 libpthread.so.0 =&gt; /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fcd4af85000)
7 .../poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 =&gt; /lib64/ld-linux-x86-64.so.2 (0x00007fcd4b595000)

The code clearly look for the 4th line but the 2nd is also caught by the grep/sed regexp.

So, there are 2 problems:
1. ldd can&apos;t find test binary&apos;s glibc. I don&apos;t know if it&apos;s really a problem or not since this binary is never run.
2. The grep/sed regexp does not handle the problem 1 =&gt; This part can be fixed by patching the sources.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94975</commentid>
    <comment_count>7</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-02-20 08:41:01 +0000</bug_when>
    <thetext>Note: Related fix by our Buildroot friends :
https://git.buildroot.net/buildroot/commit/package/libusb-compat/libusb-compat.mk?id=3a9261ddd917007e19b56b4bfe48ccc0861dd716

They force LIBUSB_1_0_SONAME to prevent the &quot;broken&quot; libusb-compat SONAME detection from running...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94976</commentid>
    <comment_count>8</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2023-02-20 13:05:22 +0000</bug_when>
    <thetext>The loader thing is odd, but the readelf workaround in buildroot would likely work for us (and arguably could be upstreamed as a better solution than running ldd).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94977</commentid>
    <comment_count>9</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-02-20 14:05:20 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; The loader thing is odd, but the readelf workaround in buildroot would
&gt; likely work for us (and arguably could be upstreamed as a better solution
&gt; than running ldd).

I arrived at the same conclusion. Thank you for the confirmation!

Instead of readelf, I&apos;ve planned to use objdump (but the idea is the same)

I have a working patch, I just need to clean it up to push it to libusb and (I guess) to the recipe.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95019</commentid>
    <comment_count>10</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-02-27 07:50:18 +0000</bug_when>
    <thetext>libusb-compat used involuntarly host libs to compute libusb1 soname. Where host libc is recent enough, the computation works but if the libc is old, the computation fails. Using buildtools kinda hide this because the buildtools libc is recent enough.

Since https://git.yoctoproject.org/poky/commit/bitbake?id=7d67b6356033b5ffeb37d13bf748632ce917289b we need the buildtools to build on old distros so this bug may be hard to catch on master.

It does clearly appears when build libusb-compat-native on crops/poky:ubuntu-18.04 without installing the buildtools.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95029</commentid>
    <comment_count>11</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-02-28 21:14:25 +0000</bug_when>
    <thetext>Changing the Product to OE-Core : This is a problem of the libusb-compat recipe in oe-core and not linked to CROPS.
Resetting the ticket to NEW state to get triage team to check if that&apos;s OK.
 
Meanwhile, fix for this bug is in this PR : https://github.com/openembedded/meta-openembedded/pull/660</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95203</commentid>
    <comment_count>12</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-03-28 22:29:21 +0000</bug_when>
    <thetext>Fixed in http://git.openembedded.org/meta-openembedded/commit/?id=933885520a5d8ace0c0f59d2b5188d9c5b236d10</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4930</attachid>
            <date>2023-02-10 10:52:43 +0000</date>
            <delta_ts>2023-02-10 10:52:43 +0000</delta_ts>
            <desc>logfile of failure</desc>
            <filename>log.do_compile.175</filename>
            <type>application/octet-stream</type>
            <size>1223</size>
            <attacher name="Abderrahim BENAOUDA">abderrahim.benaouda</attacher>
            
              <data encoding="base64">REVCVUc6IEV4ZWN1dGluZyBweXRob24gZnVuY3Rpb24gYXV0b3Rvb2xzX2FjbG9jYWxzCkRFQlVH
OiBTSVRFIGZpbGVzIFsnZW5kaWFuLWxpdHRsZScsICdjb21tb24tbGludXgnLCAnY29tbW9uLWds
aWJjJywgJ2JpdC02NCcsICd4ODZfNjQtbGludXgnLCAnY29tbW9uJ10KREVCVUc6IFB5dGhvbiBm
dW5jdGlvbiBhdXRvdG9vbHNfYWNsb2NhbHMgZmluaXNoZWQKREVCVUc6IEV4ZWN1dGluZyBzaGVs
bCBmdW5jdGlvbiBkb19jb21waWxlCk5PVEU6IG1ha2UgLWogOApNYWtlZmlsZToyODI6ICoqKiBt
aXNzaW5nIHNlcGFyYXRvci4gIFN0b3AuCkVSUk9SOiBvZV9ydW5tYWtlIGZhaWxlZApXQVJOSU5H
OiAvd29ya2Rpci9idWlsZC90bXAvd29yay94ODZfNjQtbGludXgvbGlidXNiLWNvbXBhdC1uYXRp
dmUvMV8wLjEuNy1yMC90ZW1wL3J1bi5kb19jb21waWxlLjE3NToxODIgZXhpdCAxIGZyb20gJ2V4
aXQgMScKV0FSTklORzogQmFja3RyYWNlIChCQiBnZW5lcmF0ZWQgc2NyaXB0KTogCgkjMTogYmJm
YXRhbF9sb2csIC93b3JrZGl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