3

I am trying to build AGL(with poky icefish) as per instructions in https://wiki.automotivelinux.org/agl-distro/source-code inside a container based off crops/poky(https://github.com/crops/poky-container/blob/master/Dockerfile)

While running bitbake agl-demo-platform, I am getting the following error in perl-native-5.24.4-r0 recipe's do_configure phase from Configure script(I am using https://downloads.yoctoproject.org/releases/yocto/yocto-3.1/buildtools/x86_64-buildtools-extended-nativesdk-standalone-3.1.sh to install buildtools-extended)

Following are the gcc and ld versions in the SDK

admin@2a517c6c3748:/home/work/agl$ which gcc
/opt/poky/3.1/sysroots/x86_64-pokysdk-linux/usr/bin/gcc
admin@2a517c6c3748:/home/work/agl$ gcc --version
gcc (GCC) 9.3.0
admin@2a517c6c3748://opt/poky/3.1/sysroots/x86_64-pokysdk-linux/usr/bin$ ./x86_64-pokysdk-linux-ld -v
GNU ld (GNU Binutils) 2.34.0.20200220
ERROR: perl-native-5.24.4-r0 do_configure: Function failed: do_configure (log file is located at /home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/temp/log.do_configure.1100)
ERROR: Logfile of failure stored in: /home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/temp/log.do_configure.1100
Log data follows:
| DEBUG: Executing shell function do_configure
| First let's make sure your kit is complete.  Checking...
| Would you like to see the instructions? [n]
| Locating common programs...
| Checking compatibility between /home/work/agl/build/tmp/hosttools/echo and builtin echo (if any)...
| Symbolic links are supported.
| Checking how to test for symbolic links...
| You can test for symbolic links with 'test -h'.
| Checking for cross-compile
| No targethost for running compiler tests against defined, running locally
...
| Operating system name? [linux]
| Operating system version? [5.3.0-1019-aws]
| Installation prefix to use? (~name ok)
| [/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/usr]
| AFS does not seem to be running...
| What installation prefix should I use for installing files? (~name ok)
| [/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/usr]
| Getting the current patchlevel...
| Build a threading Perl? [y]
| Use which C compiler? [gcc ]
| Checking for GNU cc in disguise and/or its version number...
| Now, how can we feed standard input to your C preprocessor...
| Directories to use for library searches?
| [/usr/local/lib /opt/poky/3.1/sysroots/x86_64-pokysdk-linux/usr/lib /opt/poky/3.1/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/9.3.0/include-fixed /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib /lib64]
| What is the file extension used for shared libraries? [so]
| Make shared library basenames unique? [n]
| Build Perl for SOCKS? [n]
| Try to use long doubles if available? [n]
| Checking for optional libraries...
| What libraries to use? [-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc]
| What optimizer/debugger flag should be used? [-O2]
| Any additional cc flags?
| [-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include]
| Let me guess what the preprocessor flags are...
| Any additional ld flags (NOT including libraries)?
| [-L/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/usr/lib -L/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/lib -Wl,-rpath-link,/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/work/agl/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 -L/usr/local/lib]
| Checking your choice of C compiler and flags for coherency...
| I've tried to compile and run the following simple program:
| 
| #include <stdio.h>
| int main() { printf("Ok\n"); return(0); }
| 
| I used the command:
| 
|       gcc -o try -O2 -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -L/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/usr/lib -L/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/lib -Wl,-rpath-link,/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/lib -Wl,-rpath,/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/work/agl/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 -L/usr/local/lib try.c -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
|        ./try
| 
| and I got the following output:
| 
| /opt/poky/3.1/sysroots/x86_64-pokysdk-linux/usr/lib/gcc/x86_64-pokysdk-linux/9.3.0/../../../../x86_64-pokysdk-linux/bin/ld: cannot find -lnsl<=======
| collect2: error: ld returned 1 exit status
| I can't compile the test program.
| You have a BIG problem.  Shall I abort Configure [y]
| Ok.  Stopping Configure.
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_configure (log file is located at /home/work/agl/build/tmp/work/x86_64-linux/perl-native/5.24.4-r0/temp/log.do_configure.1100)
NOTE: recipe perl-native-5.24.4-r0: task do_configure: Failed
ERROR: Task (/home/work/agl/external/poky/meta/recipes-devtools/perl/perl-native_5.24.4.bb:do_configure) failed with exit code '1'
...
NOTE: Tasks Summary: Attempted 647 tasks of which 606 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
/home/work/agl/external/poky/meta/recipes-devtools/perl/perl-native_5.24.4.bb:do_configure
Summary: There was 1 WARNING message shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code

