srsran / srsRAN_4G

Open source SDR 4G software suite from Software Radio Systems (SRS) https://docs.srsran.com/projects/4g
https://www.srsran.com
GNU Affero General Public License v3.0
3.49k stars 1.15k forks source link

22.04 undefined reference to `typeinfo for srsenb::sched_nr_base_test_bench' #852

Open ZeroChaos- opened 2 years ago

ZeroChaos- commented 2 years ago

Config looks like this

cmake -C /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_UHD=yes -DENABLE_BLADERF=yes -DENABLE_SOAPYSDR=yes -DENABLE_ZEROMQ=yes -DENABLE_HARDSIM=yes -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/gentoo_toolchain.cmake /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04
loading initial cache file /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/gentoo_common_config.cmake
-- The C compiler identification is GNU 11.2.1
-- The CXX compiler identification is GNU 11.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_SYSTEM: Linux-5.17.3-pentoo
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- CMAKE_CXX_COMPILER: /usr/bin/x86_64-pc-linux-gnu-g++
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found PkgConfig: /usr/bin/x86_64-pc-linux-gnu-pkg-config (found version "1.8.0") 
-- Checking for module 'fftw3f >= 3.0'
--   Found fftw3f , version 3.3.10
-- FFTW3F LIBRARIES: /usr/lib64/libfftw3f.so
-- FFTW3F STATIC LIBRARIES: FFTW3F_STATIC_LIBRARY-NOTFOUND
-- FFTW3F INCLUDE DIRS: /usr/include
-- Found FFTW3F: /usr/lib64/libfftw3f.so  
-- FFT_LIBRARIES: /usr/lib64/libfftw3f.so
-- Checking for module 'polarssl'
--   Package 'polarssl', required by 'virtual:world', not found
-- POLARSSL LIBRARIES: POLARSSL_LIBRARIES-NOTFOUND
-- POLARSSL STATIC LIBRARIES: POLARSSL_STATIC_LIBRARIES-NOTFOUND
-- POLARSSL INCLUDE DIRS: POLARSSL_INCLUDE_DIRS-NOTFOUND
-- Could NOT find Polarssl (missing: POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS) 
-- Checking for module 'mbedtls'
--   Package 'mbedtls', required by 'virtual:world', not found
-- MBEDTLS LIBRARIES: /usr/lib64/libmbedcrypto.so
-- MBEDTLS STATIC LIBRARIES: MBEDTLS_STATIC_LIBRARIES-NOTFOUND
-- MBEDTLS INCLUDE DIRS: /usr/include
-- Found MbedTLS: /usr/lib64/libmbedcrypto.so  
-- Checking for module 'libpcsclite'
--   Found libpcsclite, version 1.9.0
-- Found PCSCLite: /usr/lib64/libpcsclite.so  
-- PCSC LIBRARIES: /usr/lib64/libpcsclite.so
-- PCSC INCLUDE DIRS: /usr/include/PCSC
-- Building with PCSC support.
-- UHD LIBRARIES /usr/lib64/libuhd.so
-- UHD INCLUDE DIRS /usr/include
-- Found UHD: /usr/lib64/libuhd.so  
-- Performing Test UHD_ENABLE_X300_FW_RESET
-- Performing Test UHD_ENABLE_X300_FW_RESET - Failed
-- Performing Test UHD_ENABLE_RFNOC
-- Performing Test UHD_ENABLE_RFNOC - Failed
-- Performing Test UHD_ENABLE_CUSTOM_RFNOC
-- Performing Test UHD_ENABLE_CUSTOM_RFNOC - Failed
-- SKIQ LIBRARIES SKIQ_LIBRARY-NOTFOUNDSKIQ_LIBRARY_GLIB-NOTFOUNDSKIQ_LIBRARY_USB-NOTFOUND/usr/lib/libtirpc.so.3
-- SKIQ INCLUDE DIRS SKIQ_INCLUDE_DIRS-NOTFOUND
-- Could NOT find SKIQ (missing: SKIQ_INCLUDE_DIRS) 
-- Checking for module 'libbladeRF'
--   Found libbladeRF, version 2.4.0-2021.03
-- Looking for bladerf_get_board_name in bladeRF
-- Looking for bladerf_get_board_name in bladeRF - found
-- Found libbladeRF: /usr/include, /usr/lib64/libbladeRF.so
-- FINDING SOAPY.
-- Checking for module 'SoapySDR'
--   Found SoapySDR, version 0.7.2
-- Found libSOAPYSDR: /usr/include, /usr/lib64/libSoapySDR.so
-- FINDING ZEROMQ.
-- Checking for module 'ZeroMQ'
--   Package 'ZeroMQ', required by 'virtual:world', not found
-- Found libZEROMQ: /usr/include, /usr/lib64/libzmq.so
-- Found Boost: /usr/lib64/cmake/Boost-1.78.0/BoostConfig.cmake (found suitable version "1.78.0", minimum required is "1.35") found components: program_options system 
-- SRSGUI LIBRARIES SRSGUI_LIBRARIES-NOTFOUND
-- SRSGUI INCLUDE DIRS SRSGUI_INCLUDE_DIRS-NOTFOUND
-- Could NOT find SRSGUI (missing: SRSGUI_LIBRARIES SRSGUI_INCLUDE_DIRS) 
-- Found libdw: /usr/lib64/libdw.so  
-- Found libbfd: /usr/lib64/libbfd.so  
-- Could NOT find libdwarf (missing: LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR) 
-- Found Backward: /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/cmake/modules  
-- Building with backward-cpp support
-- Performing Test HAVE_WNO_UNUSED_BUT_SET_VARIABLE
-- Performing Test HAVE_WNO_UNUSED_BUT_SET_VARIABLE - Success
-- Performing Test HAVE_SSE
-- Performing Test HAVE_SSE - Success
-- SSE4.1 is enabled - target CPU must support it
-- Performing Test HAVE_AVX
-- Performing Test HAVE_AVX - Success
-- AVX is enabled - target CPU must support it
-- Performing Test HAVE_AVX2
-- Performing Test HAVE_AVX2 - Success
-- AVX2 is enabled - target CPU must support it
-- Performing Test HAVE_FMA
-- Performing Test HAVE_FMA - Success
-- FMA is enabled - target CPU must support it
-- Performing Test HAVE_AVX512
-- Performing Test HAVE_AVX512 - Failed
-- Performing Test HAVE_MARCH_native
-- Performing Test HAVE_MARCH_native - Success
-- Performing Test HAVE_VISIBILITY_HIDDEN_CXX
-- Performing Test HAVE_VISIBILITY_HIDDEN_CXX - Success
-- Performing Test HAVE_ERROR_INCOMPATIBLE
-- Performing Test HAVE_ERROR_INCOMPATIBLE - Success
-- SSE4.1 is enabled - target CPU must support it
-- AVX is enabled - target CPU must support it
-- AVX2 is enabled - target CPU must support it
-- FMA is enabled - target CPU must support it
-- Performing Test HAVE_VISIBILITY_HIDDEN_C
-- Performing Test HAVE_VISIBILITY_HIDDEN_C - Success
-- Performing Test HAVE_DIAGNOSTIC_COLOR_C
-- Performing Test HAVE_DIAGNOSTIC_COLOR_C - Success
-- Performing Test HAVE_DIAGNOSTIC_COLOR_CXX
-- Performing Test HAVE_DIAGNOSTIC_COLOR_CXX - Failed
-- CMAKE_C_FLAGS is -Os -march=native -mtune=native -pipe -frecord-gcc-switches -march=native -Werror=incompatible-pointer-types -Wall -Wno-comment -Wno-write-strings -Wno-unused-result -Wformat -Wmissing-field-initializers -Wtype-limits -std=c99 -fno-strict-aliasing -D_GNU_SOURCE -Wno-unused-but-set-variable -ggdb -DBUILD_TYPE_RELWITHDEBINFO -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE -mfma -DLV_HAVE_FMA -Ofast -funroll-loops -fvisibility=hidden -fdiagnostics-color=always --param large-function-growth=1600
-- CMAKE_CXX_FLAGS is -Os -march=native -mtune=native -pipe -frecord-gcc-switches -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++14 -fno-strict-aliasing -Wno-unused-but-set-variable -march=native -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE -fvisibility=hidden -ggdb -DBUILD_TYPE_RELWITHDEBINFO
-- Using install prefix: /usr
-- Building for version: 22.04.0
--    examples will be installed.
-- Checking for module 'sctp'
--   Package 'sctp', required by 'virtual:world', not found
-- SCTP LIBRARIES: /usr/lib64/libsctp.so
-- SCTP INCLUDE DIRS: /usr/include
-- Found SCTP: /usr/lib64/libsctp.so  
-- No post-build command defined
-- No post-build command defined
-- Building with srsUE
-- No post-build command defined
-- No post-build-UE command defined
-- Building with srsENB/srsGNB
-- Found LibConfig++: /usr/lib64/libconfig++.so
-- static LibConfig++ path: LIBCONFIGPP_STATIC_LIBRARY-NOTFOUND
-- Found LibConfig: /usr/lib64/libconfig.so
-- static LibConfig path: LIBCONFIG_STATIC_LIBRARY-NOTFOUND
-- Checking for module 'sctp'
--   Package 'sctp', required by 'virtual:world', not found
-- SCTP LIBRARIES: /usr/lib64/libsctp.so
-- SCTP INCLUDE DIRS: /usr/include
-- No post-build-ENB command defined
-- Building with srsEPC
-- Found LibConfig++: /usr/lib64/libconfig++.so
-- static LibConfig++ path: LIBCONFIGPP_STATIC_LIBRARY-NOTFOUND
-- Found LibConfig: /usr/lib64/libconfig.so
-- static LibConfig path: LIBCONFIG_STATIC_LIBRARY-NOTFOUND
-- Checking for module 'sctp'
--   Package 'sctp', required by 'virtual:world', not found
-- SCTP LIBRARIES: /usr/lib64/libsctp.so
-- SCTP INCLUDE DIRS: /usr/include
-- No post-build-EPC command defined
-- <<< Gentoo configuration >>>
Build type      RelWithDebInfo
Install path    /usr
Compiler flags:
C               -Os -march=native -mtune=native -pipe -frecord-gcc-switches -march=native -Werror=incompatible-pointer-types -Wall -Wno-comment -Wno-write-strings -Wno-unused-result -Wformat -Wmissing-field-initializers -Wtype-limits -std=c99 -fno-strict-aliasing -D_GNU_SOURCE -Wno-unused-but-set-variable -ggdb -DBUILD_TYPE_RELWITHDEBINFO -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE -mfma -DLV_HAVE_FMA -Ofast -funroll-loops -fvisibility=hidden -fdiagnostics-color=always --param large-function-growth=1600
C++             -Os -march=native -mtune=native -pipe -frecord-gcc-switches -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++14 -fno-strict-aliasing -Wno-unused-but-set-variable -march=native -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE -fvisibility=hidden -ggdb -DBUILD_TYPE_RELWITHDEBINFO
Linker flags:
Executable      -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0
Module          -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0
Shared          -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0

-- Configuring done

Build failure here:

[1023/1088] : && /usr/bin/x86_64-pc-linux-gnu-g++ -Os -march=native -mtune=native -pipe -frecord-gcc-switches -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++14 -fno-strict-aliasing -Wno-unused-but-set-variable -march=native -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE -fvisibility=hidden -ggdb -DBUILD_TYPE_RELWITHDEBINFO -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o -o srsgnb/src/stack/mac/test/sched_nr_parallel_test  -Wl,-rpath,/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/srsgnb/src/stack/mac/test  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsgnb/src/stack/mac/test/libsched_nr_test_suite.so  lib/src/common/libsrsran_common.a  lib/src/asn1/librrc_nr_asn1.a  /usr/lib64/libboost_program_options.so.1.78.0  /usr/lib64/libboost_system.so.1.78.0  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsenb/src/stack/mac/common/libsrsenb_mac_common.a  lib/src/mac/libsrsran_mac.a  lib/src/asn1/librrc_nr_asn1.a  lib/src/asn1/libasn1_utils.a  lib/src/common/libsrsran_common.a  lib/src/phy/libsrsran_phy.a  -lpthread  -lm  /usr/lib64/libfftw3f.so  lib/src/support/libsupport.a  lib/src/srslog/libsrslog.a  /usr/lib64/libmbedcrypto.so  /usr/lib64/libdw.so && :
FAILED: srsgnb/src/stack/mac/test/sched_nr_parallel_test 
: && /usr/bin/x86_64-pc-linux-gnu-g++ -Os -march=native -mtune=native -pipe -frecord-gcc-switches -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++14 -fno-strict-aliasing -Wno-unused-but-set-variable -march=native -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE -fvisibility=hidden -ggdb -DBUILD_TYPE_RELWITHDEBINFO -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o -o srsgnb/src/stack/mac/test/sched_nr_parallel_test  -Wl,-rpath,/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/srsgnb/src/stack/mac/test  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsgnb/src/stack/mac/test/libsched_nr_test_suite.so  lib/src/common/libsrsran_common.a  lib/src/asn1/librrc_nr_asn1.a  /usr/lib64/libboost_program_options.so.1.78.0  /usr/lib64/libboost_system.so.1.78.0  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsenb/src/stack/mac/common/libsrsenb_mac_common.a  lib/src/mac/libsrsran_mac.a  lib/src/asn1/librrc_nr_asn1.a  lib/src/asn1/libasn1_utils.a  lib/src/common/libsrsran_common.a  lib/src/phy/libsrsran_phy.a  -lpthread  -lm  /usr/lib64/libfftw3f.so  lib/src/support/libsupport.a  lib/src/srslog/libsrslog.a  /usr/lib64/libmbedcrypto.so  /usr/lib64/libdw.so && :
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `srsenb::sched_nr_tester::sched_nr_base_test_bench(srsenb::sched_nr_interface::sched_args_t const&, std::vector<srsenb::sched_nr_cell_cfg_t, std::allocator<srsenb::sched_nr_cell_cfg_t> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:38: undefined reference to `srsenb::sched_nr_base_test_bench::sched_nr_base_test_bench(srsenb::sched_nr_interface::sched_args_t const&, std::vector<srsenb::sched_nr_cell_cfg_t, std::allocator<srsenb::sched_nr_cell_cfg_t> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:38: undefined reference to `srsenb::sched_nr_base_test_bench::~sched_nr_base_test_bench()'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `srsenb::run_sched_nr_test(unsigned int)':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:101: undefined reference to `srsenb::sched_nr_base_test_bench::user_cfg(unsigned short, srsenb::sched_nr_ue_cfg_t const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:103: undefined reference to `srsenb::sched_nr_base_test_bench::run_slot(srsran::slot_point)'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:106: undefined reference to `srsenb::sched_nr_base_test_bench::stop()'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `srsenb::sched_nr_tester::~sched_nr_tester()':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:35: undefined reference to `srsenb::sched_nr_base_test_bench::~sched_nr_base_test_bench()'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o:(.data.rel.ro._ZTIN6srsenb15sched_nr_testerE[_ZTIN6srsenb15sched_nr_testerE]+0x10): undefined reference to `typeinfo for srsenb::sched_nr_base_test_bench'
collect2: error: ld returned 1 exit status

Seems to get a bit further than https://github.com/srsran/srsRAN/issues/835 , but still doesn't build. Is there a way to disable these tests that I'm missing? How do others build this successfully?

robertfalkenberg commented 2 years ago

Hi,

it seems there is an issue with a very recent GCC version. Your logs report

-- The C compiler identification is GNU 11.2.1
-- The CXX compiler identification is GNU 11.2.1

You could try to build with GCC <= 11.2.0 or Clang <= 13.0.1, which are the most recent versions that I have tested (on Archlinux).

ZeroChaos- commented 2 years ago

Clang 13.0.1 is available in Gentoo and the failure looks pretty similar

[1022/1088] : && /usr/lib/llvm/13/bin/clang++ -Os -march=native -mtune=native -pipe -frecord-gcc-switches -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++14 -fno-strict-aliasing -Wno-unused-but-set-variable -march=native -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE -fvisibility=hidden -ggdb -DBUILD_TYPE_RELWITHDEBINFO -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o -o srsgnb/src/stack/mac/test/sched_nr_parallel_test  -Wl,-rpath,/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/srsgnb/src/stack/mac/test  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsgnb/src/stack/mac/test/libsched_nr_test_suite.so  lib/src/common/libsrsran_common.a  lib/src/asn1/librrc_nr_asn1.a  /usr/lib64/libboost_program_options.so.1.78.0  /usr/lib64/libboost_system.so.1.78.0  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsenb/src/stack/mac/common/libsrsenb_mac_common.a  lib/src/mac/libsrsran_mac.a  lib/src/asn1/librrc_nr_asn1.a  lib/src/asn1/libasn1_utils.a  lib/src/common/libsrsran_common.a  lib/src/phy/libsrsran_phy.a  -lpthread  -lm  /usr/lib64/libfftw3f.so  lib/src/support/libsupport.a  lib/src/srslog/libsrslog.a  /usr/lib64/libmbedcrypto.so  /usr/lib64/libdw.so && :
FAILED: srsgnb/src/stack/mac/test/sched_nr_parallel_test 
: && /usr/lib/llvm/13/bin/clang++ -Os -march=native -mtune=native -pipe -frecord-gcc-switches -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++14 -fno-strict-aliasing -Wno-unused-but-set-variable -march=native -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE -fvisibility=hidden -ggdb -DBUILD_TYPE_RELWITHDEBINFO -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o -o srsgnb/src/stack/mac/test/sched_nr_parallel_test  -Wl,-rpath,/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/srsgnb/src/stack/mac/test  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsgnb/src/stack/mac/test/libsched_nr_test_suite.so  lib/src/common/libsrsran_common.a  lib/src/asn1/librrc_nr_asn1.a  /usr/lib64/libboost_program_options.so.1.78.0  /usr/lib64/libboost_system.so.1.78.0  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsenb/src/stack/mac/common/libsrsenb_mac_common.a  lib/src/mac/libsrsran_mac.a  lib/src/asn1/librrc_nr_asn1.a  lib/src/asn1/libasn1_utils.a  lib/src/common/libsrsran_common.a  lib/src/phy/libsrsran_phy.a  -lpthread  -lm  /usr/lib64/libfftw3f.so  lib/src/support/libsupport.a  lib/src/srslog/libsrslog.a  /usr/lib64/libmbedcrypto.so  /usr/lib64/libdw.so && :
/usr/bin/x86_64-pc-linux-gnu-ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `sched_nr_base_test_bench':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:38: undefined reference to `srsenb::sched_nr_base_test_bench::sched_nr_base_test_bench(srsenb::sched_nr_interface::sched_args_t const&, std::vector<srsenb::sched_nr_cell_cfg_t, std::allocator<srsenb::sched_nr_cell_cfg_t> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)'
/usr/bin/x86_64-pc-linux-gnu-ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `srsenb::run_sched_nr_test(unsigned int)':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:101: undefined reference to `srsenb::sched_nr_base_test_bench::user_cfg(unsigned short, srsenb::sched_nr_ue_cfg_t const&)'
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:103: undefined reference to `srsenb::sched_nr_base_test_bench::run_slot(srsran::slot_point)'
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:106: undefined reference to `srsenb::sched_nr_base_test_bench::stop()'
/usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:114: undefined reference to `srsenb::sched_nr_base_test_bench::~sched_nr_base_test_bench()'
/usr/bin/x86_64-pc-linux-gnu-ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `sched_nr_base_test_bench':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:38: undefined reference to `srsenb::sched_nr_base_test_bench::~sched_nr_base_test_bench()'
/usr/bin/x86_64-pc-linux-gnu-ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `srsenb::run_sched_nr_test(unsigned int)':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:114: undefined reference to `srsenb::sched_nr_base_test_bench::~sched_nr_base_test_bench()'
/usr/bin/x86_64-pc-linux-gnu-ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `~sched_nr_tester':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:35: undefined reference to `srsenb::sched_nr_base_test_bench::~sched_nr_base_test_bench()'
/usr/bin/x86_64-pc-linux-gnu-ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o:(.data.rel.ro._ZTVN6srsenb15sched_nr_testerE[_ZTVN6srsenb15sched_nr_testerE]+0x10): undefined reference to `srsenb::sched_nr_base_test_bench::~sched_nr_base_test_bench()'
/usr/bin/x86_64-pc-linux-gnu-ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o:(.data.rel.ro._ZTIN6srsenb15sched_nr_testerE[_ZTIN6srsenb15sched_nr_testerE]+0x10): undefined reference to `typeinfo for srsenb::sched_nr_base_test_bench'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
ZeroChaos- commented 2 years ago

So I just tested, and this bug seems to only pop up with -Os. If I compile with -O3 instead, I get https://github.com/srsran/srsRAN/issues/854

robertfalkenberg commented 2 years ago

I can see some external configurations being loaded, e.g.

cmake -C /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_UHD=yes -DENABLE_BLADERF=yes -DENABLE_SOAPYSDR=yes -DENABLE_ZEROMQ=yes -DENABLE_HARDSIM=yes -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/gentoo_toolchain.cmake /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04

and a few extra CC/CXX flags, (on the first sight for example -Os -march=native -mtune=native -pipe -frecord-gcc-switches)

Could you please also try to build without them? https://docs.srsran.com/en/latest/general/source/1_installation.html

ZeroChaos- commented 2 years ago

The gentoo override files are pretty dull and shouldn't be affecting anything. I can't build in the package manager without them afaik, but I'll include them here in case you see anything which might be problematic.

gentoo_common_config.cmake

set(CMAKE_GENTOO_BUILD ON CACHE BOOL "Indicate Gentoo package build")
set(LIB_SUFFIX 64 CACHE STRING "library path suffix" FORCE)
set(CMAKE_INSTALL_LIBDIR lib64 CACHE PATH "Output directory for libraries")
set(CMAKE_INSTALL_INFODIR "/usr/share/info" CACHE PATH "")
set(CMAKE_INSTALL_MANDIR "/usr/share/man" CACHE PATH "")
set(CMAKE_USER_MAKE_RULES_OVERRIDE "/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/gentoo_rules.cmake" CACHE FILEPATH "Gentoo override rules")
set(CMAKE_INSTALL_DOCDIR "/usr/share/doc/srsran-22.04" CACHE PATH "")
set(BUILD_SHARED_LIBS ON CACHE BOOL "")
set(CMAKE_INSTALL_ALWAYS 1)
set(CMAKE_ASM_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_ASM-ATT_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "")

gentoo_rules.cmake

set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES>  <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
set(CMAKE_ASM-ATT_COMPILE_OBJECT "<CMAKE_ASM-ATT_COMPILER> <DEFINES> <INCLUDES>  <FLAGS> -o <OBJECT> -c -x assembler <SOURCE>" CACHE STRING "ASM-ATT compile command" FORCE)
set(CMAKE_ASM-ATT_LINK_FLAGS "-nostdlib" CACHE STRING "ASM-ATT link flags" FORCE)
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES>  <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES>  <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
set(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> -Os -march=native -mtune=native -pipe -frecord-gcc-switches <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "Fortran compile command" FORCE)
ZeroChaos- commented 2 years ago

I removed my custom cflags from gentoo_rules.cmake and from the environment and rebuilt. I get an extremely similar error still

[1022/1088] : && /usr/bin/x86_64-pc-linux-gnu-g++ -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++14 -fno-strict-aliasing -Wno-unused-but-set-variable -march=native -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE -fvisibility=hidden -ggdb -DBUILD_TYPE_RELWITHDEBINFO -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o -o srsgnb/src/stack/mac/test/sched_nr_parallel_test  -Wl,-rpath,/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/srsgnb/src/stack/mac/test  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsgnb/src/stack/mac/test/libsched_nr_test_suite.so  lib/src/common/libsrsran_common.a  lib/src/asn1/librrc_nr_asn1.a  /usr/lib64/libboost_program_options.so.1.78.0  /usr/lib64/libboost_system.so.1.78.0  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsenb/src/stack/mac/common/libsrsenb_mac_common.a  lib/src/mac/libsrsran_mac.a  lib/src/asn1/librrc_nr_asn1.a  lib/src/asn1/libasn1_utils.a  lib/src/common/libsrsran_common.a  lib/src/phy/libsrsran_phy.a  -lpthread  -lm  /usr/lib64/libfftw3f.so  lib/src/support/libsupport.a  lib/src/srslog/libsrslog.a  /usr/lib64/libmbedcrypto.so  /usr/lib64/libdw.so  /usr/lib64/libsctp.so && :
FAILED: srsgnb/src/stack/mac/test/sched_nr_parallel_test 
: && /usr/bin/x86_64-pc-linux-gnu-g++ -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++14 -fno-strict-aliasing -Wno-unused-but-set-variable -march=native -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE -fvisibility=hidden -ggdb -DBUILD_TYPE_RELWITHDEBINFO -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o -o srsgnb/src/stack/mac/test/sched_nr_parallel_test  -Wl,-rpath,/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04_build/srsgnb/src/stack/mac/test  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsgnb/src/stack/mac/test/libsched_nr_test_suite.so  lib/src/common/libsrsran_common.a  lib/src/asn1/librrc_nr_asn1.a  /usr/lib64/libboost_program_options.so.1.78.0  /usr/lib64/libboost_system.so.1.78.0  srsgnb/src/stack/mac/libsrsgnb_mac.a  srsenb/src/stack/mac/common/libsrsenb_mac_common.a  lib/src/mac/libsrsran_mac.a  lib/src/asn1/librrc_nr_asn1.a  lib/src/asn1/libasn1_utils.a  lib/src/common/libsrsran_common.a  lib/src/phy/libsrsran_phy.a  -lpthread  -lm  /usr/lib64/libfftw3f.so  lib/src/support/libsupport.a  lib/src/srslog/libsrslog.a  /usr/lib64/libmbedcrypto.so  /usr/lib64/libdw.so  /usr/lib64/libsctp.so && :
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `srsenb::run_sched_nr_test(unsigned int)':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:101: undefined reference to `srsenb::sched_nr_base_test_bench::user_cfg(unsigned short, srsenb::sched_nr_ue_cfg_t const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:103: undefined reference to `srsenb::sched_nr_base_test_bench::run_slot(srsran::slot_point)'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:106: undefined reference to `srsenb::sched_nr_base_test_bench::stop()'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `srsenb::sched_nr_tester::sched_nr_base_test_bench(srsenb::sched_nr_interface::sched_args_t const&, std::vector<srsenb::sched_nr_cell_cfg_t, std::allocator<srsenb::sched_nr_cell_cfg_t> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:38: undefined reference to `srsenb::sched_nr_base_test_bench::sched_nr_base_test_bench(srsenb::sched_nr_interface::sched_args_t const&, std::vector<srsenb::sched_nr_cell_cfg_t, std::allocator<srsenb::sched_nr_cell_cfg_t> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:38: undefined reference to `srsenb::sched_nr_base_test_bench::~sched_nr_base_test_bench()'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o: in function `srsenb::sched_nr_tester::~sched_nr_tester()':
/var/tmp/portage/net-wireless/srsran-22.04/work/srsran-22.04/srsgnb/src/stack/mac/test/sched_nr_parallel_test.cc:35: undefined reference to `srsenb::sched_nr_base_test_bench::~sched_nr_base_test_bench()'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: srsgnb/src/stack/mac/test/CMakeFiles/sched_nr_parallel_test.dir/sched_nr_parallel_test.cc.o:(.data.rel.ro._ZTIN6srsenb15sched_nr_testerE[_ZTIN6srsenb15sched_nr_testerE]+0x10): undefined reference to `typeinfo for srsenb::sched_nr_base_test_bench'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
robertfalkenberg commented 2 years ago

Thanks for the feedback.

I could reproduce your build issue by adding BUILD_SHARED_LIBS=ON as configured by the gentoo_common_config.cmake you posted before.

I added a patch to fix the build process, regardless of whether that option is set or not. You can find the branch here: https://github.com/srsran/srsRAN/tree/fix_issue_852

Could you please confirm if this patch fixes the build process?

P.S. As an immediate workaround I suggest to set BUILD_SHARED_LIBS to OFF explicitly, e.g. append -DBUILD_SHARED_LIBS=OFF to the cmake args.

ZeroChaos- commented 2 years ago

Nice, confirmed that https://github.com/srsran/srsRAN/commit/2e1a7abfb313f874add9efa2cdd716dffd842782.patch fixes this. I'm retesting my other bugs but I am fairly certain they are all interelated and just happened to hit a failure at a slightly different point.