# Compiling to specific glibc version with mkapp

**URL:** <https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369>\
**Category:** Uncategorized\
**Created:** [August 21, 2020, 6:14am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369 "2020-08-21T06:14:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 21, 2020, 6:14am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/1 "2020-08-21T06:14:29Z")

</div>

I am trying to implement a json-c library as an application and I have a problem with the glibc version.  
This is the toolchain I am using for the wp77xx (FX30S)  
/opt/swi/SWI9X06Y\_02.32.02.00/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi

This is instead the repo for the json-c library:

> **[GitHub - json-c/json-c: https://github.com/json-c/json-c is the official code...](https://github.com/json-c/json-c)**
>
> https://github.com/json-c/json-c is the official code repository for json-c. See the wiki for release tarballs for download. API docs at http://json-c.github.io/json-c/ - GitHub - json-c/json-c: ...

The problem I have is that I can make the app and to upload it to the target, but then it doesn`t run because it requests a newer version of GLIBC 2.25 while I have a 2.24 uploaded in the target.  
Sorry if this is a silly question, but I have been looking into this for the whole day trying to link the older version of the GLIBC library, but is this set by the toolchain or by the json-c library? Anyone knows where the version of the GLIBC gets assigned? Because I would expect the toolchain to compile using the suitable GLIBC library…

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 21, 2020, 6:31am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/2 "2020-08-21T06:31:06Z")

</div>

you can try with Ubuntu 18.04:

owner@ubuntu:~$ ldd --version  
ldd (Ubuntu GLIBC 2.27-3ubuntu1) 2.27  
Copyright (C) 2018 Free Software Foundation, Inc.  
This is free software; see the source for copying conditions. There is NO  
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
Written by Roland McGrath and Ulrich Drepper.  
owner@ubuntu:~$ lsb\_release -a  
No LSB modules are available.  
Distributor ID: Ubuntu  
Description: Ubuntu Bionic Beaver (development branch)  
Release: 18.04  
Codename: bionic  
owner@ubuntu:~$

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 21, 2020, 7:14am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/3 "2020-08-21T07:14:44Z")

</div>

I am using ubuntu 20 on a VM but…  
\*\*\*\*\*@\*\*\*\*-VirtualBox:~/mySystemAws$ ldd --version  
ldd (Ubuntu GLIBC 2.31-0ubuntu9) 2.31  
Copyright (C) 2020 Free Software Foundation, Inc.  
This is free software; see the source for copying conditions. There is NO  
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
Written by Roland McGrath and Ulrich Drepper.

So the GLIBC version in my VM is 2.31 but the code is compiled for 2.25, this is why I was wondering if this is set somewhere (maybe in automatic) but the compiler once it compiles the files…

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 21, 2020, 7:51am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/4 "2020-08-21T07:51:17Z")

</div>

this is the error I get when trying to run the application:  
Aug 21 07:47:44 fx30s user.err Legato: =ERR= | handleJSON[5079] | handleJSON: /lib/libc.so.6: version `GLIBC\_2.25’ not found (required by /lib/libComponent\_handleJSONComponent.so)

and I am assuming this is set somewhere by the toolchain not the VM machine toolchain or I would get an error saying that the version GLIBC\_2.31 is required not the 2.25, correct.  
The toolchain must set the required GLIBC library as it compiles the json-c library, because I don`t get this message when I compile and deploy the app I have generated for connecting to AWS.

So my question was, how can I get the toolchain to compile the app to a specific GLIBC verstion? (2.24)

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 21, 2020, 7:57am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/5 "2020-08-21T07:57:57Z")

</div>

do you think you can downgrade your GLIBC to have a try?

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 21, 2020, 8:04am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/6 "2020-08-21T08:04:44Z")

</div>

you mean to downgrade the GLIBC of ubuntu 20.04 from 2,31 to 2,24?

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 21, 2020, 8:37am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/7 "2020-08-21T08:37:01Z")

</div>

downgrading the glibc is a quite dangerous task, that also means that I cannot use a newer OS to compile code for an older target, which basically goes against the whole purpose of cross compiling…  
Did I understand correctly what you have asked me to do?  
Are you sure this is the problem?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 21, 2020, 9:09am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/9 "2020-08-21T09:09:31Z")

</div>

what is the GLIBC version on your target?  
On my side with FX30 FX9.1:  
root@fx30:~# strings /legato/systems/current/appsWriteable/hello1/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

I have also tried to find the lib version inside the toolchain of WP76 R13:  
owner@owner-ThinkPad-X220:/opt/swi/SWI9X07Y\_02.28.03.01$ strings ./sysroots/armv7a-neon-poky-linux-gnueabi/lib/libc.so.6 | grep GLIB  
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\_2.25  
GLIBC\_2.26  
GLIBC\_2.27  
GLIBC\_PRIVATE

Not sure if you can find a more updated WP77 toolchain to compile your app.

(Or you can take the one in WP76 R13 toolchain and paste to the target /lib/libc.so.6?)  
As /lib is read-only, you might need to overlay it:  
root@fx30:~# mkdir /tmp/tmp\_lib;mkdir /tmp/tmp\_lib\_wr;  
root@fx30:~# mount -t overlay overlay /lib -o lowerdir=/lib,upperdir=/tmp/tmp\_li  
b,workdir=/tmp/tmp\_lib\_wr;

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 24, 2020, 2:44am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/10 "2020-08-24T02:44:02Z")

</div>

I don`t know what is included in the image for this fs, but when I make the folders and copy the libc.so.6 into the tmp\_lib, then run the overlay command I get this error:

root@fx30s:/tmp# mount -t overlay overlay /lib -o lowerdir=/lib,upperdir=/tmp/tmp\_lib,workdir=/tmp/tmp\_lib\_wr;  
root@fx30s:/tmp# app start handleJSON  
**app: relocation error: /lib/libc.so.6: symbol \_dl\_exception\_create, version GLIBC\_PRIVATE not defined in file ld-linux.so.3 with link time reference**

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 24, 2020, 3:04am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/11 "2020-08-24T03:04:33Z")

</div>

maybe you also need to copy the ld-linux.so.3:

owner@owner-ThinkPad-X220:~/Downloads$ find /opt/swi/SWI9X07Y\_02.28.03.01/sysroots/armv7a-neon-poky-linux-gnueabi/ -name “ld-linux.so.3”  
/opt/swi/SWI9X07Y\_02.28.03.01/sysroots/armv7a-neon-poky-linux-gnueabi/lib/ld-linux.so.3

owner@owner-ThinkPad-X220:~/Downloads$ strings /opt/swi/SWI9X07Y\_02.28.03.01/sysroots/armv7a-neon-poky-linux-gnueabi/lib/ld-linux.so.3 | grep GLIB  
GLIBC\_2.4  
GLIBC\_PRIVATE  
GLIBC\_TUNABLES

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 24, 2020, 3:44am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/12 "2020-08-24T03:44:37Z")

