Skip to content

libcxxshim's CMake has trouble copying modulemap and header to resource #60326

Open
@plotfi

Description

@plotfi

When building Swift using a unified CMake build setup the cmake commands (in stdlib/public/Cxx/cxxshim/CMakeLists.txt):

"${CMAKE_COMMAND}" "-E" "copy_if_different" "${CMAKE_CURRENT_SOURCE_DIR}/${libcxxshim_modulemap}" "${libcxxshim_modulemap_out}"

and

"${CMAKE_COMMAND}" "-E" "copy_if_different" "${CMAKE_CURRENT_SOURCE_DIR}/${libcxxshim_header}" "${libcxxshim_header_out}"

at

https://github.com/apple/swift/blob/main/stdlib/public/Cxx/cxxshim/CMakeLists.txt#L27-L39

don't seem to actually copy the header and modulemap to the expected location when doing a unified CMake build (non-build-script build).

Instead the build hits an CMake Error like the following:

CMake Error at tools/swift/stdlib/public/Cxx/cxxshim/cmake_install.cmake:45 (file):
  file INSTALL cannot find
  "/Users/plotfi/Local/S/build/BinaryCache/toolchain/./lib/swift/macosx/x86_64/libcxxshim.h":
  No such file or directory.

However if the cmake commands for the copies are manually run like so then running the build subsequently succeeds:

cmake -E copy ./swift/stdlib/public/Cxx/cxxshim/libcxxshim.h ./build/BinaryCache/toolchain/./lib/swift/macosx/arm64/libcxxshim.h

cmake -E copy ./swift/stdlib/public/Cxx/cxxshim/libcxxshim.modulemap ./build/BinaryCache/toolchain/./lib/swift/macosx/arm64/libcxxshim.modulemap

cmake -E copy ./swift/stdlib/public/Cxx/cxxshim/libcxxshim.h ./build/BinaryCache/toolchain/./lib/swift/macosx/x86_64/libcxxshim.h\n

cmake -E copy ./swift/stdlib/public/Cxx/cxxshim/libcxxshim.modulemap ./build/BinaryCache/toolchain/./lib/swift/macosx/x86_64/libcxxshim.modulemap

I have a repo with the CMake invocation I use to do a unified cmake build at:

https://github.com/plotfi/swift-build-darwin/blob/main/build.sh#L31-L61

Metadata

Metadata

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.buildc++ interopFeature: Interoperability with C++

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions