Error while loading shared libraries: Internal Error

Hi All,

I am using MangOH green with WP76 module, I have a application which use shared library files to fetch the data from client devices. The shared library file is compiled for arm7 architecture. Able to compile the code successfully but while executing the app it is throwing the below mentioned error

“error while loading shared libraries: Internal Error”

Getting one warning message while compiling also

"
/home/wimate/.leaf/wp76-toolchain_SWI9X07Y_02.37.10.04-linux64/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/7.3.0/real-ld: warning: ld-linux-armhf.so.3, needed by /home/wimate/Sierra_Wireless/Trial_Sierra/components/melpcnc//libcustom_Arm.so, not found (try using -rpath or -rpath-link)"

Please let me know how to solve this warning and what could be the cause for that internal error?

For the warning, did you try to put liblinux-armhf.so.3 in the same location as
libcustom_Arm.so while compiling?

Or here shows you might need to copy the required libraries in /sysroots/armv7a-neon-poky-linux-gnueabi/usr/lib/

For running the app, did you put the required libraries (liblinux-armhf.so.3) in the module /usr/lib folder?
Here says “The dynamic linker will typically look in the /lib and /usr/lib directories for libraries at runtime.”

You might need to enter the following to copy libraries to this folder:

mkdir /tmp/tmp_usr_lib;mkdir /tmp/tmp_usr_lib_wr;

mount -t overlay overlay /usr/lib -o lowerdir=/usr/lib,upperdir=/tmp/tmp_usr_lib,workdir=/tmp/tmp_usr_lib_wr;

Hi i have tried it earlier there was an error couldn’t open shared library file. Now it is solved and there is no warning while compiling the code, Still facing the same issue

“error while loading shared libraries: /lib/libcustom_Arm.so: internal error”

Please find the library file details below

libcustom_Arm.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=7aac04ea29ab20ac8de64e31d9295, with debug_info, not stripped

how do you compile libcustom_Arm.so

It is shared by client, they are using the same library file in Raspberry pi and Debian10.10. Due to some issue with Raspberry pi they want the system to migrate for sierra device

Readelf -A gives below info

Attribute Section: aeabi
File Attributes
Tag_CPU_name: “7-A”
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv3-D16
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6

Sorry for this basic question, can you please tell me where exactly i need to do this activity

mkdir /tmp/tmp_usr_lib;mkdir /tmp/tmp_usr_lib_wr;

mount -t overlay overlay /usr/lib -o lowerdir=/usr/lib,upperdir=/tmp/tmp_usr_lib,workdir=/tmp/tmp_usr_lib_wr;

Have you recompiled this lib with wp toolchain

Of course in module’linux console

My .cdef file
// myfirstappComponent
//
// This is component definition file that specifies the internal content and external interfaces
// of reusable software components.
//
// For more details on the component definition (.cdef) file format see:
// Component Definition .cdef - Legato Docs

// Source code files.
sources:
{
myfirstappComponent.c
}

cflags:
{
-DOPENSSL=1 -D_LINUX
-std=c99
-I${LEGATO_ROOT}/3rdParty/paho.mqtt.c/src -I/home/wimate/Sierra_Wireless/Trial_Sierra/components/myfirstappComponent/include
-pthread
-g
}

ldflags:
{
-L${LEGATO_BUILD}/3rdParty/paho.mqtt.c
-L /home/wimate/Sierra_Wireless/Trial_Sierra/components/custom/
}

// Bind resources from the target module into your application.
requires:
{
component:
{
${LEGATO_ROOT}/components/3rdParty/paho.mqtt.c
}

// IPC APIs used by this component.
api:
{
    le_data.api
}

// File paths local to your target module.
file:
{
    /usr/lib/libssl.so.1.0.2    /lib/
    /usr/lib/libcrypto.so.1.0.2 /lib/

	/lib/libutil.so.1		/lib/

    [rx]/home/root/lib_custom/libcustom_Arm.so   /lib/
    [rx]/home/root/lib_custom/ld-linux-armhf.so.3    /lib/
    
}


// Directories on your target module to make accessible to the app.
dir:
{
}

// Linux filesystem device paths.
device:
{
    
}

// Shared libraries pre-installed on the module.
lib:
{
    libpaho-mqtt3cs.so
    libcustom_Arm.so 
    ssl 
    crypto
}

}

Yeah tried with linux console,

same library files i included in .adef file also

it has compiled successfully

in console i performed this activity

root@swi-mdm9x28-wp:~/lib_custom# mkdir /tmp/tmp_usr_lib
root@swi-mdm9x28-wp:~/lib_custom# mkdir /tmp/tmp_usr_lib_wr
root@swi-mdm9x28-wp:~/lib_custom# mount -t overlay overlay /usr/lib -o lowerdir=/usr/lib,upperdir=/tm
p/tmp_usr_lib,workdir=/tmp/tmp_usr_lib_wr;

Does libcustom_Arm.so already in module /usr/lib folder?
Have you recompiled this lib with wp toolchain

No it was not in module, But i recompiled with wp76 tool chain

Didn’t your app need this lib in run time?

For that i have copied the file to module in folder lib_custom, and made that linking in .cdef file

// File paths local to your target module.
file:
{
    /usr/lib/libssl.so.1.0.2    /lib/
    /usr/lib/libcrypto.so.1.0.2 /lib/

	/lib/libutil.so.1		/lib/

    [rx]/home/root/lib_custom/libcustom_Arm.so   /lib/
    [rx]/home/root/lib_custom/ld-linux-armhf.so.3    /lib/
    
}

I am not able to copy in /lib/ or /usr/lib/ folder, it s throwing error read only systems

Then can you write a simple linux app to see if it can load this lib?
This can isolate legato factor

Hi

Now i have moved my library files to /usr/lib and /lib folder also

getting this error
lsm=SMACK fn=smack_inode_permission action=denied subject=“app.myfirstapp” object=“admin” requested=r pid=18064 comm=“myfirstappCompo” name=" ```
libcustom_Arm.so" dev=“tmpfs” ino

Then can you write a simple linux app to see if it can load this lib?
This can isolate legato factor