</div>

mmmhhh…  
It doesn`t seems we are getting anywhere here, maybe the best option at this point is to rebuild the image of my target with all necessary libraries, which I would have preferred to do at a later stage but I don`t see any alternative if I want to move forward…

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 24, 2020, 3:57am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/13 "2020-08-24T03:57:09Z")

</div>

To me, no idea why your /lib/libComponent\_handleJSONComponent.so will require a GLIBC lib that is not present on your toolchain.  
I wonder if you are using the correct toolchain path to compile your app…

Anyway, good luck!

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 24, 2020, 4:43am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/14 "2020-08-24T04:43:12Z")

</div>

well, I don`t know either, this was the reason why I posted on this forum… 🙂  
The problem is certainly the toolchain, which is building the app with a newer Glibc library then what is included in the firmware.  
The only toolchain I can find is the one from this link:  
[https://source.sierrawireless.com/resources/airprime/software/wp77xx/wp77xx-firmware-latest-release-components/#sthash.AFozzBQj.dpbs](https://source.sierrawireless.com/resources/airprime/software/wp77xx/wp77xx-firmware-latest-release-components/#sthash.AFozzBQj.dpbs)  
**poky-swi-ext-glibc-x86\_64-meta-toolchain-swi-armv7a-neon-toolchain-swi-SWI9X06Y\_02.35.02.00.sh**

you said this should be the correct one instead:  
wp77-toolchain\_SWI9X06Y\_02.18.05.00-linux64

So where can I find this toolchain…???

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 24, 2020, 4:55am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/15 "2020-08-24T04:55:42Z")

</div>

you can search by “leaf search” and then you will see a identifier "swi-fx30-catm\_1.0.0 "

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 24, 2020, 5:03am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/16 "2020-08-24T05:03:23Z")

</div>

that is the firmware not the toolchain, correct?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 24, 2020, 5:24am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/17 "2020-08-24T05:24:29Z")

</div>

it includes the toolchain, legato framework, images.

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 24, 2020, 5:37am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/18 "2020-08-24T05:37:36Z")

</div>

I have been working with a manual installation of the legato workspace and that could have been the problem, I was more looking to replace and re-install the toolchain still working merely under legato but I can use leaf instead.

The problem I have is that after installing the leaf:  
XXXX@XXXX-VirtualBox:~/leaf/AwsProject$ leaf status  
┌─────────────────────────────────────────────────────────────────────────────────────────┐  
│ Workspace: /home/XXXX/leaf/AwsProject │  
╞═════════════════════════════════════════════════════════════════════════════════════════╡  
│ Profile: FX30S\_stable [current] (sync) │  
├──────────┬─────────────────────┬────────────────────────────────────────────────────────┤  
│ Packages │ Identifier │ Description │  
├──────────┼─────────────────────┼────────────────────────────────────────────────────────┤  
│ Included │ swi-fx30-catm\_1.0.0 │ SDK for FX30-CATM (Release 9.1.1.013 + Legato 18.06.1) │  
└──────────┴─────────────────────┴─────────────────────

I still don`t have access to the commands (mkapp, mksys) which I get if I configure the environment under legato workspace:  
XXXX@XXXX-VirtualBox:~/legatoWorkspace/legatoAF$ source bin/configlegatoenv  
which should technically use the installed toolchain…

