Skip to content

Unrecognized command line option -rdynamic / undefined reference to `__global_pointer$' #3

Description

@gemenerik

Trying to cross-compile OpenCV 2.4 with this toolchain.

cmake -DCMAKE_BUILD_TYPE=Release-DBUILD_SHARED_LIBS=OFF -DCV_DISABLE_OPTIMIZATION=OFF -DWITH_IPP=OFF -DWITH_TBB=OFF -DWITH_OPENMP=OFF -DWITH_PTHREADS_PF=OFF -DWITH_QUIRC=OFF -DWITH_1394=OFF -DWITH_CUDA=OFF -DWITH_OPENCL=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_OPENCLAMDBLAS=OFF -DWITH_VA_INTEL=OFF -DWITH_EIGEN=OFF-DWITH_GSTREAMER=OFF -DWITH_GTK=OFF -DWITH_JASPER=OFF -DWITH_JPEG=OFF -DWITH_WEBP=OFF -DBUILD_ZLIB=ON-DBUILD_PNG=ON -DWITH_TIFF=OFF -DWITH_V4L=OFF -DWITH_LAPACK=OFF-DWITH_ITT=OFF -DWITH_PROTOBUF=OFF -DWITH_IMGCODEC_HDR=OFF -DWITH_IMGCODEC_SUNRASTER=OFF -DWITH_IMGCODEC_PXM=OFF -DWITH_IMGCODEC_PFM=OFF -DBUILD_LIST=core,imgproc,imgcodecs-DBUILD_JAVA=OFF-DBUILD_opencv_python=OFF -DBUILD_opencv_java=OFF -DBUILD_opencv_apps=OFF-DBUILD_PACKAGE=OFF-DBUILD_PERF_TESTS=OFF-DBUILD_TESTS=OFF-DCV_ENABLE_INTRINSICS=OFF-DCV_TRACE=OFF-DOPENCV_ENABLE_MEMALIGN=OFF -DCMAKE_C_COMPILER=/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-gcc -DCMAKE_CXX_COMPILER=/lib/gap_riscv_toolchain/bin/risc32-unknown-elf-g++ ..
I get the following error
-- The CXX compiler identification is GNU 7.1.1
-- The C compiler identification is GNU 7.1.1
-- Check for working CXX compiler: /usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++
-- Check for working CXX compiler: /usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++ -- broken
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCXXCompiler.cmake:53 (message):
  The C++ compiler

    "/usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/rik/opencv/build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/make cmTC_66644/fast && /usr/bin/make -f CMakeFiles/cmTC_66644.dir/build.make CMakeFiles/cmTC_66644.dir/build
    make[1]: Entering directory '/home/rik/opencv/build/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_66644.dir/testCXXCompiler.cxx.o
    /usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++     -o CMakeFiles/cmTC_66644.dir/testCXXCompiler.cxx.o -c /home/rik/opencv/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    Linking CXX executable cmTC_66644
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_66644.dir/link.txt --verbose=1
    /usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++       -rdynamic CMakeFiles/cmTC_66644.dir/testCXXCompiler.cxx.o  -o cmTC_66644 
    riscv32-unknown-elf-g++: error: unrecognized command line option '-rdynamic'
    make[1]: *** [CMakeFiles/cmTC_66644.dir/build.make:87: cmTC_66644] Error 1
    make[1]: Leaving directory '/home/rik/opencv/build/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_66644/fast] Error 2
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:64 (project)


-- Configuring incomplete, errors occurred!
See also "/home/rik/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/home/rik/opencv/build/CMakeFiles/CMakeError.log".

CMakeError.log

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++ 
Build flags: 
Id flags:  

The output was:
1
/usr/lib/gap_riscv_toolchain/bin/../lib/gcc/riscv32-unknown-elf/7.1.1/../../../../riscv32-unknown-elf/lib/rv32imcxgap9/ilp32/crt0.o: In function `_start':
(.text+0x8): undefined reference to `__global_pointer$'
collect2: error: ld returned 1 exit status


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-gcc 
Build flags: 
Id flags:  

The output was:
1
/usr/lib/gap_riscv_toolchain/bin/../lib/gcc/riscv32-unknown-elf/7.1.1/../../../../riscv32-unknown-elf/lib/rv32imcxgap9/ilp32/crt0.o: In function `_start':
(.text+0x8): undefined reference to `__global_pointer$'
collect2: error: ld returned 1 exit status


Determining if the CXX compiler works failed with the following output:
Change Dir: /home/rik/opencv/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_66644/fast && /usr/bin/make -f CMakeFiles/cmTC_66644.dir/build.make CMakeFiles/cmTC_66644.dir/build
make[1]: Entering directory '/home/rik/opencv/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_66644.dir/testCXXCompiler.cxx.o
/usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++     -o CMakeFiles/cmTC_66644.dir/testCXXCompiler.cxx.o -c /home/rik/opencv/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_66644
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_66644.dir/link.txt --verbose=1
/usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++       -rdynamic CMakeFiles/cmTC_66644.dir/testCXXCompiler.cxx.o  -o cmTC_66644 
riscv32-unknown-elf-g++: error: unrecognized command line option '-rdynamic'
make[1]: *** [CMakeFiles/cmTC_66644.dir/build.make:87: cmTC_66644] Error 1
make[1]: Leaving directory '/home/rik/opencv/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_66644/fast] Error 2


Different error for OpenCV 4.5.1 (latest)
-- The CXX compiler identification is GNU 7.1.1
-- The C compiler identification is GNU 7.1.1
-- Check for working CXX compiler: /usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++
-- Check for working CXX compiler: /usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++ -- broken
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCXXCompiler.cmake:53 (message):
  The C++ compiler

    "/usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/rik/new_opencv/opencv/build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/make cmTC_fca23/fast && /usr/bin/make -f CMakeFiles/cmTC_fca23.dir/build.make CMakeFiles/cmTC_fca23.dir/build
    make[1]: Entering directory '/home/rik/new_opencv/opencv/build/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_fca23.dir/testCXXCompiler.cxx.o
    /usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++    -fPIE   -o CMakeFiles/cmTC_fca23.dir/testCXXCompiler.cxx.o -c /home/rik/new_opencv/opencv/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    Linking CXX executable cmTC_fca23
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_fca23.dir/link.txt --verbose=1
    /usr/lib/gap_riscv_toolchain/bin/riscv32-unknown-elf-g++       CMakeFiles/cmTC_fca23.dir/testCXXCompiler.cxx.o  -o cmTC_fca23 
    /usr/lib/gap_riscv_toolchain/bin/../lib/gcc/riscv32-unknown-elf/7.1.1/../../../../riscv32-unknown-elf/lib/rv32imcxgap9/ilp32/crt0.o: In function `_start':
    (.text+0x8): undefined reference to `__global_pointer$'
    collect2: error: ld returned 1 exit status
    make[1]: *** [CMakeFiles/cmTC_fca23.dir/build.make:87: cmTC_fca23] Error 1
    make[1]: Leaving directory '/home/rik/new_opencv/opencv/build/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_fca23/fast] Error 2
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:107 (enable_language)


-- Configuring incomplete, errors occurred!
See also "/home/rik/new_opencv/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/home/rik/new_opencv/opencv/build/CMakeFiles/CMakeError.log".

I don't know where to take it from here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions