elfmz / far2l

Linux port of FAR v2
GNU General Public License v2.0
1.8k stars 174 forks source link

dd/openwrt adoption #1438

Closed unxed closed 1 year ago

unxed commented 2 years ago

problem building under vanilla buildroot #1438

Config.in: Config.tar.gz

Target: MIPS big endian, uClibc

[ 39%] Building CXX object WinPort/CMakeFiles/WinPort.dir/src/Backend/SudoAskpassImpl.cpp.o
/dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/build/far2l-master/WinPort/src/sudo/sudo_client_api.cpp: In f
unction ‘int Sudo::sdc_futimes(int, const timeval*)’:
/dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/build/far2l-master/WinPort/src/sudo/sudo_client_api.cpp:610:9
: error: ‘futimes’ was not declared in this scope; did you mean ‘lutimes’?
  610 |  return futimes(fd, tv);
      |         ^~~~~~~
      |         lutimes
[ 39%] Building CXX object WinPort/CMakeFiles/WinPort.dir/src/Backend/FSClipboardBackend.cpp.o
make[4]: *** [WinPort/CMakeFiles/WinPort.dir/build.make:297: WinPort/CMakeFiles/WinPort.dir/src/sudo/sudo_client_api.cpp.o]
Error 1
make[4]: *** Waiting for unfinished jobs....
/dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/build/far2l-master/WinPort/src/Backend/WinPortMain.cpp: In fu
nction ‘int TTYTryReviveSome(int, int, bool, std::unique_ptr<TTYRawMode>&, pid_t&)’:
/dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/build/far2l-master/WinPort/src/Backend/WinPortMain.cpp:174:33
: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’}
[-Wformat=]
  174 |    fprintf(f_out, " \x1b[1;31m%lu\x1b[39;22m: %s\n", i + 1, instances[i].info.c_str());
      |                               ~~^                    ~~~~~
      |                                 |                      |
      |                                 long unsigned int      size_t {aka unsigned int}
      |                               %u
