Compiling to specific glibc version with mkapp

I run the leaf shell in VSCode.

aaahhh… :slight_smile:
Yes, I started with VSCODE but I dropped it, I also dropped leaf as I thought it was easier to use legato workspace directly.
I would prefer to either use the legato workspace or leaf but WITHOUT vscode if possible.
DO you think you can speak with someone (I see you are a sierra wireless developer) to try to solve this problem with one of these two options??

I guess you can do like this:

Create a workspace directory:
mkdir myWorkspace; cd myWorkspace

Search for the latest Legato release for your module (i.e. wp76):
leaf search wp76

Install the SDK for your target (enter in your own < profileName > ):
leaf setup < profileName > -p swi-wp76_1.5.0

Invoke leaf shell:
leaf shell

If you want to use the legato workspace only, you need to setup the toolchain path manually. As said before, sometimes you use “. bin/configlegatoenv”, the toolchain path is not correct in “export”.
You need to change it manually.

owner@owner-ThinkPad-X220:~/LEAF/wp77/leaf-data/fx30catm/fx30-catm-legato$ export WP77XX_SYSROOT="/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi"
owner@owner-ThinkPad-X220:~/LEAF/wp77/leaf-data/fx30catm/fx30-catm-legato$ export WP77XX_KERNELROOT="/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel"
owner@owner-ThinkPad-X220:~/LEAF/wp77/leaf-data/fx30catm/fx30-catm-legato$ export WP77XX_TOOLCHAIN_DIR="/opt/swi/WP77_R9.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi"

yes, I did re-install the toolchain and now that is the same as per export.
The main problem was that the toolchain is for the wp77 and not the FX30, with higher revision for the GLIBC.
I have also got the leaf up and running, I was just missing the leaf shell which is basically setting up the environment.

Now that I am compiling with the correct toolchain for the firmware in the FX30S, I see an error for missing random.h file, which should be the reason why the app could not be ran on the target. At least things start making sense now…

My question is if you have a proper timeline for the new firmware to come available as 1-2 weeks should not be a problem, but is this happening for sure??
Otherwise I will need to dive into the yoctoproject to rebuild the image of the target which I haven`t done for a while and I would avoid if possible…

you can double check here:

BTW, I can find the random.h with the toolchain:

owner@owner-ThinkPad-X220:~/LEAF/wp77/leaf-data/fx30catm/fx30-catm-legato$ find /opt/swi/WP77_R9.1/ -name “random.h”
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/debug/gcc-runtime/6.2.0-r0/gcc-6.2.0/build.arm-poky-linux-gnueabi.arm-poky-linux-gnueabi/arm-poky-linux-gnueabi/libstdc+±v3/include/bits/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/config/hw/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/uapi/linux/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/trace/events/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/linux/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/config/hw/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/uapi/linux/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/trace/events/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/linux/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/c++/6.2.0/tr1/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/c++/6.2.0/bits/random.h
/opt/swi/WP77_R9.1/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/linux/random.h

Hi Claudio,
We are finalizing some certifications for the R11 release. The Leaf packages have been generated and are ready for publishing. I’m quite confident in the date estimation, but I’ll let you know asap if any unexpected issues are observed.
BR,
Chris

Hi cchenry,
I have been stuck with something else and finally managed to get back onto this.
Did setup the leaf environment with the new target but it seems I am still missing the <sys/random.h> header from the toolchain…

This is my leaf status:
│ Workspace: /home/XXXXX/legatoWorkspace/legatoAF │
╞═══════════════════════════════════════════════════════════════════════════════════════════╡
│ Profile: FX30S2 [current] (sync) │
├──────────┬─────────────────────┬──────────────────────────────────────────────────────────┤
│ Packages │ Identifier │ Description │
├──────────┼─────────────────────┼──────────────────────────────────────────────────────────┤
│ Included │ swi-fx30-catm_2.0.0 │ SDK for FX30-CATM (Release R11.0.0.007 + Legato 18.09.4) │
└──────────┴─────────────────────┴──────────────────────────────────────────────────────────┘

This is the toolchain I am using:
~/legatoWorkspace/legatoAF/apps/sample/AwsProject/JSON_in_C$ leaf env

Leaf built-in variables

export LEAF_VERSION=“2.3.1”;
export LEAF_PLATFORM_SYSTEM=“Linux”;
export LEAF_PLATFORM_MACHINE=“x86_64”;
export LEAF_PLATFORM_RELEASE=“5.4.0-48-generic”;

Exported by user configuration

export GERRIT_USER=“XXXXX”;

Exported by workspace

export LEAF_WORKSPACE="/home/XXXXX/legatoWorkspace/legatoAF";

Exported by profile FX30S2

export LEAF_PROFILE=“FX30S2”;

Exported by package fx30-catm-legato_18.09.4

export LEGATO_ROOT="/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/fx30-catm-legato";
export LEGATO_TARGET="${LEGATO_TARGET:-wp77xx}";
export DEBUG_FILE_DIR="$LEGATO_ROOT/build/wp77xx/debug:$DEBUG_FILE_DIR";
export PATH="$LEGATO_ROOT/bin:$PATH";

Exported by package wp77-toolchain_SWI9X06Y_02.22.12.00-linux64

export WP77XX_TOOLCHAIN_DIR="/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/wp77-toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi";
export WP77XX_TOOLCHAIN_PREFIX=“arm-poky-linux-gnueabi-”;
export WP77XX_SYSROOT="/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/wp77-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi";

Exported by package wp77-modem-image_11

export WP77XX_MODEM_IMAGES="/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/wp77-modem-image";

Exported by package fx30-catm-legato-image_18.09.4

export WP77XX_LEGATO_IMAGES="/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/fx30-catm-legato-image";

Exported by package fx30-catm-linux-image_R11.0.0.007

export WP77XX_LINUX_IMAGES="/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/fx30-catm-linux-image";

Exported by package fx30-catm-image_2.0.0

export WP77XX_DEVICE_IMAGES="/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/fx30-catm-image";

Exported by package swi-legato_1.4.191225

export LEGATO_OUTPUT_DIR="(/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-legato/set-legato-default LEGATO_OUTPUT_DIR)"; export LEGATO_OBJECT_DIR="(/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-legato/set-legato-default LEGATO_OBJECT_DIR)";
export LEGATO_UPDATE_FILE="(/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-legato/set-legato-default LEGATO_UPDATE_FILE)"; export LEGATO_TOOLCHAIN_FULL_PREFIX="(/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-legato/set-legato-default LEGATO_TOOLCHAIN_FULL_PREFIX)";
export LEGATO_SYSROOT="(/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-legato/set-legato-default LEGATO_SYSROOT)"; export DEST_IP="(/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-legato/set-legato-default DEST_IP)";
export LEGATO_CONFIG_SCRIPT="$(/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-legato/set-legato-default LEGATO_CONFIG_SCRIPT)";
test -r “/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-legato/load-config.sh” && source “/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-legato/load-config.sh”;

Exported by package swi-vscode-support_200624

export LEGATO_LANGUAGE_SERVER="/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-vscode-support/languageServer/languageServer.js";
export LEGATO_SNIPPETS="{LEGATO_SNIPPETS}:/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-vscode-support/snippets"; export PATH="/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/swi-vscode-support/bin:{PATH}";

When I run my mkapp I still get the error for missing <sys/random.h>
/legatoWorkspace/legatoAF/apps/sample/AwsProject/JSON_in_C$ mkapp -t wp77xx handleJSON.adef
[1/12] Compiling C source
FAILED: _build_handleJSON/wp77xx/component/55e5bcf4cfcbe254416a24fec25bd082/obj/10786f3562ea361768fd583d33217e84.o
/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/wp77-toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/wp77-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi -MMD -MF _build_handleJSON/wp77xx/component/55e5bcf4cfcbe254416a24fec25bd082/obj/10786f3562ea361768fd583d33217e84.o.d -c /home/XXXXX/legatoWorkspace/legatoAF/apps/sample/AwsProject/JSON_in_C/json-c/random_seed.c -o _build_handleJSON/wp77xx/component/55e5bcf4cfcbe254416a24fec25bd082/obj/10786f3562ea361768fd583d33217e84.o -DLE_FILENAME=basename /home/XXXXX/legatoWorkspace/legatoAF/apps/sample/AwsProject/JSON_in_C/json-c/random_seed.c -Wall -fPIC -Werror -fvisibility=hidden -DMK_TOOLS_BUILD -DLEGATO_EMBEDDED -I ./_build_handleJSON/wp77xx -I/home/claudio/legatoWorkspace/legatoAF/leaf-data/FX30S2/fx30-catm-legato/interfaces -I/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/fx30-catm-legato/framework/include -I/home/XXXXX/legatoWorkspace/legatoAF/apps/sample/AwsProject/JSON_in_C -I./_build_handleJSON/wp77xx/component/55e5bcf4cfcbe254416a24fec25bd082/src -DLE_COMPONENT_NAME=handleJSONComponent -DLE_LOG_SESSION=handleJSONComponent_LogSession -DLE_LOG_LEVEL_FILTER_PTR=handleJSONComponent_LogLevelFilterPtr “-DCOMPONENT_INIT=LE_CI_LINKAGE LE_SHARED void _handleJSONComponent_COMPONENT_INIT()” -I/home/XXXXX/legatoWorkspace/legatoAF/apps/sample/AwsProject/JSON_in_C/handleJSONComponent/…/json-c
/home/XXXXX/legatoWorkspace/legatoAF/apps/sample/AwsProject/JSON_in_C/json-c/random_seed.c:162:24: fatal error: sys/random.h: No such file or directory
#include <sys/random.h>
^
compilation terminated.
[2/12] Compiling C source
ninja: build stopped: subcommand failed.

So the toolchain still doesn`t have support for glibc 2.25?

