libEGL.so.1 cannot be found

Hardware Platform: DRIVE AGX Pegasus™ Developer Kit
Software Version: DRIVE Software 10
Host Machine Version: Ubuntu 18.04
SDK Manager Version: 1.1.0.6343

Hello,

I wanted to cross compile some code and samples onto the target but I get the following error when executing “make -j”:

/home/.../nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libEGL.so.1, needed by /usr/local/driveworks-2.2/targets/aarch64-Linux/lib/libnvinfer.so.5, not found (try using -rpath or -rpath-link)

Last week, however, everything was still working fine. How can I fix this now?

Thanks in advance!

Dear @kn10,
Few questions, do you see libEGL.so.1 in the same path as mentioned in error. Did you select both host and target components while installing DRIVE SW 10 via sdkmanager?

Dear @SivaRamaKrishnaNV,

no, I do not see libEGL.so.1 in the same path as mentioned in the error above.

Yes, I selected both host and target components during the installation. As I mentioned in my post above, everything worked fine last week.

Dear @kn10,
Please empty the build folder and check the steps Could you please provide complete cmake and make logs. Also check if you see any issue with host compilation?

Dear @SivaRamaKrishnaNV,

I emptied the build folder and repeated the steps - it did not solve the problem.

Here are the log files:

CMakeError.log (6.2 KB)
CMakeOutput.log (137.0 KB)
make_log.txt (35.7 KB)

Compiling on host works fine, there are no errors and issues.

Hi @kn10,

Because I cannot find the file in your current path (~/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/lib-target), could you try with including below as your library searching path?

~/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/lib/aarch64-linux-gnu

Hi @VickNV,

thank you for your response. I am not quite sure if I know what you mean. How and where exactly should I include the library searching path?

Thanks in advance!

According to below snippet from your CMakeError.log, it was wrongly looking for libpthreads.so (should be libpthread.so).

/home/dlr-sr-faz/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/…/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc -fPIC -gsplit-dwarf -DCHECK_FUNCTION_EXISTS=pthread_create -L/home/dlr-sr-faz/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/lib-target -L/home/dlr-sr-faz/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/targetfs/lib/aarch64-linux-gnu -Wl,-rpath,/home/dlr-sr-faz/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/lib-target -L/home/dlr-sr-faz/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/lib-target -L/home/dlr-sr-faz/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/targetfs/lib/aarch64-linux-gnu -Wl,-rpath,/home/dlr-sr-faz/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/lib-target CMakeFiles/cmTC_a890c.dir/CheckFunctionExists.c.o -o cmTC_a890c -lpthreads
/home/dlr-sr-faz/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/…/lib/gcc/aarch64-linux-gnu/7.3.1/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find -lpthreads

Thanks for your reply. Where do I have to change this? In which file?

You can search “pthreads” in your project tree. I believe it’s just a typo.

Dear @VickNV,

I solved the problem.

Now, I am able to cross compile my code again. However, I still get the following warning:

/home/.../nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libEGL.so.1, needed by /usr/local/driveworks-2.2/targets/aarch64-Linux/lib/libnvinfer.so.5, not found (try using -rpath or -rpath-link)

Despite receiving the warning, the compilation does not throw an error. Should we be worried about this warning or can we ignore it in the future?

My previous post should be able to solve the warning. You can find libEGL.so.1 under the path I mentioned there.

Yes, I can find it there in the path you mentioned. But how can I include this correctly as a library searching path in the DRIVE software framework? In which file do I have to specify the searching path? In CMakeLists.txt? And how? That is what I am struggling with at the moment since the cmake structure is quite complex.

It should be in the file which you assigned to cmake with below option.

-DCMAKE_TOOLCHAIN_FILE=<your file>

Hi @VickNV,

I tried setting the library search path you mentioned above by adding the following to the Toolchain-V5L.cmake file (which is the file I assign to -DCMAKE_TOOLCHAIN_FILE):

set(CMAKE_LIBRARY_PATH ${LD_PATH} /home/dlr-sr-faz/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/lib/aarch64-linux-gnu)

However, I still get the warning above regarding libEGL.so.1. Did I set the library search path correctly? I just can’t seem to figure out how to set it and how to get rid of the warning. Could you maybe post how it is correctly set?

Thanks in advance.

Please search the library with below command:

$ sudo find ~/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux -iname ‘libEGL.so.1’

Then refer to /usr/local/driveworks/samples/cmake/Toolchain-V5L.cmake and then update below lines of it with the path you figured out previously (e.g. change targetfs to targetfs_a).

set(LD_PATH {VIBRANTE_PDK}/lib-target) set(LD_PATH_EXTRA {VIBRANTE_PDK}/targetfs/lib/aarch64-linux-gnu)

Dear @VickNV,

I did the following:

I found the path in which libEGL.so.1 is. It is in

~/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/lib/aarch64-linux-gnu

I copied this path and added it to the two lines you mentioned in the Toolchain-V5L.cmake which results in the following:

set(LD_PATH ${VIBRANTE_PDK}/lib-target ~/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/lib/aarch64-linux-gnu)

set(LD_PATH_EXTRA ${VIBRANTE_PDK}/targetfs/lib/aarch64-linux-gnu ~/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/lib/aarch64-linux-gnu)

However, when I try to compile it, it does not work. It throws a lot of different errors.

Is there any other way to resolve this problem?

You need to understand how /usr/local/driveworks/samples/cmake/Toolchain-V5L.cmake uses LD_PATH and LD_PATH_EXTRA to find the libEGL.so.1 and then you can manipulate your toolchain file accordingly. For example, you see “libEGL.so.1, needed by /usr/local/driveworks-2.2/targets/aarch64-Linux/lib/libnvinfer.so.5, not found (try using -rpath or -rpath-link)” so you should set CMAKE_SHARED_LINKER_FLAGS / CMAKE_MODULE_LINKER_FLAGS / CMAKE_EXE_LINKER_FLAGS with the paths.

If you can provide the package for my reproducing here, I can help you further.

Dear @VickNV,

yes, the Toolchain-V5L.cmake file is very complex and I am having a hard time completely understanding it. Therefore, I am extremely glad that you are helping me.

What do you mean by package? I am basically compiling the default samples with the default Toolchain-V5L.cmake file. I did not change anything. I am using it out-of-the-box. If you want, I can send you the Toolchain-V5L.cmake file.

Sorry that I didn’t know you are compling the default samples. If that’s the case, after installing DRIVE Software 10.0 you can browse file:///home/$USER/Documents/DRIVE_SW_10.0_References/DRIVE_Software/DRIVE_AV_doxy_files/dwx_samples_building_V5L.html and follow the steps there to cross compile the samples.

Below commands should work:

$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/usr/local/driveworks/samples/cmake/Toolchain-V5L.cmake -DVIBRANTE_PDK:STRING=$HOME/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_DDPX/DRIVEOS/drive-t186ref-linux /usr/local/driveworks/samples
$ make -j

Thanks!