Adding Third Party Libraries

Hello,

I am trying to port a legacy execuytable to the legato sandbox using these directions:

https://docs.legato.io/15_10/how_to_port_legacy_gen.html

It seems to create the bundle with all the nessecary libraries but when the app starts in the legato environment it throws an error and says it can’t find the required libraries. Here is my adef file:

// Disable the sandbox security to make things a little easier.
sandboxed: false
// Put the cross-compiled legacy program in the app’s bin directory.
// = make it executable.
bundles:
{
file:
{
usr/bin/my_app /bin/

[r] thirdparty/usr/lib/libcares.so.2.2.0	/usr/lib/
[r] thirdparty/usr/lib/libunwind-coredump.so.0.0.0 /usr/lib/
[r] thirdparty/usr/lib/libunwind-arm.so.8.0.1 /usr/lib/
[r] thirdparty/usr/lib/libgflags.so.2.2.0 /usr/lib/
[r] thirdparty/usr/lib/libgflags_nothreads.so.2.2.0 /usr/lib/
[r] thirdparty/usr/lib/libunwind-setjmp.so.0.0.0 /usr/lib/
[r] thirdparty/usr/lib/libglog.so.0 /usr/lib/
[r] thirdparty/usr/lib/libprotobuf-lite.so.15.0.1 /usr/lib/
[r] thirdparty/usr/lib/libprotoc.so.15.0.1 /usr/lib/
[r] thirdparty/usr/lib/libsqlite3.so.0.8.6 /usr/lib/
[r] thirdparty/usr/lib/libsqlite.so.0.8.6 /usr/lib/
[r] thirdparty/usr/lib/libunwind.so.8.0.1 /usr/lib/
[r] thirdparty/usr/lib/libunwind-ptrace.so.0.0.0 /usr/lib/
[r] thirdparty/usr/lib/libprotobuf.so.15.0.1 /usr/lib/
}

}

// Tell the Supervisor to start this program when the application is started.
processes:
{
run:
{
(my_app)
}
}

here is my build directory layout:

$ tree
.
└── wp76
    ├── app
    │   └── my_app
    │       ├── my_app.wp76
    │       └── staging
    │           ├── info.properties
    │           ├── read-only
    │           │   ├── bin
    │           │   │   └── my_app
    │           │   └── usr
    │           │       └── lib
    │           │           ├── libcares.so.2.2.0
    │           │           ├── libgflags_nothreads.so.2.2.0
    │           │           ├── libgflags.so.2.2.0
    │           │           ├── libglog.so.0
    │           │           ├── libprotobuf-lite.so.15.0.1
    │           │           ├── libprotobuf.so.15.0.1
    │           │           ├── libprotoc.so.15.0.1
    │           │           ├── libsqlite3.so.0.8.6
    │           │           ├── libsqlite.so.0.8.6
    │           │           ├── libunwind-arm.so.8.0.1
    │           │           ├── libunwind-coredump.so.0.0.0
    │           │           ├── libunwind-ptrace.so.0.0.0
    │           │           ├── libunwind-setjmp.so.0.0.0
    │           │           └── libunwind.so.8.0.1
    │           └── root.cfg
    ├── build.ninja
    ├── mktool_args
    └── mktool_environment

