Closed unxed closed 1 year 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
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
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.
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
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.
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
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?
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.
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.
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...
Openwrt's buildroot has own package description language, not compatible with vanilla's one.
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"
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)
Here is entire /lib, /usr/lib and some files from /bin. Hope it helps to determine libc used. tplink1043.tar.gz
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)
far2l-wrt.zip try this. Its still used musl libc during compile, but may be it will work, if it so backward compatible..
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
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
ln -s ld-четаместь.so ld-musl-mips-sf.so.1 (врядли сработает но чебы и нет:))
так /lib только для чтения же. может, patchelf --set-interpreter тогда?
можно и так (не знал про это)
patchelf --set-interpreter /lib/ld-uClibc.so.0 ./far2l
(на локальном компе; понятно что на роутере никакого patchelf нет)./far2l: can't load library 'libstdc++.so.6'
libuClibc++-0.2.5.so
из архива в libstdc++.so.6
в ту же папку, запускаю как LD_LIBRARY_PATH=. ./far2l
./far2l: can't load library 'libc.so'
libc.so
из архива в ту же папкукороче надо както переконфигуриьт этот билдрут на uclibc
Я так понял, openwrt и ddwrt где-то в районе 2015 перешли на musl, а у меня просто прошивка древняя. Проще всего было бы прошить более свежую, уже на musl, но это стрёмно, роутер в другой стране стоит, окирпичу - чинить будет некому(
Кажется, openwrt 15.05 ещё на uclibc, но где ейный билдрут взять? На гитхабе у них только с 17 года релизы тэгнуты
а, вот же она https://git.archive.openwrt.org/?p=15.05/openwrt.git;a=tree
git clone https://git.archive.openwrt.org/15.05/openwrt.git
сделал руками принудительное 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
а, вот же она 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."
| ^~~~~
похоже, проблемка в совместимости с современным дистром, и собирать что-то в древнем openwrt надо на каком-нибудь дистрибутиве того времени :-/
Так понимаю, libstdc++.so.6 это GNU Standard C++ Library v3. То есть фар с gnu'шной либой плюсов слинковался. Только где её взять отдельно, пока не могу найти, а в самом роутере её нет
да, искать бинарной совместимости в линуксах бесперспективная идея.. надо тупо билдиться под конкретный имаж
или как вариант слинковать все статически
нашёл таки libstdcpp6 с виду подходящую, ща с ней попробую https://downloads.openwrt.org/snapshots/targets/ath79/generic/packages/libstdcpp6_11.3.0-4_mips_24kc.ipk
о, с ней уже теплее:
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
а на это уже готовый ответ есть 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)…
ЗАПУСТИЛСЯ! вот эта либа подошла 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
Есть, правда, проблемка: не работает ввод. Ни клавиатурный, ни мышиный, никакой.
А с --nodetect ввод начинает работать. Хм, с экстеншнами какие-то проблемки, похоже. Из-за endianess, может?
ага
надо все переворачивать)
На роутере с uClibc фокус с подсовыванием libstdc++.so.6 не прокатывает, всё ещё сегфолтится. Впрочем, на это предлагаю забить, т.к. то, что у меня там дремучая прошивка — моя проблема, сильно приспичит — найду способ перепрошиться во что-нибудь посвежее.
А вот поправить экстеншны и выложить рецепт для сборки в openwrt buildroot было бы классно :)
Так рецепт там выложен в той ссылке по сути. Вначале надо собрать сам имаж - это соберет тулчейн в том числе. Потом:
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
... пути и имена компилятора ~по вкусу~ согласно тому что соберется в имаже..
Вроде понятно :) Я-то думал про package-файл, как для ванильного buildroot сделан :)
кстати изза big endian поддержка архивов тоже будет такая себе) хотя если либархив там найдется - то то что ею реализовано - должно быть почти хорошо все
хм, с libarchive пока не разбирался, а простая попытка посмотреть что-то в .tar.gz дала такое: tar: unrecognized option: force-local
так оно даже смогло зайти в архив? я удивлен
в zip не смогло — unexpected end of archive. в .tar.gz смогло, да
кстати, после вот этого «tar: unrecognized option: force-local», похоже, роутер перезагружается
может память кончается? сколько там памяти физической?
32 MB, да, вполне может, я поэтому ничего кроме бинарника фара, либы плюсов и плагина мультиарка и не клал туда. ну и плюс языковые файлы, без которых не стартует
но если просто tar запустить без параметров в командной строке внутри фара — не перезагружается
в 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 перенести проверку на наличие соответствующего хедера?
problem building under vanilla buildroot #1438
Config.in: Config.tar.gz
Target: MIPS big endian, uClibc