make[3]: *** [CMakeFiles/Makefile2:538: WinPort/CMakeFiles/WinPort.dir/all] Error 2
make[3]: *** Waiting for unfinished jobs....
[ 39%] Linking CXX executable ../install/Plugins/NetRocks/plug/NetRocks-SFTP.broker
[ 39%] Built target NetRocks-SFTP
make[2]: *** [Makefile:152: all] Error 2
make[1]: *** [package/pkg-generic.mk:293: /dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/build/far2l-master/
.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2
unxed commented 2 years ago

And another one (fixed by #1439):

[ 61%] Building CXX object far2l/CMakeFiles/far2l.dir/src/base/SafeMMap.cpp.o
[ 61%] Building CXX object far2l/CMakeFiles/far2l.dir/src/base/farqueue.cpp.o
/dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/build/far2l-master/far2l/src/base/SafeMMap.cpp:10:11: fatal e
rror: execinfo.h: No such file or directory
   10 | # include <execinfo.h>
      |           ^~~~~~~~~~~~
compilation terminated.
[ 61%] Building CXX object far2l/CMakeFiles/far2l.dir/src/base/FARString.cpp.o
make[4]: *** [far2l/CMakeFiles/far2l.dir/build.make:1662: far2l/CMakeFiles/far2l.dir/src/base/SafeMMap.cpp.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [CMakeFiles/Makefile2:649: far2l/CMakeFiles/far2l.dir/all] Error 2
make[2]: *** [Makefile:152: all] Error 2
make[1]: *** [package/pkg-generic.mk:293: /dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/build/far2l-master/
.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2
unxed commented 2 years ago

And one more:

[ 41%] Linking CXX executable ../install/far2l
/dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/host/lib/gcc/mips-buildroot-linux-uclibc/10.4.0/../../../../m
ips-buildroot-linux-uclibc/bin/ld: CMakeFiles/far2l.dir/src/plug/PluginA.cpp.o: in function `FarCharTableA(int, char*, int)'
:
PluginA.cpp:(.text._Z13FarCharTableAiPci+0x98): undefined reference to `_toupper'
/dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/host/lib/gcc/mips-buildroot-linux-uclibc/10.4.0/../../../../m
ips-buildroot-linux-uclibc/bin/ld: PluginA.cpp:(.text._Z13FarCharTableAiPci+0xa8): undefined reference to `_toupper'
/dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/host/lib/gcc/mips-buildroot-linux-uclibc/10.4.0/../../../../m
ips-buildroot-linux-uclibc/bin/ld: PluginA.cpp:(.text._Z13FarCharTableAiPci+0xb8): undefined reference to `_tolower'
/dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/host/lib/gcc/mips-buildroot-linux-uclibc/10.4.0/../../../../m
ips-buildroot-linux-uclibc/bin/ld: PluginA.cpp:(.text._Z13FarCharTableAiPci+0xbc): undefined reference to `_tolower'
collect2: error: ld returned 1 exit status
make[4]: *** [far2l/CMakeFiles/far2l.dir/build.make:2247: install/far2l] Error 1
make[3]: *** [CMakeFiles/Makefile2:649: far2l/CMakeFiles/far2l.dir/all] Error 2
make[2]: *** [Makefile:152: all] Error 2
make[1]: *** [package/pkg-generic.mk:293: /dat/storage/content/temp/buildroot/buildroot-2022.02.7/output/build/far2l-master/
.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2
unxed commented 2 years ago

Finally managed to build, but it segfaults at start :( Maybe it's due to different version of uClibc? Router has ld-uClibc.so.0, and buildroot build has ld-uClibc.so.1 And I can't figure out how to specify uClibc version for be used in buildroot settings.

elfmz commented 2 years ago

it makes sense try to get working under some qemu/uclibc and only then move to big endian hardware (as i dont know how to build run under qemu something bigendianess built with buildroot.. seems there is no such ready to use configuration

unxed commented 2 years ago

Successfully built far2l under buildroot with uClibc for x86_64, tested on QEMU. Works fine, screenshot below. So segfault at start on MIPS big endian router is probably not uClibc problem. Either it is caused by uClibc version mismatch (do not know how to select exact version to use in buildroot config) or endianess problem.

изображение

unxed commented 2 years ago

Had to apply two changes: 1) change return futimes(fd, tv); to return 0; in sudo_client_api.cpp (ugly, but I do not need sudo on router at all) 2) change

            TableSet->UpperTable[i] = _toupper(i);
            TableSet->LowerTable[i] = _tolower(i);

to

            TableSet->UpperTable[i] = toupper(i);
            TableSet->LowerTable[i] = tolower(i);

in wrap.cpp

unxed commented 2 years ago

as i dont know how to build run under qemu something bigendianess built with buildroot.. seems there is no such ready to use configuration

What about this one?

unxed commented 2 years ago

What about this one?

Built for mips32r2_malta, starts ok in qemu. So segfault at start on my router not caused by endianess also. Probably uClibc version mismatch. Could not guess other reasons.

изображение

unxed commented 2 years ago

Other programs from the image I generated (such as ls) also crash with a segfault on my router (while working in the qemu). I tried to change path to the interpreter and libs using patchelf and LD_LIBRARY_PATH, slipping a set of libraries from the same image as program, but still segfaults. The architecture in router and in qemu is the same (mips 32 big endian). Can't figure out what could be the problem.

elfmz commented 2 years ago

But didn't you use buildroot dedicated to build dd-wrt from my first link in beginning? If its different buildroot then crash and misdependencies are not surprising...

unxed commented 2 years ago

Openwrt's buildroot has own package description language, not compatible with vanilla's one.

elfmz commented 2 years ago

looks like forked from extremely old version of buildroot I've built ddwrt as it comes of version v21.02.3 and it creates MIPS bins, however it uses musl as libc and libuclibc++ as libstdc++ thats interesting but is your device has same libs? musl libc can be recognized by running strings ..../libc.so |grep -i 'musl libc' Also can you do cat /usr/lib/os-release or find any other mention of version info? Here is os-release of what was created in my build:

NAME="OpenWrt"
VERSION="21.02.3"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 21.02.3"
VERSION_ID="21.02.3"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r16554-1d4dea6d4f"
OPENWRT_BOARD="ath79/generic"
OPENWRT_ARCH="mips_24kc"
OPENWRT_TAINTS="no-all"
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 21.02.3 r16554-1d4dea6d4f"
unxed commented 2 years ago

musl libc string not found in libc.so

/lib contains following files:

ld-uClibc.so.0         
libc.so.0              
libcrypt.so.0          
libdl.so.0             
libgcc_s.so.1          
libiw.so -> libiw.so.29
libiw.so.29            
libm.so.0              
libnvram.so            
libpthread.so.0        
librt.so.0             
libutil.so.0           
services.so            

/usr/lib/os-release not found, also no other files indicating OS/libc versions.

Web interface says:

TP-Link TL-WR941ND v2/v3
Firmware Version
DD-WRT v24-sp2 (04/01/13) std - build 21153
Kernel Version
Linux 3.5.7.9 #6324 Mon Apr 1 09:24:31 CEST 2013 mips 
CPU Model
Atheros AR9132 rev 2 (0xb9)  
unxed commented 2 years ago

Here is entire /lib, /usr/lib and some files from /bin. Hope it helps to determine libc used. tplink1043.tar.gz

unxed commented 2 years ago

Looks like there is no libstdc++ at all on my router. And the only one found in openwrt package database is GNU one: https://openwrt.org/packages/pkgdata/libstdcpp6

(as far as I know openwrt and dd-wrt packages are compatible as usual)

elfmz commented 1 year ago

far2l-wrt.zip try this. Its still used musl libc during compile, but may be it will work, if it so backward compatible..

unxed commented 1 year ago

Unfortunately not working.

1) it uses /lib/ld-musl-mips-sf.so.1 as loader, but no such file on router 2) /lib is read only on router, can not place arbitrary files there

unxed commented 1 year ago

may try on another dd-wrt router (also mips 32 be) that have musl-based firmware, but can not upload due to https://github.com/elfmz/far2l/issues/1434#issuecomment-1335507043

elfmz commented 1 year ago

ln -s ld-четаместь.so ld-musl-mips-sf.so.1 (врядли сработает но чебы и нет:))

unxed commented 1 year ago

так /lib только для чтения же. может, patchelf --set-interpreter тогда?

elfmz commented 1 year ago

можно и так (не знал про это)

unxed commented 1 year ago
  1. делаю patchelf --set-interpreter /lib/ld-uClibc.so.0 ./far2l (на локальном компе; понятно что на роутере никакого patchelf нет)
  2. ./far2l: can't load library 'libstdc++.so.6'
  3. копирую libuClibc++-0.2.5.so из архива в libstdc++.so.6 в ту же папку, запускаю как LD_LIBRARY_PATH=. ./far2l
  4. ./far2l: can't load library 'libc.so'
  5. копирую libc.so из архива в ту же папку
  6. сегфолт
elfmz commented 1 year ago

короче надо както переконфигуриьт этот билдрут на uclibc

unxed commented 1 year ago

Я так понял, openwrt и ddwrt где-то в районе 2015 перешли на musl, а у меня просто прошивка древняя. Проще всего было бы прошить более свежую, уже на musl, но это стрёмно, роутер в другой стране стоит, окирпичу - чинить будет некому(

Кажется, openwrt 15.05 ещё на uclibc, но где ейный билдрут взять? На гитхабе у них только с 17 года релизы тэгнуты

unxed commented 1 year ago

а, вот же она https://git.archive.openwrt.org/?p=15.05/openwrt.git;a=tree

git clone https://git.archive.openwrt.org/15.05/openwrt.git
unxed commented 1 year ago

сделал руками принудительное busybox=true в netrocks scp (кстати, mc на этот же хост ничего залить не может, виснет в конце). получилось соединиться с тем роутером, что на musl. запустил там сборку из архива выше, она потребовала libstdc++.so.6, подсунул ей libuClibc++-0.2.5.so из архива

получил вот чего:

Error relocating ./far2l: _ZNSs7reserveEj: symbol not found
Error relocating ./far2l: _ZNSt13runtime_errorC2EPKc: symbol not found
Error relocating ./far2l: _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE6assignEPKwj: symbol not found
Error relocating ./far2l: _ZNSs4swapERSs: symbol not found
Error relocating ./far2l: _ZNSs12_M_leak_hardEv: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE6appendEPKwj: symbol not found
Error relocating ./far2l: _ZNKSt12__basic_fileIcE7is_openEv: symbol not found
Error relocating ./far2l: _ZNSt6localeD1Ev: symbol not found
Error relocating ./far2l: _ZNKSbIwSt11char_traitsIwESaIwEE7compareEPKw: symbol not found
Error relocating ./far2l: _ZNSt6chrono3_V212steady_clock3nowEv: symbol not found
Error relocating ./far2l: _ZNSs9push_backEc: symbol not found
Error relocating ./far2l: _ZNKSbIwSt11char_traitsIwESaIwEE5rfindEwj: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEEC1ERKS2_: symbol not found
Error relocating ./far2l: _ZTISt11range_error: symbol not found
Error relocating ./far2l: _ZNSs4_Rep20_S_empty_rep_storageE: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEEC1EPKwRKS1_: symbol not found
Error relocating ./far2l: _ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base: symbol not found
Error relocating ./far2l: _ZNSo9_M_insertImEERSoT_: symbol not found
Error relocating ./far2l: _ZNSt18condition_variable10notify_oneEv: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE7reserveEj: symbol not found
Error relocating ./far2l: _ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE14_M_replace_auxEjjjw: symbol not found
Error relocating ./far2l: _ZNSs6assignEPKcj: symbol not found
Error relocating ./far2l: _ZNSs6assignERKSs: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEEC1EPKwjRKS1_: symbol not found
Error relocating ./far2l: _ZNSs14_M_replace_auxEjjjc: symbol not found
Error relocating ./far2l: _ZNSt12__basic_fileIcED1Ev: symbol not found
Error relocating ./far2l: _ZSt28_Rb_tree_rebalance_for_erasePSt18_Rb_tree_node_baseRS_: symbol not found
Error relocating ./far2l: _ZNKSt8__detail20_Prime_rehash_policy14_M_need_rehashEjjj: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE6appendERKS2_: symbol not found
Error relocating ./far2l: _ZSt25__throw_bad_function_callv: symbol not found
Error relocating ./far2l: _ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_: symbol not found
Error relocating ./far2l: _ZNSs9_M_mutateEjjj: symbol not found
Error relocating ./far2l: _ZNSt8__detail15_List_node_base4swapERS0_S1_: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEED1Ev: symbol not found
Error relocating ./far2l: _ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E: symbol not found
Error relocating ./far2l: _ZNKSs5rfindEPKcjj: symbol not found
Error relocating ./far2l: _ZNSt18condition_variableD1Ev: symbol not found
Error relocating ./far2l: _ZNSo9_M_insertIyEERSoT_: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE6resizeEjw: symbol not found
Error relocating ./far2l: _ZNSt8__detail15_List_node_base7_M_hookEPS0_: symbol not found
Error relocating ./far2l: _ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE12_M_leak_hardEv: symbol not found
Error relocating ./far2l: _ZNSt18condition_variableC1Ev: symbol not found
Error relocating ./far2l: _ZNSs6resizeEjc: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE4_Rep10_M_destroyERKS1_: symbol not found
Error relocating ./far2l: _ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base: symbol not found
Error relocating ./far2l: _ZNSs6appendEjc: symbol not found
Error relocating ./far2l: _ZNSs7replaceEjjPKcj: symbol not found
Error relocating ./far2l: _ZNKSs4findEPKcjj: symbol not found
Error relocating ./far2l: _ZNSs4_Rep10_M_destroyERKSaIcE: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEEaSEPKw: symbol not found
Error relocating ./far2l: _ZNKSbIwSt11char_traitsIwESaIwEE4findEPKwjj: symbol not found
Error relocating ./far2l: _ZNSs6insertEjPKcj: symbol not found
Error relocating ./far2l: _ZNSsC1ERKSsjj: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE9_M_mutateEjjj: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE7replaceEjjPKwj: symbol not found
Error relocating ./far2l: _ZNSt13basic_filebufIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode: symbol not found
Error relocating ./far2l: _ZNSsC1ERKSs: symbol not found
Error relocating ./far2l: _ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base: symbol not found
Error relocating ./far2l: _ZNSt11logic_errorC1EPKc: symbol not found
Error relocating ./far2l: _ZNSt11range_errorD1Ev: symbol not found
Error relocating ./far2l: _ZNSt6chrono3_V212system_clock3nowEv: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEEC1EjwRKS1_: symbol not found
Error relocating ./far2l: _ZNKSt5ctypeIcE13_M_widen_initEv: symbol not found
Error relocating ./far2l: _ZNSt18condition_variable10notify_allEv: symbol not found
Error relocating ./far2l: _ZNSt11range_errorC1EPKc: symbol not found
Error relocating ./far2l: _ZSt20__throw_system_errori: symbol not found
Error relocating ./far2l: _ZNSt8ios_baseC2Ev: symbol not found
Error relocating ./far2l: _ZNSbIwSt11char_traitsIwESaIwEE4swapERS2_: symbol not found
Error relocating ./far2l: _ZSt24__throw_out_of_range_fmtPKcz: symbol not found
Error relocating ./far2l: _ZSt16__throw_bad_castv: symbol not found
Error relocating ./far2l: _ZNSt8__detail15_List_node_base9_M_unhookEv: symbol not found
Error relocating ./far2l: _ZNSt13runtime_errorC1EPKc: symbol not found
Error relocating ./far2l: _ZSt18_Rb_tree_decrementPKSt18_Rb_tree_node_base: symbol not found
Error relocating ./far2l: _ZNSs5clearEv: symbol not found
Error relocating ./far2l: _ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RSbIS4_S5_T1_ES4_: symbol not found
unxed commented 1 year ago

а, вот же она https://git.archive.openwrt.org/?p=15.05/openwrt.git;a=tree

попытка что-то собрать под ней, правда, падает с таким сообщением:

freadahead.c: In function 'freadahead':
freadahead.c:91:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread,
 ungetc on your system, then report this to bug-gnulib."
   91 |  #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your s
ystem, then report this to bug-gnulib."
      |   ^~~~~
unxed commented 1 year ago

похоже, проблемка в совместимости с современным дистром, и собирать что-то в древнем openwrt надо на каком-нибудь дистрибутиве того времени :-/

unxed commented 1 year ago

Так понимаю, libstdc++.so.6 это GNU Standard C++ Library v3. То есть фар с gnu'шной либой плюсов слинковался. Только где её взять отдельно, пока не могу найти, а в самом роутере её нет

elfmz commented 1 year ago

да, искать бинарной совместимости в линуксах бесперспективная идея.. надо тупо билдиться под конкретный имаж

elfmz commented 1 year ago

или как вариант слинковать все статически

unxed commented 1 year ago

нашёл таки libstdcpp6 с виду подходящую, ща с ней попробую https://downloads.openwrt.org/snapshots/targets/ath79/generic/packages/libstdcpp6_11.3.0-4_mips_24kc.ipk

unxed commented 1 year ago

о, с ней уже теплее:

Error relocating ./libstdc++.so.6: __nanosleep_time64: symbol not found
Error relocating ./libstdc++.so.6: __gettimeofday_time64: symbol not found
Error relocating ./libstdc++.so.6: __fstat_time64: symbol not found
Error relocating ./libstdc++.so.6: __utimensat_time64: symbol not found
Error relocating ./libstdc++.so.6: __lstat_time64: symbol not found
Error relocating ./libstdc++.so.6: __stat_time64: symbol not found
Error relocating ./libstdc++.so.6: __clock_gettime64: symbol not found
unxed commented 1 year ago

а на это уже готовый ответ есть https://forum.openwrt.org/t/openssl-util-1-1-1l-1-error-relocating-usr-lib-libssl-so-1-1-time64-symbol-not-found/108861

Assuming that you are using a master snapshot: First guess is that your firmware has been compiled with the older musl C library 1.1.24 instead of the curent 1.2.2. The musl version upgrade in September changed the internal time handling from 32bit to 64bit even in the 32bit targets (like mipsel24)…

unxed commented 1 year ago

ЗАПУСТИЛСЯ! вот эта либа подошла https://archive.openwrt.org/releases/21.02.4/targets/ath79/generic/packages/libstdcpp6_8.4.0-3_mips_24kc.ipk

Кладем её в ту же папку, что и бинарник far2l, и делаем LD_LIBRARY_PATH=. ./far2l

unxed commented 1 year ago

Есть, правда, проблемка: не работает ввод. Ни клавиатурный, ни мышиный, никакой.

А с --nodetect ввод начинает работать. Хм, с экстеншнами какие-то проблемки, похоже. Из-за endianess, может?

elfmz commented 1 year ago

ага

elfmz commented 1 year ago

надо все переворачивать)

unxed commented 1 year ago

На роутере с uClibc фокус с подсовыванием libstdc++.so.6 не прокатывает, всё ещё сегфолтится. Впрочем, на это предлагаю забить, т.к. то, что у меня там дремучая прошивка — моя проблема, сильно приспичит — найду способ перепрошиться во что-нибудь посвежее.

А вот поправить экстеншны и выложить рецепт для сборки в openwrt buildroot было бы классно :)

elfmz commented 1 year ago

Так рецепт там выложен в той ссылке по сути. Вначале надо собрать сам имаж - это соберет тулчейн в том числе. Потом:

export PATH=/home/user/projects/br4wrt/openwrt/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/bin:$PATH
export STAGING_DIR=/home/user/projects/br4wrt/openwrt/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl

export CXX=mips-openwrt-linux-musl-g++
export CC=mips-openwrt-linux-musl-gcc
export LD=mips-openwrt-linux-musl-ld

cmake -DUSEUCD=OFF -DUSEWX=OFF -DCOLORER=OFF -DNETROCKS=OFF -DCMAKE_C_FLAGS="-D__MUSL__"  -DCMAKE_CXX_FLAGS="-D__MUSL__"  ../../far2l
make -j8

... пути и имена компилятора ~по вкусу~ согласно тому что соберется в имаже..

unxed commented 1 year ago

Вроде понятно :) Я-то думал про package-файл, как для ванильного buildroot сделан :)

elfmz commented 1 year ago

кстати изза big endian поддержка архивов тоже будет такая себе) хотя если либархив там найдется - то то что ею реализовано - должно быть почти хорошо все

unxed commented 1 year ago

хм, с libarchive пока не разбирался, а простая попытка посмотреть что-то в .tar.gz дала такое: tar: unrecognized option: force-local

elfmz commented 1 year ago

так оно даже смогло зайти в архив? я удивлен

unxed commented 1 year ago

в zip не смогло — unexpected end of archive. в .tar.gz смогло, да

unxed commented 1 year ago

кстати, после вот этого «tar: unrecognized option: force-local», похоже, роутер перезагружается

elfmz commented 1 year ago

может память кончается? сколько там памяти физической?

unxed commented 1 year ago

32 MB, да, вполне может, я поэтому ничего кроме бинарника фара, либы плюсов и плагина мультиарка и не клал туда. ну и плюс языковые файлы, без которых не стартует

unxed commented 1 year ago

но если просто tar запустить без параметров в командной строке внутри фара — не перезагружается

unxed commented 1 year ago

в openwrt таки не собирается, макро __MUSL__ нету:

/dat/storage/content/temp/openwrt/build_dir/target-mips_24kc_musl/ubus-2022-06-01-0fd2e7d3/far2l/src/base/SafeMMap.cpp:10:11
: fatal error: execinfo.h: No such file or directory
   10 | # include <execinfo.h>
      |           ^~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.

https://wiki.musl-libc.org/faq.html

Q: Why is there no MUSL macro? It’s a bug to assume a certain implementation has particular properties rather than testing. So far, every time somebody’s asked for this with a particular usage case in mind, the usage case was badly wrong, and would have broken support for the next release of musl. The official explanation: http://openwall.com/lists/musl/2013/03/29/13

пришлось руками комментировать вот это:

# include <execinfo.h>
# define HAS_BACKTRACE

может, в правила cmake перенести проверку на наличие соответствующего хедера?