So my question is, do I need to remove the currently installed toolchain I have manually installed when using leaf or this will adjust to the required toolchain? (I would expect the former but something is not working at the moment).

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 24, 2020, 5:50am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/19 "2020-08-24T05:50:14Z")

</div>

you can type “export” to check if the toolchain path is correct after you do “. bin/configlegatoenv”

e.g.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/1X/326e0d28122ffb75c927462bd4720e76774a89eb.png)

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [August 24, 2020, 5:55am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/20 "2020-08-24T05:55:58Z")

</div>

this is what I read once I have setup the leaf under the leaf workspace (which is different from the legato workspace) and then run the source bin/configlegatoenv in the legato workspace.

declare -x WP77XX\_KERNELROOT=“/opt/swi/SWI9X07Y\_02.28.03.05/sysroots/armv7a-neon-poky-linux-gnueabi/usr/src/kernel”  
declare -x WP77XX\_SYSROOT=“/opt/swi/SWI9X07Y\_02.28.03.05/sysroots/armv7a-neon-poky-linux-gnueabi”  
declare -x WP77XX\_TOOLCHAIN\_DIR=“/opt/swi/SWI9X07Y\_02.28.03.05/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi”  
declare -x WP77XX\_TOOLCHAIN\_PREFIX=“arm-poky-linux-gnueabi-”

the bin folder is installed by the toolchain manual install so something is still not clear.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [August 24, 2020, 5:57am UTC](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369/21 "2020-08-24T05:57:44Z")

</div>

seems it is not using the toolchain you installed.

[Next page](https://forum.legato.io/t/compiling-to-specific-glibc-version-with-mkapp/5369.md?page=2)
