rdp / random-bug-reports

see issues
1 stars 0 forks source link

libsrt cross compile woze #33

Open rdp opened 6 months ago

rdp commented 6 months ago

CMake Error at CMakeLists.txt:1177 (get_filename_component): get_filename_component called with incorrect number of arguments

meant "you have to pass a cmake install path" like...have to... -DCMAKE_INSTALL_PREFIX=/a/b

rdp commented 6 months ago
x86_64-w64-mingw32-g++: error: unrecognized command-line option ‘-rdynamic’

actually meant "you compiled to i686 previously, apparently cmake isn't happy being run with new params" so git reset --hard && git clean -f or

clear your cmake cache too ... rm -rf CMakeFiles or just check entire repo out again... or add -DWIN32=1

rdp commented 5 months ago

cmake . -DCMAKE_SYSTEM_NAME=Windows -DENABLE_SHARED=OFF -DWITH_COMPILER_PREFIX=x86_64-w64-mingw32- -DENABLE_ENCRYPTION=OFF^C rdp@josh_awsome_pc:/mnt/d/sandbox/win64_static/sources/srt$ make [ 2%] Building CXX object CMakeFiles/srt_virtual.dir/srtcore/api.cpp.obj make[2]: x86_64-w64-mingw32-x86_64++-w64: No such file or directory

rdp commented 5 months ago

-- Checking for pthread_(g/s)etname_np in 'pthread.h': -- Looking for pthread_getname_np -- Looking for pthread_getname_np - found -- Looking for pthread_setname_np -- Looking for pthread_setname_np - found

this is just wrong, pthread.h has none of that, but seems benign? not if you have SSL enabled, see below:

rdp commented 5 months ago
/home/rdp/sandbox/win64_static/sources/srt/srtcore/threadname.h:140:21: error: no match for ‘operator==’ (operand types are ‘pthread_t’ {aka ‘ptw32_handle_t’} and ‘pthread_t’ {aka ‘ptw32_handle_t’})
  140 |             if (tid == pthread_self())
      |                 ~~~ ^~ ~~~~~~~~~~~~~~
      |                 |                  |
      |                 |                  pthread_t {aka ptw32_handle_t}
      |                 pthread_t {aka ptw32_handle_t}
In file included from /usr/share/mingw-w64/include/winnt.h:635,
                 from /usr/share/mingw-w64/include/minwindef.h:163,
                 from /usr/share/mingw-w64/include/windef.h:9,
                 from /usr/share/mingw-w64/include/windows.h:69,
                 from /usr/share/mingw-w64/include/winsock2.h:23,
                 from /home/rdp/sandbox/win64_static/sources/srt/srtcore/platform_sys.h:27,
                 from /home/rdp/sandbox/win64_static/sources/srt/srtcore/buffer_snd.cpp:53:
/usr/share/mingw-w64/include/guiddef.h:180:15: note: candidate: ‘bool operator==(const GUID&, const GUID&)’
  180 | __inline bool operator== (REFGUID guidOne, REFGUID guidOther) { return !!IsEqualGUID (guidOne, guidOther); }
      |               ^~~~~~~~
/usr/share/mingw-w64/include/guiddef.h:180:35: note:   no known conversion for argument 1 from ‘pthread_t’ {aka ‘ptw32_handle_t’} to ‘const GUID&’
  180 | __inline bool operator== (REFGUID guidOne, REFGUID guidOther) { return !!IsEqualGUID (guidOne, guidOther); }
      |                                   ^
/home/rdp/sandbox/win64_static/sources/srt/srtcore/threadname.h: In static member function ‘static bool srt::ThreadName::ThreadNameImpl::set(const char*)’:
/home/rdp/sandbox/win64_static/sources/srt/srtcore/threadname.h:107:20: error: ‘pthread_setname_np’ was not declared in this scope; did you mean ‘pthread_getunique_np’?
  107 |             return pthread_setname_np(pthread_self(), name) == 0;
      |                    ^~~~~~~~~~~~~~~~~~
      |                    pthread_getunique_np
