Dafang-Hacks / Main

140 stars 63 forks source link

migrate off uclibc #82

Open claud9999 opened 3 years ago

claud9999 commented 3 years ago

Per https://en.wikipedia.org/wiki/UClibc the uclibc library hasn't been updated since 2012. Folks on the 'nets' have suggested musl but there's also uclibc-ng.

claud9999 commented 3 years ago

Looks like there's a set of binaries for MIPS at https://musl.cc ...looking promising!

claud9999 commented 3 years ago

FYI I've been able to get all of the modules to build...but v4l2rtspserver fails to link with some obscure errors. I'm going back to see if I can cross-compile the original v4l2rtspserver and then figure out what's different here.

nik0 commented 3 years ago

What are the errors ?

claud9999 commented 3 years ago
/raid2/Main/mipsel-linux-musl-cross/bin/../lib/gcc/mipsel-linux-musl/10.2.1/../../../../mipsel-linux-musl/bin/ld: DWARF error: could not find variable specification at offset 6d5
/raid2/Main/mipsel-linux-musl-cross/bin/../lib/gcc/mipsel-linux-musl/10.2.1/../../../../mipsel-linux-musl/bin/ld: DWARF error: could not find variable specification at offset 6e0
/raid2/Main/mipsel-linux-musl-cross/bin/../lib/gcc/mipsel-linux-musl/10.2.1/../../../../mipsel-linux-musl/bin/ld: DWARF error: could not find variable specification at offset 738
/raid2/Main/mipsel-linux-musl-cross/bin/../lib/gcc/mipsel-linux-musl/10.2.1/../../../../mipsel-linux-musl/bin/ld: DWARF error: could not find variable specification at offset 764
/raid2/Main/mipsel-linux-musl-cross/bin/../lib/gcc/mipsel-linux-musl/10.2.1/../../../../mipsel-linux-musl/bin/ld: DWARF error: could not find variable specification at offset 797
/raid2/Main/mipsel-linux-musl-cross/bin/../lib/gcc/mipsel-linux-musl/10.2.1/../../../../mipsel-linux-musl/bin/ld: DWARF error: could not find variable specification at offset 7a2
libv4l2wrapper.a(logger.o): in function `__static_initialization_and_destruction_0(int, int)':
/raid2/Main/toolchain/mips-linux-gnu/include/c++/5.2.0/iostream:74:(.text+0x38): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
/raid2/Main/toolchain/mips-linux-gnu/include/c++/5.2.0/iostream:74:(.text+0x40): relocation R_MIPS_26 against `_ZNSt8ios_base4InitC1Ev@@GLIBCXX_3.4' cannot be used when making a shared object; recompile with -fPIC
/raid2/Main/toolchain/mips-linux-gnu/include/c++/5.2.0/iostream:74:(.text+0x48): relocation R_MIPS_HI16 against `__dso_handle' cannot be used when making a shared object; recompile with -fPIC
/raid2/Main/toolchain/mips-linux-gnu/include/c++/5.2.0/iostream:74:(.text+0x50): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
/raid2/Main/toolchain/mips-linux-gnu/include/c++/5.2.0/iostream:74:(.text+0x58): relocation R_MIPS_HI16 against `_ZNSt8ios_base4InitD1Ev@@GLIBCXX_3.4' cannot be used when making a shared object; recompile with -fPIC
/raid2/Main/toolchain/mips-linux-gnu/include/c++/5.2.0/iostream:74:(.text+0x60): relocation R_MIPS_26 against `__cxa_atexit' cannot be used when making a shared object; recompile with -fPIC
libv4l2wrapper.a(logger.o): in function `_GLOBAL__sub_I_LogLevel':
/raid2/Main/v4l2rtspserver-master/v4l2wrapper/src/logger.cpp:13:(.text+0x9c): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
/raid2/Main/mipsel-linux-musl-cross/bin/../lib/gcc/mipsel-linux-musl/10.2.1/../../../../mipsel-linux-musl/bin/ld: non-dynamic relocations refer to dynamic symbol __cxa_atexit
/raid2/Main/mipsel-linux-musl-cross/bin/../lib/gcc/mipsel-linux-musl/10.2.1/../../../../mipsel-linux-musl/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/v4l2rtspserver-master.dir/build.make:326: v4l2rtspserver-master] Error 1
make[2]: Leaving directory '/raid2/Main/v4l2rtspserver-master'
make[1]: *** [CMakeFiles/Makefile2:135: CMakeFiles/v4l2rtspserver-master.dir/all] Error 2
make[1]: Leaving directory '/raid2/Main/v4l2rtspserver-master'
make: *** [Makefile:130: all] Error 2
claud9999 commented 3 years ago

FYI I was able to cross-compile the v4l2rtspserver using musl, but clearly there've been some significant modifications for the Dafang project, including the integration with the T20 firmware blobs. From what I've seen, the "DWARF" errors may be issues with class variables or mis-match with class method definitions in headers and .cpp. Anyways, I can commit what I have so far to a branch if you'd like to take a crack.

$ file v4l2rtspserver
v4l2rtspserver: ELF 32-bit LSB shared object, MIPS, MIPS-I version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-mipsel.so.1, not stripped
$ git remote -v
origin  git@github.com:mpromonet/v4l2rtspserver (fetch)
origin  git@github.com:mpromonet/v4l2rtspserver (push)
claud9999 commented 3 years ago

FYI I pushed to https://github.com/claud9999/Main/tree/musl