Dotnet core: Error relocating

I tried compiling a simple .NET Core hello world app for OpenWRT on ARM Cortex A7 using linux-musl-arm with the following command:

dotnet publish --configuration Release --runtime linux-musl-arm --self-contained

But i get the following error when i try to execute it:

root@Routeur:~/RutxApp# ./RutxApp
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERjj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_assignERKS4_: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEjjPKcj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEjjPKcj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcj: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5rfindEPKcjj: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5rfindEcj: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12find_last_ofEPKcjj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8_M_eraseEjj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE14_M_replace_auxEjjjc: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEcj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode: symbol not found
Error relocating ./RutxApp: _ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE17find_first_not_ofEPKcjj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev: symbol not found
Error relocating ./RutxApp: __time64: symbol not found
Error relocating ./RutxApp: __gmtime64: symbol not found
Error relocating ./RutxApp: __fstat_time64: symbol not found
Error relocating ./RutxApp: __dlsym_time64: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEPKcjj: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEjjRKS4_: symbol not found
Error relocating ./RutxApp: __fstatat_time64: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEjjPKc: symbol not found
Error relocating ./RutxApp: _ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE: symbol not found
Error relocating ./RutxApp: _ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE: symbol not found

I followed this tutorial : https://davidjmclaughlin.com/projects/how-to/2020/03/15/running-.net-core-on-openwrt-and-raspberry-pi-4.html and installed all required library but without success.

I'm trying to run this code on a RUTX11 from Teltonika

1 Like

Execute "ldd ./RutxApp" to check for missing libraries.

2 Likes

Thank you for your answer. When i execute "ldd ./RutxApp" i get the following message:

root@Routeur_VIGICAM:~/RutxApp# ldd ./RutxApp
        /lib/ld-musl-armhf.so.1 (0xb6ed6000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6e0e000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6df2000)
        libc.musl-armv7.so.1 => /lib/ld-musl-armhf.so.1 (0xb6ed6000)
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERjj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_assignERKS4_: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEjjPKcj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEjjPKcj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcj: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5rfindEPKcjj: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5rfindEcj: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12find_last_ofEPKcjj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8_M_eraseEjj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE14_M_replace_auxEjjjc: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEcj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode: symbol not found
Error relocating ./RutxApp: _ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE17find_first_not_ofEPKcjj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEj: symbol not found
Error relocating ./RutxApp: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev: symbol not found
Error relocating ./RutxApp: __time64: symbol not found
Error relocating ./RutxApp: __gmtime64: symbol not found
Error relocating ./RutxApp: __fstat_time64: symbol not found
Error relocating ./RutxApp: __dlsym_time64: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEPKcjj: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEjjRKS4_: symbol not found
Error relocating ./RutxApp: __fstatat_time64: symbol not found
Error relocating ./RutxApp: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEjjPKc: symbol not found
Error relocating ./RutxApp: _ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE: symbol not found
Error relocating ./RutxApp: _ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE: symbol not found
root@Routeur_VIGICAM:~/RutxApp#

I don't know what is missing...

Based on the 64bit time related errors, my first guess is that you are

  • using a newer musl 1.2.2 (or later) with 64bit time symbols in your Windows buildhost (and thus in your compiled program), but
  • using OpenWrt 21.02.x with the older musl 1.1.24 version with 32bit time handling.

If that is the reason, try 22.03.0-rc1 or master.

2 Likes

Hi Di you resolve this? (OpenWRT OS running dotnet core 6 runtime apps)

Having same issue with VS2022 dotnet SDK 6.0.402, OpenWRT 22.03.1 (and 22.02.4) , either when compiling as 'SelfContained' or when trying to launch a dotnet runtime (dotnet-runtime-6.0.10-linux-musl-arm64)

I found this suggesting it was fixed, but tried the lasted MASTER release from Repo and still same..
https://github.com/openwrt/openwrt/pull/5014#issuecomment-1024983626

I guess since this fix appears to be a Switch set during the build pipeline (which OpenWRT CI/DC system doesn't build for?) I might need to build the OpenWRT repo here locally?

Also
https://github.com/dotnet/sdk/issues/24448

2 Likes