You are not logged in.
I am trying to compile one of my personal projects. The project relies on CUDA and Qt5.
Since the newest pkg upgrade of qt5-base to 5.15.2+kde+r195-1, I get the following errors during the linking stage of my build:
/usr/sbin/ld: /usr/lib/libQt5Core.so.5.15.2: undefined reference to `std::__exception_ptr::exception_ptr::_M_release()@CXXABI_1.3.13'
/usr/sbin/ld: /usr/lib/libQt5Widgets.so.5.15.2: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/usr/sbin/ld: /usr/lib/libQt5Core.so.5.15.2: undefined reference to `std::__exception_ptr::exception_ptr::_M_addref()@CXXABI_1.3.13'
This issue seems pretty similar to ( C++ ABI issue when trying to compile my project on Arch ).
So I tried to change my CMAKE_CUDA_HOST_COMPILER to an older GCC version. Which did not work for GCC versions 10 & 8.
Obviously downgrading the qt5-base package to the previous 5.15.2+kde+r192-1 works for the moment. But a solution (or hint in the right direction) would be nice!
Offline
The solution is updating the entire system. Specifically, gcc-libs is out of date.
This is why partial updates are not supported.
Last edited by Scimmia (2021-05-25 17:21:36)
Offline
The solution is updating the entire system. Specifically, gcc-libs is out of date.
My system is up to date. Just to be sure I just reinstalled gcc & gcc-libs.
Still the same error
Last edited by GreenSokrates (2021-05-25 18:19:36)
Offline
Is there some sample code you can provide so others can recreate the issue?
If not please provide the full cmake output.
Offline
What version of gcc-libs is installed? 11.1.0 provides libstdc++.so.6.0.29 that defines those versions.
Last edited by Scimmia (2021-05-26 00:11:59)
Offline
What version of gcc-libs is installed? 11.1.0 provides libstdc++.so.6.0.29 that defines those versions.
I have installed gcc-libs 11.1.0-1. See:
pacman -Qi gcc-libs
Name : gcc-libs
Version : 11.1.0-1
Description : Runtime libraries shipped by GCC
Architecture : x86_64
URL : https://gcc.gnu.org
Licenses : GPL LGPL FDL custom
Groups : None
Provides : gcc-libs-multilib libgo.so=19-64
libgfortran.so=5-64 libgphobos.so=2-64
libubsan.so=1-64 libasan.so=6-64 libtsan.so=0-64
liblsan.so=0-64
Depends On : glibc>=2.27
Optional Deps : None
Required By : aom base blas brltty brotli chromaprint
compiler-rt db double-conversion doxygen elfutils
exempi exiv2 fftw flac gc gcc gdb gettext
glslang gmp gnutls gptfdisk graphite groff icu
imath jack js78 jsoncpp libao libbs2b libcdio
libde265 libebml libelf libgme libimagequant
libinih libmfx libmodplug libplacebo libproxy
libpst libsigc++ libsoxr libvpx libwpe libyuv
llvm-libs luajit mjpegtools ncurses
ncurses5-compat-libs ninja openal pcre pcre2
poppler portaudio powertop protobuf rav1e re2
ripgrep rust sane shaderc smartmontools snappy
soundtouch spirv-tools tbb thin-provisioning-tools
uchardet unrar v4l-utils vid.stab
visual-studio-code-bin vmaf webrtc-audio-processing
x265 yaml-cpp zeromq zimg zita-alsa-pcmi
zita-resampler zstd zxing-cpp
Optional For : None
Conflicts With : None
Replaces : gcc-libs-multilib libgphobos
Installed Size : 122.34 MiB
Packager : Giancarlo Razzolini <grazzolini@archlinux.org>
Build Date : Thu 13 May 2021 04:02:30 PM CEST
Install Date : Tue 25 May 2021 04:35:08 PM CEST
Install Reason : Installed as a dependency for another package
Install Script : No
Validated By : Signature
I think the gcc-libs provides the correct versions. See:
strings /usr/lib/libstdc++.so.6.0.29 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBCXX_3.4.29
...
Offline
Is there some sample code you can provide so others can recreate the issue?
If not please provide the full cmake output.
Sadly I can't provide sample code as the project goes under a NDA.
Heres the cmake output, I have generated it from a new directory to make sure the cache is empty
-- The CUDA compiler identification is NVIDIA 11.3.58
-- The CXX compiler identification is GNU 10.2.0
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /opt/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/cuda/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at /usr/share/cmake-3.20/Modules/FindOpenGL.cmake:315 (message):
Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
available. Run "cmake --help-policy CMP0072" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
FindOpenGL found both a legacy GL library:
OPENGL_gl_LIBRARY: /usr/lib/libGL.so
and GLVND libraries for OpenGL and GLX:
OPENGL_opengl_LIBRARY: /usr/lib/libOpenGL.so
OPENGL_glx_LIBRARY: /usr/lib/libGLX.so
OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
CMakeLists.txt:36 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found OpenGL: /usr/lib/libOpenGL.so
-- The C compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/cuda/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning (dev) at lib/assimp-5.0.1/CMakeLists.txt:79 (OPTION):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'ASSIMP_NO_EXPORT'.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at lib/assimp-5.0.1/CMakeLists.txt:83 (OPTION):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'ASSIMP_BUILD_ZLIB'.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Shared libraries enabled
-- Looking for ZLIB...
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3")
-- Checking for module 'zzip-zlib-config'
-- Package 'zzip-zlib-config', required by 'virtual:world', not found
-- Found ZLIB: optimized;/usr/lib/libz.so;debug;/usr/lib/libz.so
-- Checking for module 'minizip'
-- Found minizip, version 1.2.11
CMake Warning (dev) at lib/assimp-5.0.1/code/CMakeLists.txt:230 (OPTION):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT'.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at lib/assimp-5.0.1/code/CMakeLists.txt:258 (OPTION):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT'.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (rt) does
not match the name of the calling package (RT). This can lead to problems
in calling code that expects `find_package` result variables (e.g.,
`_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
lib/assimp-5.0.1/cmake-modules/FindRT.cmake:19 (find_package_handle_standard_args)
lib/assimp-5.0.1/code/CMakeLists.txt:1013 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found rt: /usr/lib/librt.so
-- Enabled importer formats: AMF 3DS AC ASE ASSBIN B3D BVH COLLADA DXF CSM HMP IRRMESH IRR LWO LWS MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF 3MF MMD STEP
-- Disabled importer formats:
-- Enabled exporter formats: 3DS ASSBIN ASSXML COLLADA OBJ OPENGEX PLY FBX STL X X3D GLTF 3MF ASSJSON STEP
-- Disabled exporter formats:
CMake Deprecation Warning at lib/assimp-5.0.1/tools/assimp_cmd/CMakeLists.txt:40 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/luism/projects/build
Offline
...
-- The CXX compiler identification is GNU 10.2.0
...
-- Check for working CXX compiler: /opt/cuda/bin/g++ - skipped
CMake has detected the wrong compiler.
Offline
... -- The CXX compiler identification is GNU 10.2.0 ... -- Check for working CXX compiler: /opt/cuda/bin/g++ - skipped
CMake has detected the wrong compiler.
Correct me if I'm wrong, but I think cuda relies on GCC 10 as a host compiler. See Archlinux bug tracker gcc:11 unsuitable as host compiler.
So this should be correct right? Or should cmake use GCC11?
EDIT:
Just to make sure i downgraded again to qt5-base-5.15.2+kde+r192-1, rerun cmake and I still get GNU 10.2 as CXX compiler:
-- The CUDA compiler identification is NVIDIA 11.3.58
-- The CXX compiler identification is GNU 10.2.0
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /opt/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/cuda/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at /usr/share/cmake-3.20/Modules/FindOpenGL.cmake:315 (message):
Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
available. Run "cmake --help-policy CMP0072" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
FindOpenGL found both a legacy GL library:
OPENGL_gl_LIBRARY: /usr/lib/libGL.so
and GLVND libraries for OpenGL and GLX:
OPENGL_opengl_LIBRARY: /usr/lib/libOpenGL.so
OPENGL_glx_LIBRARY: /usr/lib/libGLX.so
OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
CMakeLists.txt:34 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found OpenGL: /usr/lib/libOpenGL.so
-- The C compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/cuda/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning (dev) at lib/assimp-5.0.1/CMakeLists.txt:79 (OPTION):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'ASSIMP_NO_EXPORT'.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at lib/assimp-5.0.1/CMakeLists.txt:83 (OPTION):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'ASSIMP_BUILD_ZLIB'.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Shared libraries enabled
-- Looking for ZLIB...
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3")
-- Checking for module 'zzip-zlib-config'
-- Package 'zzip-zlib-config', required by 'virtual:world', not found
-- Found ZLIB: optimized;/usr/lib/libz.so;debug;/usr/lib/libz.so
-- Checking for module 'minizip'
-- Found minizip, version 1.2.11
CMake Warning (dev) at lib/assimp-5.0.1/code/CMakeLists.txt:230 (OPTION):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT'.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at lib/assimp-5.0.1/code/CMakeLists.txt:258 (OPTION):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT'.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (rt) does
not match the name of the calling package (RT). This can lead to problems
in calling code that expects `find_package` result variables (e.g.,
`_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
lib/assimp-5.0.1/cmake-modules/FindRT.cmake:19 (find_package_handle_standard_args)
lib/assimp-5.0.1/code/CMakeLists.txt:1013 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found rt: /usr/lib/librt.so
-- Enabled importer formats: AMF 3DS AC ASE ASSBIN B3D BVH COLLADA DXF CSM HMP IRRMESH IRR LWO LWS MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF 3MF MMD STEP
-- Disabled importer formats:
-- Enabled exporter formats: 3DS ASSBIN ASSXML COLLADA OBJ OPENGEX PLY FBX STL X X3D GLTF 3MF ASSJSON STEP
-- Disabled exporter formats:
CMake Deprecation Warning at lib/assimp-5.0.1/tools/assimp_cmd/CMakeLists.txt:40 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/luism/projects/build
With this cfg the build links successfully!
Last edited by GreenSokrates (2021-05-26 07:23:22)
Offline
This is from building arrayfire with
cmake . \
-GNinja \
-Bbuild \
-DUSE_CPU_MKL=ON \
-DGOOGLETEST_VERSION=1.9.0 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DAF_WITH_IMAGEIO=ON \
-DAF_BUILD_CPU=ON \
-DAF_BUILD_OPENCL=ON \
-DAF_WITH_NONFREE=ON \
-DAF_BUILD_EXAMPLES=ON \
-DAF_BUILD_DOCS=ON \
-DCUDA_architecture_build_targets="5.2;5.3;6.0;6.1;6.2;7.0;7.2;7.5;8.0;8.6" \
-DCMAKE_BUILD_TYPE=Release \
-DCUDA_HOST_COMPILER=/usr/bin/gcc-10 \
-DBoost_NO_BOOST_CMAKE=ON
-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - 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/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
fatal: not a git repository (or any of the parent directories): .git
-- No git. Setting hash to default
-- Looking for CL_VERSION_2_0
-- Looking for CL_VERSION_2_0 - found
-- Found OpenCL: /usr/lib/libOpenCL.so (found version "2.0")
-- Downloading https://github.com/KhronosGroup/OpenCL-CLHPP/releases/download/v2.0.10/cl2.hpp
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /opt/cuda (found suitable version "11.3", minimum required is "9.0")
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3")
-- Found cuDNN: /usr/lib/libcudnn.so.8 (found suitable version "8.2", minimum required is "4.0")
-- Found OpenCL: /usr/lib/libOpenCL.so (found suitable version "2.0", minimum required is "1.2")
-- Found OpenGL: /usr/lib/libGL.so
-- Found FreeImage: /usr/include
-- Checking for module 'fftw3'
-- Found fftw3, version 3.3.9
-- Found FFTW: /usr/include
-- Checking for module 'cblas'
-- Found cblas, version 3.9.1
-- Found CBLAS: /usr/lib/libcblas.so
-- Found LAPACKE: /usr/lib/liblapacke.so
CMake Warning (dev) at /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (LAPACK)
does not match the name of the calling package (LAPACKE). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
CMakeModules/FindLAPACKE.cmake:153 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:45 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found LAPACK: /usr/include
-- Found Doxygen: /usr/bin/doxygen (found version "1.9.1") found components: doxygen dot
CMake Warning (dev) at /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (OpenMP_C)
does not match the name of the calling package (OpenMP). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
CMakeModules/FindOpenMP.cmake:402 (find_package_handle_standard_args)
CMakeModules/FindMKL.cmake:67 (find_package)
CMakeLists.txt:47 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (OpenMP_CXX)
does not match the name of the calling package (OpenMP). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
CMakeModules/FindOpenMP.cmake:402 (find_package_handle_standard_args)
CMakeModules/FindMKL.cmake:67 (find_package)
CMakeLists.txt:47 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Check size of int
-- Check size of int - done
-- MKL: Thread Layer(Intel OpenMP) Interface(4-byte Integer)
-- Found MKL_Shared: /opt/intel/mkl/include (found version "2020.0.4")
-- Could NOT find MKL: Source the compilervars.sh or mklvars.sh scripts included with your installation of MKL. This script searches for the libraries in MKLROOT, LIBRARY_PATHS(Linux), and LIB(Windows) environment variables (missing: MKL_Core_STATIC_LINK_LIBRARY MKL_Interface_STATIC_LINK_LIBRARY MKL_ThreadLayer_STATIC_LINK_LIBRARY) (found version "2020.0.4")
-- Found Boost: /usr/include (found suitable version "1.76.0", minimum required is "1.66")
Building with NONFREE requires the following patents
Method and apparatus for identifying scale invariant features
in an image and use of same for locating an object in an image, David
G. Lowe, US Patent 6,711,293 (March 23, 2004). Provisional application
filed March 8, 1999. Asignee: The University of British Columbia. For
further details, contact David Lowe (lowe@cs.ubc.ca) or the
University-Industry Liaison Office of the University of British
Columbia.
-- Performing Test has_ignored_attributes_flag
-- Performing Test has_ignored_attributes_flag - Success
-- Performing Test has_all_warnings_flag
-- Performing Test has_all_warnings_flag - Success
-- CUDA_architecture_build_targets: 5.2;5.3;6.0;6.1;6.2;7.0;7.2;7.5;8.0;8.6 ( 5.2 5.3 6.0 6.1 6.2 7.0 7.2 7.5 8.0 8.6 )
-- Performing Test group_flags
-- Performing Test group_flags - Success
-- Found OpenCL: /usr/lib/libOpenCL.so (found version "2.0")
CMake Deprecation Warning at test/gtest/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Deprecation Warning at test/gtest/googlemock/CMakeLists.txt:42 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Deprecation Warning at test/gtest/googletest/CMakeLists.txt:49 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Found PythonInterp: /usr/bin/python (found version "3.9.5")
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Performing Test pthread_flag
-- Performing Test pthread_flag - Success
fatal: not a git repository (or any of the parent directories): .git
-- No git. Setting hash to default
fatal: not a git repository (or any of the parent directories): .git
-- No git. Setting hash to default
-- Configuring done
-- Generating done
-- Build files have been written to: /build/arrayfire/src/arrayfire-full-3.8.0/build
Offline
Thank you loqs.
I looked into arrayfire's CMakeLists.txt. They are using the (since CMake 3.10 deprecated) method of FindCUDA. ( I'm using CMake 3.20.2 )
But I found if I switch around the order of the language call in the top level project() call from project(project LANGUAGES CUDA CXX) to project(project LANGUAGES CXX CUDA) I get GNU 11 as my CXX compiler.
But still, the same linker errors exist. But now with some more context around it:
/usr/bin/ld: CMakeFiles/cudaRTM.dir/src/CudaRTMSimulator.cpp.o: in function `__gnu_cxx::new_allocator<std::shared_ptr<Inlet> >::allocate(unsigned long, void const*)':
CudaRTMSimulator.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt10shared_ptrI5InletEE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorISt10shared_ptrI5InletEE8allocateEmPKv]+0x45): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/cudaRTM.dir/src/CudaRTMSimulator.cpp.o: in function `__gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<GlViewer, std::allocator<GlViewer>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*)':
CudaRTMSimulator.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceI8GlViewerSaIS2_ELNS_12_Lock_policyE2EEE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceI8GlViewerSaIS2_ELNS_12_Lock_policyE2EEE8allocateEmPKv]+0x45): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/cudaRTM.dir/src/CudaRTMSimulator.cpp.o: in function `__gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<ParticleSystem, std::allocator<ParticleSystem>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*)':
CudaRTMSimulator.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceI14ParticleSystemSaIS2_ELNS_12_Lock_policyE2EEE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceI14ParticleSystemSaIS2_ELNS_12_Lock_policyE2EEE8allocateEmPKv]+0x45): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/cudaRTM.dir/src/CudaRTMSimulator.cpp.o: in function `__gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<Model, std::allocator<Model>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*)':
CudaRTMSimulator.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceI5ModelSaIS2_ELNS_12_Lock_policyE2EEE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceI5ModelSaIS2_ELNS_12_Lock_policyE2EEE8allocateEmPKv]+0x45): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/cudaRTM.dir/src/controlldock.cpp.o: in function `__gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<CircularInlet, std::allocator<CircularInlet>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*)':
controlldock.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceI13CircularInletSaIS2_ELNS_12_Lock_policyE2EEE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceI13CircularInletSaIS2_ELNS_12_Lock_policyE2EEE8allocateEmPKv]+0x45): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/cudaRTM.dir/src/controlldock.cpp.o:controlldock.cpp:(.text._ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceI11SquareInletSaIS2_ELNS_12_Lock_policyE2EEE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorISt23_Sp_counted_ptr_inplaceI11SquareInletSaIS2_ELNS_12_Lock_policyE2EEE8allocateEmPKv]+0x45): more undefined references to `std::__throw_bad_array_new_length()' follow
/usr/bin/ld: /usr/lib/libQt5Core.so.5.15.2: undefined reference to `std::__exception_ptr::exception_ptr::_M_release()@CXXABI_1.3.13'
/usr/bin/ld: /usr/lib/libQt5Widgets.so.5.15.2: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/usr/bin/ld: /usr/lib/libQt5Core.so.5.15.2: undefined reference to `std::__exception_ptr::exception_ptr::_M_addref()@CXXABI_1.3.13'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/cudaRTM.dir/build.make:406: cudaRTM] Error 1
make[1]: *** [CMakeFiles/Makefile2:223: CMakeFiles/cudaRTM.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Offline
So I'm still investigating this issue. I can provide you with a minimum working sample.
I'm really out of ideas...
main.cpp:
#include "mainwindow.h"
#include "testfile.cuh"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
doStuff();
return a.exec();
}
testfile.cuh
#ifndef TESTFILE_CUH
#define TESTFILE_CUH
void doStuff();
#endif // TESTFILE_CUH
testfile.cu
#include "testfile.cuh"
#include "cuda_runtime.h"
#include <stdio.h>
__global__
void saxpy(int n, float a, float *x, float *y)
{
int i = blockIdx.x*blockDim.x + threadIdx.x;
if (i < n) y[i] = a*x[i] + y[i];
}
void doStuff()
{
int N = 1<<20;
float *x, *y, *d_x, *d_y;
x = (float*)malloc(N*sizeof(float));
y = (float*)malloc(N*sizeof(float));
cudaMalloc(&d_x, N*sizeof(float));
cudaMalloc(&d_y, N*sizeof(float));
for (int i = 0; i < N; i++) {
x[i] = 1.0f;
y[i] = 2.0f;
}
cudaMemcpy(d_x, x, N*sizeof(float), cudaMemcpyHostToDevice);
cudaMemcpy(d_y, y, N*sizeof(float), cudaMemcpyHostToDevice);
// Perform SAXPY on 1M elements
saxpy<<<(N+255)/256, 256>>>(N, 2.0f, d_x, d_y);
cudaMemcpy(y, d_y, N*sizeof(float), cudaMemcpyDeviceToHost);
float maxError = 0.0f;
for (int i = 0; i < N; i++)
maxError = std::max(maxError, abs(y[i]-4.0f));
printf("Max error: %f\n", maxError);
cudaFree(d_x);
cudaFree(d_y);
free(x);
free(y);
}
CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(test VERSION 0.1 LANGUAGES CXX CUDA)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Define Cuda Cxx Standard
if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif()
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
set(PROJECT_SOURCES
main.cpp
testfile.cu
testfile.cuh
)
add_executable(test
${PROJECT_SOURCES}
)
## CUDA: Set architecture, separate compile for nvcc and include headers
set_target_properties(test PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_property(TARGET test PROPERTY CUDA_ARCHITECTURES 52 53 60 61 75)
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
set(CUDA_NVCC_FLAGS "-Xcompiler /EHsc /O2 /Zi /MTd -g -G")
set(CUDA_VERBOSE_BUILD ON)
## Link Qt Stuff
target_link_libraries(test PRIVATE
Qt5::Core
)
## Link Cuda
target_link_libraries(test PUBLIC
${CUDA_LIBRARIES}
)
target_link_libraries(test PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
This gives me the following compile errors:
/usr/bin/ld: /usr/lib/libQt5Core.so.5.15.2: undefined reference to `std::__exception_ptr::exception_ptr::_M_release()@CXXABI_1.3.13'
/usr/bin/ld: /usr/lib/libQt5Widgets.so.5.15.2: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/usr/bin/ld: /usr/lib/libQt5Core.so.5.15.2: undefined reference to `std::__exception_ptr::exception_ptr::_M_addref()@CXXABI_1.3.13'
collect2: error: ld returned 1 exit status
Offline
Something is going wrong in the linkers search paths.
Using your sample files plus an empty mainwindow.h and the following PKGBUILD, I could reproduce the issue until I added -L /usr/lib to LDFLAGS.
pkgname=NAME
pkgver=VERSION
pkgrel=1
pkgdesc=""
arch=('x86_64')
url=""
license=('GPL')
depends=()
makedepends=('cuda' 'cmake' 'qt5-base')
source=(CMakeLists.txt main.cpp mainwindow.h testfile.cuh testfile.cu)
sha256sums=('71e619a367211242a485a9e463493038291fd7fdac660638be7f8c6443a7d306'
'48227154d0bfd552a52a8f9b1cc536fe8d46d4ed729fa3dffa25b4eb9ca6153d'
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
'cb17f8d3eaa7c4b3e6676f364c5d9c88b56b500bc93e46d3924e2c2948ebdbd1'
'ac8d8e373c058e2d9fb502de879916939f3f0314b36aeb623bd55fb4a89db333')
build() {
LDFLAGS+=' -L/usr/lib'
VERBOSE="" cmake -S . -B build
make -C build
}
package() {
:
}
Offline
How about downgrade to qt5-base-5.15.2-5-x86_64.pkg.tar.zst
Offline
Something is going wrong in the linkers search paths.
Using your sample files plus an empty mainwindow.h and the following PKGBUILD, I could reproduce the issue until I added -L /usr/lib to LDFLAGS.
THANK YOU!
If I export LDFLAGS before invoking CMake & make it builds, links, and runs as expected!
Is this a CMake or a Qt5 issue? And why did it only start to happen after the qt5-base pkg upgrade?
Should I file a bug report in CMake / Qt5 upstream?
Offline
How about downgrade to qt5-base-5.15.2-5-x86_64.pkg.tar.zst
The main reason is, that I'm using the archlinux docker image to auto build and deploy the project.
I didn't want to write the config to install qt5-base and then downgrade it again.
Offline
Is this a CMake or a Qt5 issue?
Neither. The problem is cuda using an older GCC version than the one Qt is compiled with.
And why did it only start to happen after the qt5-base pkg upgrade?
Because older versions were compiled with an older GCC.
Offline