ruslo / polly

:wrench: Collection of CMake toolchain files and scripts for cross-platform build and CI testing (GCC, Visual Studio, iOS, Android, Clang analyzer, sanitizers etc.)
BSD 2-Clause "Simplified" License
862 stars 191 forks source link

Problem with CPack #357

Closed Arcnor closed 3 years ago

Arcnor commented 3 years ago

Hello,

I've been trying to build an iOS library using Polly & CPack, with the following command line:

polly --config Debug --toolchain ios-nocodesign-13-2-dep-9-3-arm64 --clear --pack ZIP

Although the build finishes correctly, CPack cannot find the compiled library because it's looking for it in the wrong path, probably because EFFECTIVE_PLATFORM_NAME is not being set. I don't know where that is being set, but it seems to work for everything except CPack. This is the output I'm getting:

** BUILD SUCCEEDED **

Execute command: [
  `cpack`
  `-C`
  `Debug`
  `--verbose`
  `-GZIP`
]

[/Users/.../_builds/ios-nocodesign-13-2-dep-9-3-arm64]> "cpack" "-C" "Debug" "--verbose" "-GZIP"

CPack: Enable Verbose
CPack Verbose: Read CPack config file:
CPack Verbose: Read CPack configuration file: /Users/.../_builds/ios-nocodesign-13-2-dep-9-3-arm64/CPackConfig.cmake
CPack Verbose: Specified generator: ZIP
CPack Verbose: Use generator: cmCPackArchiveGenerator
CPack Verbose: For project: MyProj
CPack: Create package using ZIP
CPack Verbose: Read description file: /usr/local/Cellar/cmake/3.19.4/share/cmake/Templates/CPack.GenericDescription.txt
CPack Verbose: [ZIP] requested component grouping = ONE_PER_GROUP
CPack Verbose: Remove toplevel directory: /Users/.../_builds/ios-nocodesign-13-2-dep-9-3-arm64/_CPack_Packages/Darwin/ZIP
CPack: Install projects
CPack: - Install project: MyProj [Debug]
CPack Verbose: Install configuration: "Debug"
CMake Error at /Users/.../_builds/ios-nocodesign-13-2-dep-9-3-arm64/cmake_install.cmake:42 (file):
  file INSTALL cannot find
  "/Users/.../_builds/ios-nocodesign-13-2-dep-9-3-arm64/Debug/libmyproj.a":
  No such file or directory.

The path Debug should be Debug-iphoneos as everything is being compiled inside that path. Looking at those generated cmake files I see that the path is being set as /Debug${EFFECTIVE_PLATFORM_NAME}/ so as mentioned, I'm assuming this is not being set for some reason.

Am I missing something else on my command line, or is this a bug somewhere?

Thanks in advance!

ruslo commented 3 years ago

"cpack" "-C" "Debug" "--verbose" "-GZIP"

That's an issue in CMake, Polly is just a wrapper.

Try --archive instead of --pack.

Arcnor commented 3 years ago

Hi, thanks for your answer!

I understand Polly is a wrapper, but I imagine Polly is also the source of that EFFECTIVE_PLATFORM_NAME variable? --archive only zips/tar-gzs stuff together, while I need a cpack invocation. That seems to work fine except for that variable definition, currently I'm manually adding it and everything works after calling cpack again, but I expect this to be a bug somewhere.

Arcnor commented 3 years ago

So it looks like it's not Polly adding that variable, but Xcode, so I'm closing this as there is a CMake issue related to this (https://gitlab.kitware.com/cmake/cmake/-/issues/20023 which seems to have been patched on CMake 3.19.5 but doesn't work for me for some reason).

Thanks again and sorry for the noise.