cancel
Showing results for 
Search instead for 
Did you mean: 

usr/lib/libc.so: file not recognized: file format not recognized

Carson
Associate III

Hello, I am working with the STM32MP257F-EV1 Development board and I am getting stuck. I am following the following guide: https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP2_boards/STM32MP257x-EV1/Develop_on_Arm%C2%AE_Cortex%C2%AE-A35/Modify,_rebuild_and_reload_the_Linux%C2%AE_kernel. I am doing the step make ${IMAGE_KERNEL} vmlinux dtbs LOADADDR=0xC2000040 O="${OUTPUT_BUILD_DIR}" and when I run make I get the following output:

make[1]: Entering directory '/home/carson.kirk@internal.etherform.com/STM32MPU_Workspace/STM32MPU-Ecosystem-v5.1.0/Developer-Package/stm32mp2-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26/sources/aarch64-ostl-linux/linux-stm32mp-6.1.82-stm32mp-r2-r0/build'
GEN Makefile
HOSTLD scripts/dtc/dtc
/home/carson.kirk@internal.etherform.com/STM32MPU_Workspace/STM32MPU-Ecosystem-v5.1.0/Developer-Package/SDK/sysroots/x86_64-ostl_sdk-linux/usr/lib/gcc/x86_64-ostl_sdk-linux/12.3.0/../../../../lib/libc.so: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
make[2]: *** [/home/carson.kirk@internal.etherform.com/STM32MPU_Workspace/STM32MPU-Ecosystem-v5.1.0/Developer-Package/stm32mp2-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26/sources/aarch64-ostl-linux/linux-stm32mp-6.1.82-stm32mp-r2-r0/linux-6.1.82/scripts/Makefile.host:120: scripts/dtc/dtc] Error 1
make[1]: *** [/home/carson.kirk@internal.etherform.com/STM32MPU_Workspace/STM32MPU-Ecosystem-v5.1.0/Developer-Package/stm32mp2-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26/sources/aarch64-ostl-linux/linux-stm32mp-6.1.82-stm32mp-r2-r0/linux-6.1.82/Makefile:1524: scripts_dtc] Error 2
make[1]: Leaving directory '/home/carson.kirk@internal.etherform.com/STM32MPU_Workspace/STM32MPU-Ecosystem-v5.1.0/Developer-Package/stm32mp2-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26/sources/aarch64-ostl-linux/linux-stm32mp-6.1.82-stm32mp-r2-r0/build'
make: *** [Makefile:238: __sub-make] Error 2

I am unsure how to fix this error. Any help would be greatly appreciated. Thanks!

 

Carson

1 ACCEPTED SOLUTION

Accepted Solutions
krotti42
Associate II

Seems to be an installation issue from the installation script.

The following libc path isn't correct or there is a missing symbolic link to libc:

sysroots/x86_64-ostl_sdk-linux/lib/usr/libc.so is indeed no shared object file:

$ file libc.so
libc.so: ASCII text, with very long lines (304)
$ cat libc.so
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /home/jk/Downloads/Developer-Package/SDK/sysroots/x86_64-ostl_sdk-linux/lib/libc.so.6 /home/jk/Downloads/Developer-Package/SDK/sysroots/x86_64-ostl_sdk-linux/usr/lib/libc_nonshared.a  AS_NEEDED ( /home/jk/Downloads/Developer-Package/SDK/sysroots/x86_64-ostl_sdk-linux/lib/ld-linux-x86-64.so.2 ) )
$

The real libc shared library can be found under sysroots/x86_64-ostl_sdk-linux/lib.

 

As workaround you could try to delete the libc.so and text file and create a symbolic link with ln.

$ rm libc.so
$ ln -s ../../lib/libc.so.6 libc.so

 

View solution in original post

3 REPLIES 3
davinnicholas
Associate

I am also experiencing the same exact issue. Any feedback would be great!

krotti42
Associate II

Seems to be an installation issue from the installation script.

The following libc path isn't correct or there is a missing symbolic link to libc:

sysroots/x86_64-ostl_sdk-linux/lib/usr/libc.so is indeed no shared object file:

$ file libc.so
libc.so: ASCII text, with very long lines (304)
$ cat libc.so
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /home/jk/Downloads/Developer-Package/SDK/sysroots/x86_64-ostl_sdk-linux/lib/libc.so.6 /home/jk/Downloads/Developer-Package/SDK/sysroots/x86_64-ostl_sdk-linux/usr/lib/libc_nonshared.a  AS_NEEDED ( /home/jk/Downloads/Developer-Package/SDK/sysroots/x86_64-ostl_sdk-linux/lib/ld-linux-x86-64.so.2 ) )
$

The real libc shared library can be found under sysroots/x86_64-ostl_sdk-linux/lib.

 

As workaround you could try to delete the libc.so and text file and create a symbolic link with ln.

$ rm libc.so
$ ln -s ../../lib/libc.so.6 libc.so

 

Yep that worked! thank you so much!