Can you attach your app here?
I can try in vscode and see if it can be compiled

I just tried to compile the json.c library with some changes to run on this framework

Can you attach the project here

Will do next week, I don’t have the project with me at the moment

Hi Claudio,

I wonder if your toolchain is not pointing to the correct location. Could you please post where this symlink is pointing to:
/home/XXXXX/legatoWorkspace/legatoAF/leaf-data/FX30S2/wp77-toolchain

BR,
Chris

I found that the toolchain of fx30catm1 (SDK swi-fx30-catm_1.0.0 or swi-fx30-catm_2.0.0) do not support “sys/random.h”, however, toolchain of WP76 and WP77 are having this file.

owner@ubuntu:~ cd /home/owner/leaf/leaf-data/wp77/wp77-toolchain/sysroots/ owner@ubuntu:~/leaf/leaf-data/wp77/wp77-toolchain/sysroots find ./ -name “random.h”

./armv7a-neon-poky-linux-gnueabi/usr/include/c++/6.2.0/tr1/random.h
./armv7a-neon-poky-linux-gnueabi/usr/include/c++/6.2.0/bits/random.h
./armv7a-neon-poky-linux-gnueabi/usr/include/linux/random.h
./armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/uapi/linux/random.h
./armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/config/hw/random.h
./armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/linux/random.h
./armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/trace/events/random.h
./armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/uapi/linux/random.h
./armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/config/hw/random.h
./armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/linux/random.h
./armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/trace/events/random.h
./armv7a-neon-poky-linux-gnueabi/usr/src/debug/gcc-runtime/6.2.0-r0/gcc-6.2.0/build.arm-poky-linux-gnueabi.arm-poky-linux-gnueabi/arm-poky-linux-gnueabi/libstdc+±v3/include/bits/random.h

owner@ubuntu:~/leaf/leaf-data/wp77/wp77-toolchain/sysroots$ find /home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/ -name “random.h”
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/sys/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/c++/7.3.0/tr1/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/c++/7.3.0/bits/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/linux/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/uapi/linux/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/config/hw/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/linux/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/include/trace/events/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/uapi/linux/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/config/hw/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/linux/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel/usr/include/trace/events/random.h
/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/debug/gawk/4.2.1-r0/gawk-4.2.1/support/random.h
owner@ubuntu:~/leaf/leaf-data/wp77/wp77-toolchain/sysroots$

Yup, this was discussed some weeks ago and this is where we stopped the conversation, I was waiting for the catm2.0.0.0 which was meant to support the newer glibc above 2.24
Is the toolchain for the new release supporting glibc above 2.24? Otherwise this wait will not solve the problem and we need to have a different approach. If u could confirm this please

you can check the GLIBC version by the following:

root@fx30:~# strings /legato/systems/current/appsWriteable/hello1/lib/libc.so.6
| grep GLIBC

owner@ubuntu:~/leaf/leaf-data/wp77/wp77-toolchain/sysroots$ strings ./armv7a-neon-poky-linux-gnueabi/lib/libc.so.6 | grep GLIBC
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_2.18
GLIBC_2.22
GLIBC_2.23
GLIBC_2.24
GLIBC_PRIVATE

Problem is you need to use the correct toolchain complied with the FW you are using!
Previous problem is that you use WP77 toolchain to compile and run it in FX30 FW which is totally not matched.

Sorry but the legato is running on a VM at work and I don’t have access to it at the moment… @cchenry so basically the toolchain for the new fx30 catm 2.0.0.0 is still using the same glibc version? If that is the case we have been waiting for no reason, that is a bit disappointing

I think the problem now is not yet related to GLIBC version as you cannot even compile out the binary to give a test.
Problem now is the toolchain in FX30catM not supporting “sys/random.h”

As far as I understand the random.c library is included from glibc 2.24 onward and this is the reason why I can’t compile. If u could confirm this @cchenry cause this is not what I was told. Cheers

where did you get this information that the random.c library is included from glibc 2.24 ?
FX30 FW 9.1 already have GLIBC 2.24 as stated above.