Uploading goes okay but I get the following error on from the sandbox:
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c app_Start() 2926 | Starting app ‘my_app’
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/bin/my_app’ to '/legato/systems/current/appsWriteable/my_app/
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1549 | Skipping file link ‘/legato/systems/current/apps/my_app/read-only/bin/my_app’ to '/legato/systems/current/appsWriteable/my_app
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libcares.so.2.2.0’ to '/legato/systems/current/appsWriteable/my_app/us
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libgflags.so.2.2.0’ to '/legato/systems/current/appsWriteable/my_app/u
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libgflags_nothreads.so.2.2.0’ to '/legato/systems/current/appsWriteable/fil
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libglog.so.0’ to '/legato/systems/current/appsWriteable/my_app/usr/lib
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libprotobuf-lite.so.15.0.1’ to '/legato/systems/current/appsWriteable/file_
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libprotobuf.so.15.0.1’ to '/legato/systems/current/appsWriteable/file_uploa
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libprotoc.so.15.0.1’ to '/legato/systems/current/appsWriteable/my_app/
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libsqlite.so.0.8.6’ to '/legato/systems/current/appsWriteable/my_app/u
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libsqlite3.so.0.8.6’ to '/legato/systems/current/appsWriteable/my_app/
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libunwind-arm.so.8.0.1’ to '/legato/systems/current/appsWriteable/file_uplo
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libunwind-coredump.so.0.0.0’ to '/legato/systems/current/appsWriteable/file
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libunwind-ptrace.so.0.0.0’ to '/legato/systems/current/appsWriteable/file_u
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libunwind-setjmp.so.0.0.0’ to '/legato/systems/current/appsWriteable/file_u
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | app.c CreateFileLink() 1619 | Created file link ‘/legato/systems/current/apps/my_app/read-only/usr/lib/libunwind.so.8.0.1’ to '/legato/systems/current/appsWriteable/my_app/u
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxCoreDumpFileBytes to value 102400.
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxFileBytes to value 102400.
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxLockedMemoryBytes to value 8192.
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxFileDescriptors to value 256.
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxMQueueBytes to value 512.
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxThreads to value 20.
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxQueuedSignals to value 100.
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | proc.c proc_Start() 1389 | Starting process ‘my_app’ with pid 26850
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | updateDaemon[857]/updateDaemon T=main | app.c app_InstallIndividual() 788 | App my_app <0c8ebde1333c6a66c5bf20a759bbe78c> installed
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | updateDaemon[857]/updateDaemon T=main | updateDaemon.c ApplyAppUpdate() 914 | App ‘my_app<0c8ebde1333c6a66c5bf20a759bbe78c>’ installed properly.
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | updateDaemon[857]/updateDaemon T=main | updateDaemon.c StartProbation() 218 | System on probation (timer started).
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | supervisor.c SigChildHandler() 783 | Reaping unconfigured child process 26846.
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[26850]/supervisor T=main | proc.c proc_Start() 1354 | Execing ‘my_app’
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | avcDaemon[912]/avcDaemon T=main | avcAppUpdate.c NotifyObj9List() 691 | Found 4 object 9 instances
Oct 8 14:46:47 swi-mdm9x28-wp authpriv.info dropbear[26656]: Exit (root): Disconnect received
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | avcDaemon[912]/avcDaemon T=main | avcAppUpdate.c NotifyObj9List() 692 | obj9ListLen; 51 obj9List: </lwm2m/9/0>,</lwm2m/9/1>,</lwm2m/9/2>,</lwm2m/9/3>
Oct 8 14:46:47 swi-mdm9x28-wp user.err Legato: =ERR= | my_app[26850] | my_app: error while loading shared libraries: libglog.so.0: cannot open shared object file: No such file or directory
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | proc.c proc_SigChildHandler() 2035 | Process ‘my_app’ (PID: 26850) has exited with exit code 127.
Oct 8 14:46:47 swi-mdm9x28-wp user.warn Legato: -WRN- | supervisor[843]/supervisor T=main | app.c app_SigChildHandler() 3480 | Process ‘my_app’ in app ‘my_app’ faulted: Ignored.
Oct 8 14:46:47 swi-mdm9x28-wp user.warn Legato: -WRN- | _appStopClient[26851]/framework T=main | LE_FILENAME CreateSocket() 550 | Socket opened as standard i/o file descriptor 2!
Oct 8 14:46:47 swi-mdm9x28-wp user.info Legato: INFO | supervisor[843]/supervisor T=main | apps.c DeactivateAppContainer() 374 | Application ‘my_app’ has stopped.

Can someone help?

my_app: error while loading shared libraries: libglog.so.0: cannot open shared object file: No such file or directory

Seems when you set to unsandboxed app, it will go to the real path /usr/lib to find the library.
Maybe you can set to sandboxed to true.