riebl / vanetza

Open-source implementation of the ETSI C-ITS protocol stack
Other
205 stars 158 forks source link

Problem when running socktap for the first time #187

Closed lo-hei closed 1 year ago

lo-hei commented 1 year ago

Hi, i compiled Vanetza for a craton2 successfully. I copied the shared object files (*.so) from $HOME/vanetza-deps/libs onto the Craton2 to /usr/lib. The compiled socktap is in /home/user/vanetza/bin. libatlklocal_linux_u.so is in /usr/lib. When executing ./socktap i am getting following error:

root@autotalks:~/ext-fs/usr/bin# socktap socktap: /lib/libm.so.6: version GLIBC_2.29 not found (required by socktap) socktap: /home/root/ext-fs/usr/lib/libstdc++.so.6: version GLIBCXX_3.4.26 not found (required by socktap) socktap: /home/root/ext-fs/usr/lib/libstdc++.so.6: version GLIBCXX_3.4.29 not found (required by socktap) socktap: /home/root/ext-fs/usr/lib/libstdc++.so.6: version CXXABI_1.3.13 not found (required by socktap) socktap: /lib/libc.so.6: version GLIBC_2.32 not found (required by socktap) socktap: /lib/libc.so.6: version GLIBC_2.34 not found (required by socktap)

@Irisbus maybe you know where my problem is? GLIB should be included in the poky-container, am i right? Maybe i am missing something or forgot to copy onto the CRATON2.

Thanks a lot

khevessy commented 1 year ago

My first guess is that you compile vanetza (socktap) against other version of Yocto than you are using on the Craton device. Since Autotalks SDK Release 18, they use Yocto 4.0.0, which uses glibc 2.35 (in contrast with previous version Yocto 3.x, that used an older glibc version AFAIK).

lo-hei commented 1 year ago

Sorry for that question but i just read the doc from Autotalks about Installing & Building CRATON2 SDK. From that after compiling the SDK localy on my Ubuntu PC, i just copied the libatlklocal_linux_u.so onto the EVK (CRATON2). But i guess this is not enough to have Yocto on the EVK, right? Should i run the poky installation script on the EVK (CRATON2), too?

Also, i am not sure where to put the .so files. I put them into /usr/lib, as mentioned above (not in /home/root/vanetza/lib) because otherwise i got an error while loading shared libraries: libboost_system.so.1.71.0: cannot open shared object file: No such file or directory error. In your Doc, the sentence "You should start the binary in the same directory as you would be running code from Autotalks examples (it needs their configuration files)" is a bit confusing to me.

Thanks for that quick response. I appreciate your work very much.

khevessy commented 1 year ago

Well I think you did everything you needed, poky installation script is not ran on the EVK.

As for the vanetza prerequisity libraries, if you put them in the /home/root/vanetza/lib directory, you must edit LD_LIBRARY_PATH varible (as per the Autotalks documents), e.g. like this: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:'/home/root/vanetza/lib'

Can you run the example applications from the SDK (diag-cli, v2x-example,...) on the device? If those are not working correctly, I would begin with that.

khevessy commented 1 year ago

the sentence "You should start the binary in the same directory as you would be running code from Autotalks examples (it needs their configuration files)" is a bit confusing

By this I mean that the socktap binary should be in the same directory where Autotalks configuration files are located (as they are fetched from the binary's current folder). This is also the directory where the SDK examples are located.

In the default state I believe that this is /usr/bin folder.

lo-hei commented 1 year ago

I copied socktap into /usr/bin and tried to run it there. The .so files are now in /usr/lib, but only the .so files from $HOME/vanetza-deps/libs, not all the other files from $HOME/vanetza-dist/libs. Right?

Still the same error _"GLIBC2.29/2.32/2.34 not found". diag-cli is running fine, but when i try to run the v2x-example i got

root@autotalks:/usr/bin# v2x-example v2x-example: error while loading shared libraries: libatlkpoti.so: cannot open shared object file: No such file or directory

I used SDK version 5.18 and the poky-container poky-craton2-glibc-x86_64-meta-toolchain-cortexa7t2hf-neon-atk42xx-evk-nand-toolchain-4.0.1 But i am not sure about the Yocto-Version on the EVK. Maybe that could be the problem? Is there a way to check wich Yocto Version is installed? And what would be the easiest way to update this?

Tanks a lot

khevessy commented 1 year ago

Do you really mean SDK version 5.18? Newest I was using was 5.17.0 (Release 18), AFAIK now the newest version is 5.17.1 (Release 18.1) which I have not tried yet. Maybe you have access to some newer version than me.

As for the v2x-example error, I cannot help you with that as I have never seen libatlkpoti.so. If it was libpoti.so, I would say you forgot to copy the file to the Craton filesystem. Maybe this is some new thing in the newer SDK Release?

I would think you have the correct Yocto version as diag-cli is running fine. If you want to update the board, you would have to flash the whole filesystem using the STA Flash Loader application (but you had to do this the first time you got the board, no?). Check for version: root@autotalks:~# cat /proc/version

I still think that cause of the original problem may be that you are linking the executable against wrong libc version (e.g. /tools/gcc/arm/poky-st/4.0.1/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/lib/libc.so.6 on your computer (if you use this directory) is other version than /lib/libc.so.6 on Craton).

On Craton:

lo-hei commented 1 year ago

Yeah, it is a newer release. I switched to Release 18 (SDK 5.17) but still same Problem. But thanks a lot for your help.

root@autotalks:~# cat /proc/version Linux version 4.19.102 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Thu Dec 30 14:58:55 UTC 2021

root@autotalks:~# /lib/libc.so.6 GNU C Library (GNU libc) stable release version 2.28. 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. Compiled by GNU CC version 8.2.0. libc ABIs: UNIQUE ABSOLUTE For bug reporting instructions, please see: http://www.gnu.org/software/libc/bugs.html.

_root@autotalks:~# echo $LD_LIBRARYPATH /lib:/usr/lib:/home/root/ext-fs/lib:/home/root/ext-fs/usr/lib

The LD_LIBRARY_PATH seems to reset after every reboot. I added the Vanetza-Path multiple times, but after every reboot it is back to the paths printed above. To be sure: To replace an old libatlklocal_linux_u.so i have to paste the new one in /home/root/ext-fs/system-setup/usr/lib/ and run the sync command? Do i need a new flash of the YOCTO-Build with this lib in "<yocto root>/craton2-yocto-build/extensions/usr/lib? I have to say that i received the device with pre-flashed YOCTO and LINUX from Autotalks, so i did not had to flash anything on it.

khevessy commented 1 year ago

See my first response.

My first guess is that you compile vanetza (socktap) against other version of Yocto than you are using on the Craton device. Since Autotalks SDK Release 18, they use Yocto 4.0.0, which uses glibc 2.35 (in contrast with previous version Yocto 3.x, that used an older glibc version AFAIK).

You have an old Yocto version installed. From the Linux kernel version 4.19.102 and glibc 2.28, you can see that on Craton you are indeed not using Yocto 4.0.0 and missing glibc 2.35 which you are linking your app to.

I switched to Release 18 (SDK 5.17) but still same Problem.

As Release 18 already uses Yocto 4.0.0, I believe you would have to switch to Release 17 in order to work without reflashing Craton.

The LD_LIBRARY_PATH seems to reset after every reboot.

That's normal

Do i need a new flash of the YOCTO-Build

You will have to either link to correct version of Poky toolchain (e.g. switch to the older SDK) or flash the whole system on Craton, yes. Honestly, I am surprised how diag-cli was even running for you.

lo-hei commented 1 year ago

Okay thanks for your help. Then i will try to flash a new YOCTO Verison on my EVK. Hopefully that will solve the Problem. One last question. Where do i find the EVK Configuration file, which i should select in the STA Flasher? Sorry, i don't get it...

khevessy commented 1 year ago

Where do i find the EVK Configuration file

If you are building Yocto manually, it will be copied to the output directory according to your selected hardware configuration. If you are using Autotalks pre-built image, it is right there in the folder with binaries. I got the software through another supplier than Autotalks so it may be a little bit different (we were using Murata evaluation board).

This is my last response about flashing the EVK. It is not relevant for Vanetza in any way and this is not Autotalks support forum.

lo-hei commented 1 year ago

I'm sorry, you're absolutely right. I would like to apologize for my last question. After a few days of work I installed the new Yocto version on the EVK and the socketap application starts up. Unfortunately, when selecting the Autotalks-Link-Layer i receive the error

./socktap: symbol lookup error: ./socktap: undifined symbol: atlk_err_mg_init

I would think that is due to the initialization in the socktap example, which i had to copy from the main() function of the "basic SDK example". Maybe I did something wrong here. I am not sure what i have to copy from v2x-example.c. If i copy the variables and the "Reference system initialization" it seems not to be enough.

khevessy commented 1 year ago

Could you please delete the initialization code from your comment? I did not put it to the example in purpose, it may not be a real problem but I believe it is Autotalks proprietary code, so I fear sharing it online...

Anyway, when you remove the initialization code, does the issue disappear? Also, which SDK version did you end up using, version 5.18? Try to run socktap from the same directory where you would run v2x-example. If this does not help, I think that the issue may come from the fact that in the newer SDK version, there are some other object files or libraries that the project must be linked against in order to run correctly (I do not know however, why the compilation doesn't fail with some linker error?). I know that when migrating to Release 18, I encountered similar issues of missing some symbols. Unfortunately, because as I already said, we for some reason do not have access to the SDK 5.18, I cannot give you a detailed solution. As I think that this must be some needed dynamic library or missing object file, I would do the following:

When you are building the SDK examples using make command, instead of make, do make dry run -- make -n. E.g. instead of

make -C output.cr2_lnx/armv7-32/examples/common/communications/

do

make -C output.cr2_lnx/armv7-32/examples/common/communications/ -n

Look at the output and find for example linking step of v2x-example (after line echo [LD.armv7-32] v2x-example). Look at the .o files that are linked together. Are there any other files than the ones that are set to variable AUTOTALKS_OBJECTS in cmake/FindAutotalks.cmake? Try to add them there and recompile the project. Are there linked any .so or .a (using -l or -L) files except those added using add_library()? Try to add them there and recompile the project (NB that -L and -l crops away lib and .a/.so from the files - e.g. libtommath.a becomes tommath - you probably know that but just to be sure).

If this does not help, I would try to search for atlk_err_mg_init (if it is like that, sometimes you are missing some letters) in the library code to try to locate that symbol. In the SDK directory, do something like grep -rn . -e "atlk_err_mg_init", this may help you find the right module and help further debugging.

Last way would be to use some tool like nm on the dynamic libraries or ar on static libraries (poky variants of course), to find where the symbol is really located.

lo-hei commented 1 year ago

I would like to conclude this issue by thanking you for your fantastic help and briefly summarizing the points at which it failed for me. Maybe someone will have similar problems in the future.

For many the steps will be self-evident, but if someone is new to working with the Autotalks EVKs (like me) this information might be useful. Thanks again @Irisbus for the help.

khevessy commented 1 year ago

You're welcome, glad you solved your issues!