CMake issueshttps://gitlab.kitware.com/cmake/cmake/-/issues2016-06-13T11:44:21-04:00https://gitlab.kitware.com/cmake/cmake/-/issues/4977RFE: SEPARATE_ARGS does word splitting2016-06-13T11:44:21-04:00Kitware RobotRFE: SEPARATE_ARGS does word splittingThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=4977). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=4977). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/22460ROCMClang ignores target_compile_features for CXX targets2021-09-20T12:38:56-04:00Axel HueblROCMClang ignores target_compile_features for CXX targetsHi,
I am compiling mixed C CXX and Fortran projects and use `hipcc` (ROCMClang 4.1.0) with CMake 3.21.0 as CXX compiler.
For CXX targets, it looks like this ignores `target_compile_features`.
## Reproducer
### CMakeLists.txt
```cmake...Hi,
I am compiling mixed C CXX and Fortran projects and use `hipcc` (ROCMClang 4.1.0) with CMake 3.21.0 as CXX compiler.
For CXX targets, it looks like this ignores `target_compile_features`.
## Reproducer
### CMakeLists.txt
```cmake
cmake_minimum_required(VERSION 3.21)
project(test C CXX)
add_executable(main main.cxx)
set_target_properties(main PROPERTIES CXX_EXTENSIONS OFF)
target_compile_features(main PUBLIC cxx_std_17)
```
### main.cxx
```c++
#include <iostream>
int main() {
std::cout << __cplusplus << std::endl;
}
```
### Build
```console
$ export CC=$(which clang)
$ export CXX=$(which hipcc)
$ cmake -S . -B build
-- The C compiler identification is Clang 12.0.0
-- The CXX compiler identification is ROCMClang 4.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /sw/spock/spack-envs/views/rocm-4.1.0/llvm/bin/clang - 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: /sw/spock/spack-envs/views/rocm-4.1.0/llvm/bin/clang++ - skipped
-- Detecting CXX compile features
--- Detecting CXX compile features - done
-- Configuring done
--- Generating done
-- Build files have been written to: /ccs/home/huebl/src/test_cxxstd/build
$ cmake --build build -- VERBOSE=ON
...
Scanning dependencies of target main
...
[ 50%] Building CXX object CMakeFiles/main.dir/main.cxx.o
/sw/spock/spack-envs/views/rocm-4.1.0/llvm/bin/clang++ -o CMakeFiles/main.dir/main.cxx.o -c /ccs/home/huebl/src/test_cxxstd/main.cxx
...
$ cmake --version
cmake version 3.21.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
```
### Execute
```console
$ ./build/main
201402
```
## Using AMD's `clang++` directly
For comparison, building with AMD's `clang++` as CXX directly properly adds `-std=c++17`:
```console
$ export CXX=$(which clang++)
```3.21.3Brad KingBrad Kinghttps://gitlab.kitware.com/cmake/cmake/-/issues/22457ROCMClang: AMD's Clang++ vs. hipcc ID2021-09-16T15:42:40-04:00Axel HueblROCMClang: AMD's Clang++ vs. hipcc IDHi,
We received the CMake 3.21.0 update today in CI via AMD.
With it, `hipcc` is now unwrapped to AMD's `clang++` and identified as `ROCMClang`
https://gitlab.kitware.com/cmake/cmake/-/blob/v3.21.0/Modules/CMakeDetermineCompilerId.cmake...Hi,
We received the CMake 3.21.0 update today in CI via AMD.
With it, `hipcc` is now unwrapped to AMD's `clang++` and identified as `ROCMClang`
https://gitlab.kitware.com/cmake/cmake/-/blob/v3.21.0/Modules/CMakeDetermineCompilerId.cmake#L153-159
But interestingly, when setting the ROCm `clang++` as CXX compiler directly, that one is still identified as vanilla `Clang`. That is probably a bug.
x-ref: https://github.com/AMReX-Codes/amrex/pull/2184https://gitlab.kitware.com/cmake/cmake/-/issues/23343rootVolumeOnly attribute should not be added when CPACK_PRODUCTBUILD_DOMAINS ...2022-09-27T17:53:53-04:00Craig ScottrootVolumeOnly attribute should not be added when CPACK_PRODUCTBUILD_DOMAINS is enabled!6825 added a set of new `CPACK_PRODUCTBUILD_DOMAINS*` variables. These replace the need for the deprecated `auth` attribute on each `pkg-ref` element. According to the Apple documentation, the `rootVolumeOnly` attribute of the `options`...!6825 added a set of new `CPACK_PRODUCTBUILD_DOMAINS*` variables. These replace the need for the deprecated `auth` attribute on each `pkg-ref` element. According to the Apple documentation, the `rootVolumeOnly` attribute of the `options` element is also deprecated and is replaced by the `domains` element. Currently, we hard-code `rootVolumeOnly="false"`, but we should not output that attribute when `domains` will be added.
Reference: https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW73.23.0Craig ScottCraig Scotthttps://gitlab.kitware.com/cmake/cmake/-/issues/16682RPATH exclusion of implicit directories does not consider symlinks2017-05-04T16:23:48-04:00Brad KingRPATH exclusion of implicit directories does not consider symlinksWhen computing the runtime search path to pass to the linker `-rpath` option we automatically filter out directories that are implied by the platform or toolchain. This avoids unnecessary rpath entries that may conflict with the real dy...When computing the runtime search path to pass to the linker `-rpath` option we automatically filter out directories that are implied by the platform or toolchain. This avoids unnecessary rpath entries that may conflict with the real dynamic loader's paths.
However, the filter does not account for differences in directory names due to symbolic links. This can cause undesired rpath entries to be left behind.3.8.0Brad KingBrad Kinghttps://gitlab.kitware.com/cmake/cmake/-/issues/16135RPATH linker flags no longer set correctly for SunOS PathScale compiler since...2018-02-20T16:28:56-05:00Kitware RobotRPATH linker flags no longer set correctly for SunOS PathScale compiler since cmake 3.1This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=16135). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=16135). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/13573RPATH not supported when cross compiling for FreeBSD2018-12-07T09:58:52-05:00Kitware RobotRPATH not supported when cross compiling for FreeBSDThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13573). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13573). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/3593RPATH to source directory remains after installation2016-06-10T11:52:40-04:00Kitware RobotRPATH to source directory remains after installationThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=3593). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=3593). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/24877RPATH_CHANGE fails for ELF files with more than 65536 sections2024-03-24T14:34:30-04:00Jürg BilleterRPATH_CHANGE fails for ELF files with more than 65536 sectionsCMake project to reproduce the issue
* [CMakeLists.txt](/uploads/3be34ff726396e984bacb3a9288aa124/CMakeLists.txt) (trivial C++ project that installs an executable)
* `main.cc`: Trivial `main` function + the output of
```sh
for i in `seq ...CMake project to reproduce the issue
* [CMakeLists.txt](/uploads/3be34ff726396e984bacb3a9288aa124/CMakeLists.txt) (trivial C++ project that installs an executable)
* `main.cc`: Trivial `main` function + the output of
```sh
for i in `seq 1 70000`; do
echo "int var_$i __attribute__((section(\"section_$i\"))) = $i;"
done
```
The shell script is from https://sourceware.org/bugzilla/show_bug.cgi?id=5900
Steps to reproduce:
* Configure project with `-DCMAKE_INSTALL_RPATH=/usr/lib`
* Build and install the project
Installation fails with:
```
Install the project...
-- Install configuration: ""
-- Installing: [...]/elftest
CMake Error at cmake_install.cmake:55 (file):
file RPATH_CHANGE could not write new RPATH:
/usr/lib
to the file:
[...]/elftest
No valid ELF RPATH or RUNPATH entry exists in the file;
```
The cause of this bug seems to be that `cmELF` doesn't support ELF files with more than 65536 sections as then the real section count is in the header of section 0, not in the ELF header. I.e., `cmELF` doesn't find any sections and thus, doesn't find the `RPATH` or `RUNPATH` entries even though they exist.
I've encountered this issue with a real world project that statically links to gRPC (and indirectly to abseil-cpp).https://gitlab.kitware.com/cmake/cmake/-/issues/22963RPATH_CHANGE fails when shared object is a GNU ld script2023-09-19T16:05:32-04:00Arcadiy IvanovRPATH_CHANGE fails when shared object is a GNU ld scriptFrom LLVM build:
```cmake
if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xcxxx" OR NOT CMAKE_INSTALL_COMPONENT)
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libc++.so" AND
NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/...From LLVM build:
```cmake
if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xcxxx" OR NOT CMAKE_INSTALL_COMPONENT)
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libc++.so" AND
NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libc++.so")
file(RPATH_CHECK
FILE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libc++.so"
RPATH "")
endif()
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE SHARED_LIBRARY FILES "/home/user/llvm/llvm.stage1.build/lib/libc++.so")
if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libc++.so" AND
NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libc++.so")
file(RPATH_CHANGE
FILE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libc++.so"
OLD_RPATH "/home/user/llvm/llvm.stage1.build/lib:"
NEW_RPATH "")
if(CMAKE_INSTALL_DO_STRIP)
execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libc++.so")
endif()
endif()
endif()
```
```bash
-- Installing: /home/user/llvm/llvm.stage1.bin/lib/libc++.so
CMake Error at projects/libcxx/src/cmake_install.cmake:88 (file):
file RPATH_CHANGE could not write new RPATH:
to the file:
/home/user/llvm/llvm.stage1.bin/lib/libc++.so
Call Stack (most recent call first):
projects/libcxx/cmake_install.cmake:56 (include)
projects/cmake_install.cmake:49 (include)
cmake_install.cmake:76 (include)
FAILED: CMakeFiles/install.util
cd /home/user/llvm/llvm.stage1.build && /usr/bin/cmake -P cmake_install.cmake
```
```bash
$ cat llvm.stage1.bin/lib/libc++.so
INPUT(libc++.so.1 -lc++abi)
```3.22.1Brad KingBrad Kinghttps://gitlab.kitware.com/cmake/cmake/-/issues/15938RPATHs missing on link line for versioned libraries (.so.MAJOR.MINOR.PATCH)2018-01-23T09:36:11-05:00Kitware RobotRPATHs missing on link line for versioned libraries (.so.MAJOR.MINOR.PATCH)This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15938). Further discussion may take place here.
---
When linking against a library using the *full path* to a *versioned* `.so` file...This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15938). Further discussion may take place here.
---
When linking against a library using the *full path* to a *versioned* `.so` file, the RPATH (`-Wl,-rpath,/full/path` or equivalent) is missing from the link line. It *does* work when using the non-versioned library ending in .so
---
Build CGAL 4.7, which exports `libCGAL.so.11.0.1` as `CGAL_LIBRARY` in its `CGALExports.cmake`.
Use in your CMake project similar to the following:
```cmake
find_package( CGAL REQUIRED )
# ...
target_link_libraries( my_exe ${CGAL_LIBRARY} )
```
https://gitlab.kitware.com/cmake/cmake/-/issues/13854rpm built with cmake failing with file conflict errors2018-12-07T09:58:41-05:00Kitware Robotrpm built with cmake failing with file conflict errorsThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13854). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13854). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/12469RPM COMPONENT packaging support for pre/post install scripts is weak2018-12-07T09:59:31-05:00Kitware RobotRPM COMPONENT packaging support for pre/post install scripts is weakThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=12469). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=12469). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/15209RPM generation chokes on directory symlinks with latest rpmbuild2018-12-07T09:57:48-05:00Kitware RobotRPM generation chokes on directory symlinks with latest rpmbuildThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15209). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=15209). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/10339RPM generator does not understand path in destination2016-06-10T12:38:01-04:00Kitware RobotRPM generator does not understand path in destinationThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=10339). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=10339). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/13609RPM generator wrongly add parents directories to the package2018-12-07T09:58:50-05:00Kitware RobotRPM generator wrongly add parents directories to the packageThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13609). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13609). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/9932RPM Generator, spaces in CPACK_PACKAGE_NAME cause error while creating RPM ar...2016-06-10T12:35:03-04:00Kitware RobotRPM Generator, spaces in CPACK_PACKAGE_NAME cause error while creating RPM archiveThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=9932). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=9932). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/12183RPM packaging faills on AIX2018-10-03T19:05:30-04:00Kitware RobotRPM packaging faills on AIXThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=12183). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=12183). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/12305RPM should include directories2018-12-07T09:59:41-05:00Kitware RobotRPM should include directoriesThis issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=12305). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=12305). Further discussion may take place here.https://gitlab.kitware.com/cmake/cmake/-/issues/13860RPMs created by CPack don't install on Fedora 182018-12-07T09:58:40-05:00Kitware RobotRPMs created by CPack don't install on Fedora 18This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13860). Further discussion may take place here.This issue was created automatically from an original [Mantis Issue](https://cmake.org/Bug/view.php?id=13860). Further discussion may take place here.