/home/rdp/sandbox/win64_static/sources/srt/srtcore/threadname.h: In destructor ‘srt::ThreadName::ThreadNameImpl::~ThreadNameImpl(’:
/home/rdp/sandbox/win64_static/sources/srt/srtcore/threadname.h:140:21: error: no match for ‘operator==’ (operand types are ‘pthread_t’ {aka ‘ptw32_handle_t’} and ‘pthread_t’ {aka ‘ptw32_handle_t’})
  140 |             if (tid == pthread_self())
      |                 ~~~ ^~ ~~~~~~~~~~~~~~
      |                 |                  |
      |                 |                  pthread_t {aka ptw32_handle_t}
      |                 pthread_t {aka ptw32_handle_t}
In file included from /usr/share/mingw-w64/include/winnt.h:635,
                 from /usr/share/mingw-w64/include/minwindef.h:163,
                 from /usr/share/mingw-w64/include/windef.h:9,
                 from /usr/share/mingw-w64/include/windows.h:69,
                 from /usr/share/mingw-w64/include/winsock2.h:23,
                 from /home/rdp/sandbox/win64_static/sources/srt/srtcore/platform_sys.h:27,
                 from /home/rdp/sandbox/win64_static/sources/srt/srtcore/cache.cpp:42:
/usr/share/mingw-w64/include/guiddef.h:180:15: note: candidate: ‘bool operator==(const GUID&, const GUID&)’
  180 | __inline bool operator== (REFGUID guidOne, REFGUID guidOther) { return !!IsEqualGUID (guidOne, guidOther); }
      |               ^~~~~~~~

meant to do this:

  sed -i 's/^FindPThreadGetSetName/#FindPThreadGetSetName/' CMakeLists.txt # yikes, before running cmake
rdp commented 5 months ago
    ^
x86_64-w64-mingw32-gcc -Wl,--nxcompat,--dynamicbase -Wl,--high-entropy-va -Wl,--as-needed -Wl,--image-base,0x140000000 -I/home/rdp/new/sandbox/win64_static/build_files/include -I/home/rdp/new/sandbox/win64_static/build_files/include/srt -I/home/rdp/new/sandbox/win64_static/build_files/include -L/home/rdp/new/sandbox/win64_static/build_files/lib -o /tmp/ffconf.UOI54uMT/test.exe /tmp/ffconf.UOI54uMT/test.o -lsrt
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(srt_c_api.cpp.obj):srt_c_api.cpp:(.text+0x41): undefined reference to `operator delete(void*, unsigned long long)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(srt_c_api.cpp.obj):srt_c_api.cpp:(.text+0x64): undefined reference to `operator delete(void*, unsigned long long)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(srt_c_api.cpp.obj):srt_c_api.cpp:(.text+0x87): undefined reference to `operator delete(void*, unsigned long long)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(srt_c_api.cpp.obj):srt_c_api.cpp:(.text+0x25d): undefined reference to `operator delete[](void*)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(srt_c_api.cpp.obj):srt_c_api.cpp:(.text+0x28b): undefined reference to `operator delete(void*, unsigned long long)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(srt_c_api.cpp.obj):srt_c_api.cpp:(.text+0x674): undefined reference to `__cxa_guard_acquire'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(srt_c_api.cpp.obj):srt_c_api.cpp:(.text+0x6d3): undefined reference to `std::__cxx11::basic_string, std::allocator >::_M_assign(std::__cxx11::basic_string, std::allocator > const&)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(srt_c_api.cpp.obj):srt_c_api.cpp:(.text+0x6e4): undefined reference to `std::__cxx11::basic_string, std::allocator >::_M_assign(std::__cxx11::basic_string, std::allocator > const&)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(srt_c_api.cpp.obj):srt_c_api.cpp:(.text+0x6f5): undefined reference to `std::__cxx11::basic_string, std::allocator >::_M_assign(std::__cxx11::basic_string, std::allocator > const&)'

...
e to `__gxx_personality_seh0'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text$_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy[_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy]+0x99): undefined reference to `operator new(unsigned long long)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text$_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy[_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy]+0xd0): undefined reference to `std::__throw_length_error(char const*)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text$_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy[_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy]+0xdd): undefined reference to `__cxa_begin_catch'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text$_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy[_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy]+0xe7): undefined reference to `__cxa_rethrow'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text$_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy[_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy]+0xfd): undefined reference to `operator delete(void*, unsigned long long)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text$_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy[_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy]+0x107): undefined reference to `__cxa_end_catch'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.xdata$_ZNSt5dequeIbSaIbEE23_M_new_elements_at_backEy+0x10): undefined reference to `__gxx_personality_seh0'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text$_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St9_IdentityIS5_ESt4lessIS5_ESaIS5_EE24_M_get_insert_unique_posERKS5_[_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St9_IdentityIS5_ESt4lessIS5_ESaIS5_EE24_M_get_insert_unique_posERKS5_]+0x113): undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text$_ZSt23__copy_move_backward_a1ILb1EPN3srt16FECFilterBuiltin8RcvGroupES2_EN9__gnu_cxx11__enable_ifIXsrSt23__is_random_access_iterIT0_NSt15iterator_traitsIS7_E17iterator_categoryEE7__valueESt15_Deque_iteratorIT1_RSD_PSD_EE6__typeES7_S7_SG_[_ZSt23__copy_move_backward_a1ILb1EPN3srt16FECFilterBuiltin8RcvGroupES2_EN9__gnu_cxx11__enable_ifIXsrSt23__is_random_access_iterIT0_NSt15iterator_traitsIS7_E17iterator_categoryEE7__valueESt15_Deque_iteratorIT1_RSD_PSD_EE6__typeES7_S7_SG_]+0x117): undefined reference to `operator delete(void*, unsigned long long)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text$_ZSt14__copy_move_a1ILb1EPN3srt16FECFilterBuiltin8RcvGroupES2_EN9__gnu_cxx11__enable_ifIXsrSt23__is_random_access_iterIT0_NSt15iterator_traitsIS7_E17iterator_categoryEE7__valueESt15_Deque_iteratorIT1_RSD_PSD_EE6__typeES7_S7_SG_[_ZSt14__copy_move_a1ILb1EPN3srt16FECFilterBuiltin8RcvGroupES2_EN9__gnu_cxx11__enable_ifIXsrSt23__is_random_access_iterIT0_NSt15iterator_traitsIS7_E17iterator_categoryEE7__valueESt15_Deque_iteratorIT1_RSD_PSD_EE6__typeES7_S7_SG_]+0xfe): undefined reference to `operator delete(void*, unsigned long long)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text$_ZNSt5dequeIbSaIbEE6resizeEyRKb[_ZNSt5dequeIbSaIbEE6resizeEyRKb]+0xbd): undefined reference to `operator delete(void*, unsigned long long)'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.text.startup+0xc): undefined reference to `std::ios_base::Init::Init()'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.rdata$_ZTIN3srt19SrtPacketFilterBaseE[_ZTIN3srt19SrtPacketFilterBaseE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(fec.cpp.obj):fec.cpp:(.rdata$_ZTIN3srt16FECFilterBuiltinE[_ZTIN3srt16FECFilterBuiltinE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(logger_default.cpp.obj):logger_default:(.text+0x8): undefined reference to `std::ios_base::Init::~Init()'
/usr/bin/x86_64-w64-mingw32-ld: /home/rdp/new/sandbox/win64_static/build_files/lib/libsrt.a(logger_default.cpp.obj):logger_default:(.text.startup+0xc): undefined reference to `std::ios_base::Init::Init()'
collect2: error: ld returned 1 exit status
ERROR: srt >= 1.3.0 not found using pkg-config

meant "well, it's missing -lstdc++ but the reason is that it's using `pkg-config --libs srt` but it wants `pkg-config --static --libs srt` so passing that to ffmpeg configure fixes it. `--pkg-config-flags="--static"`            
rdp commented 5 months ago

/usr/bin/ld: /home/rdp/new/sandbox/linux_shared/build_files/lib/libsrt.a(core.cpp.o): warning: relocation against _ZTIi@@CXXABI_1.3' in read-only section.text.unlikely' /usr/bin/ld: /home/rdp/new/sandbox/linux_shared/build_files/lib/libsrt.a(srt_c_api.cpp.o): relocation R_X86_64_PC32 against symbol `_ZTTSt13basic_fstreamIcSt11char_traitsIcEE@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC

meant to add -DCMAKE_CXX_FLAGS="-fPIC"