I tried switching to a different SDK 3.1.1 (https://downloads.yoctoproject.org/releases/yocto/yocto-3.1.1/buildtools/x86_64-buildtools-nativesdk-standalone-3.1.1.sh) but that causes a hang in do_fetch in bitbake(https://stackoverflow.com/questions/62629159/aglbitbake-agl-demo-platform-hangs-in-task-16)

user7942834
  • 305
  • 3
  • 8
  • do you have libnsl installed and in a location where the tools can find it? – brian d foy Jul 01 '20 at 19:37
  • 1
    *"ld: cannot find -lnsl"* : See also: https://gist.github.com/tpoxa/01bc06febb6b9c904baca639fe4d54d3 – Håkon Hægland Jul 01 '20 at 19:42
  • The superficial problem is that `gcc` is directed to link against `libnsl` (via `-lnsl`), but the linker can't find this library. (I have no idea what that is, what it's needed for, or why it might not be present.) – ikegami Jul 01 '20 at 21:51
  • I think it refers to [Network Information Service](https://en.wikipedia.org/wiki/Network_Information_Service)? Not sure how that's used. I wonder if Perl could survive without it by removing `-lnsl` from the default of `What libraries to use?`. – ikegami Jul 01 '20 at 22:00
  • [This](http://www.linuxfromscratch.org/blfs/view/svn/basicnet/libnsl.html) suggests it used to be part of gcc and that it's not anymore, and the link provided by Håkon Hægland shows how to install the replacement to which I linked at the start of this comment. Of course, it's entirely possible that your distro provides a package that provides libnsl. – ikegami Jul 01 '20 at 22:07

1 Answers1

0

Since libnsl is no longer included in gcc 9.3 provided by the buildtools-tarball, you can use libnsl2 instead (tested on poky thud):

diff --git a/meta/recipes-devtools/perl/perl-native_5.24.4.bb b/meta/recipes-devtools/perl/perl-native_5.24.4.bb
index 81d3fd4898..ee4d4e3928 100644
--- a/meta/recipes-devtools/perl/perl-native_5.24.4.bb
+++ b/meta/recipes-devtools/perl/perl-native_5.24.4.bb
@@ -1,7 +1,7 @@
 require perl.inc
 
 # We need gnugrep (for -I)
-DEPENDS = "db-native grep-native gdbm-native zlib-native"
+DEPENDS = "db-native grep-native gdbm-native zlib-native libnsl2-native"
 
 EXTRA_OEMAKE = "-e MAKEFLAGS="
 
diff --git a/meta/recipes-devtools/perl/perl_5.24.4.bb b/meta/recipes-devtools/perl/perl_5.24.4.bb
index 2f27749c53..70a60d8699 100644
--- a/meta/recipes-devtools/perl/perl_5.24.4.bb
+++ b/meta/recipes-devtools/perl/perl_5.24.4.bb
@@ -1,7 +1,7 @@
 require perl.inc
 
 # We need gnugrep (for -I)
-DEPENDS = "db grep-native gdbm zlib virtual/crypt"
+DEPENDS = "db grep-native gdbm zlib virtual/crypt libnsl2"
 
 # Pick up patches from debian
 # http://ftp.de.debian.org/debian/pool/main/p/perl/perl_5.22.0-1.debian.tar.xz

See also Adding gcc 9.3.0 to ubuntu-16.04 image breaks builds for rocko and thud

moto-timo
  • 1
  • 3