tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.81k stars 320 forks source link

`compiler_rt` fails configuring with CMake on Fedora 36, works on Fedora 35 and earlier #340

Closed akien-mga closed 2 years ago

akien-mga commented 2 years ago

I ran into an issue compiling compiler_rt from this repo on a Fedora 36 podman/docker image, while it works fine on Fedora 34 and 35. I haven't found out yet what is causing the CMake issue, so opening a bug report to keep track of it / get help debugging.

Here's my Dockerfile (edited from multiple ones in https://github.com/godotengine/build-containers so don't mind the redundant dnf install deps):

FROM fedora:35

RUN dnf -y upgrade --refresh && \
    dnf -y install --setopt=install_weak_deps=False \
      bash bzip2 cmake curl file findutils git make nano patch pkgconfig python3-pip unzip which xz \
      autoconf automake bzip2-devel clang libicu-devel libtool libxml2-devel llvm-devel openssl-devel yasm \
      autoconf automake cmake gcc gcc-c++ gettext libtool perl python-unversioned-command && \
    cd /root && \
    git clone --progress https://github.com/tpoechtrager/osxcross.git && \
    cd /root/osxcross && \
    git checkout 610542781e0eabc6968b0c0719bbc8d25c992025 && \
    ln -s /root/files/MacOSX11.1.sdk.tar.xz /root/osxcross/tarballs && \
    UNATTENDED=1 ./build.sh && \
    ./build_compiler_rt.sh

CMD /bin/bash

This works fine and gives the following build log with this build command:

build -v $(pwd)/files:/root/files -t godot-osx:f35 -f Dockerfile.osx .

Full build log: osx-f35.log

If I replace the FROM image to fedora:36, the ./build.sh works fine but then I get these errors on ./build_compiler_rt.sh:

CMake Warning at cmake/Modules/CompilerRTUtils.cmake:359 (message):
  llvm-config finding testingsupport failed with status 1
Call Stack (most recent call first):
  CMakeLists.txt:70 (load_llvm_config)   

...

CMake Error at cmake/Modules/CompilerRTUtils.cmake:440 (string):
  string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
  CMakeLists.txt:106 (construct_compiler_rt_default_triple)

...

-- No arm64 support in /root/osxcross/target/bin/../SDK/MacOSX11.1.sdk/SDKSettings.plist
-- No arm64e support in /root/osxcross/target/bin/../SDK/MacOSX11.1.sdk/SDKSettings.plist
CMake Error at cmake/Modules/CompilerRTDarwinUtils.cmake:73 (message):
  Failed to determine SDK version for "iphonesimulator" SDK
Call Stack (most recent call first):
  cmake/builtin-config-ix.cmake:120 (find_darwin_sdk_version)
  lib/builtins/CMakeLists.txt:51 (include)

Full build log: osx-f36.log

I'm guessing this is the problematic part and thus an incompatibility with CMake 3.22.2 shipped in Fedora 36? Edit: Actually my Fedora 35 build also uses CMake 3.22.2 so it's not the CMake version. Probably more related to the LLVM version (LLVM 14.0) which might return a different triple.

CMake Error at cmake/Modules/CompilerRTUtils.cmake:440 (string):
  string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
  CMakeLists.txt:106 (construct_compiler_rt_default_triple)
akien-mga commented 2 years ago

I guess it just needs the same update as https://github.com/tpoechtrager/osxcross/commit/551d192714e075f0ec23e48fead7a60b0caf565e did for Clang 13.0 to properly track release/14.x instead of main (now LLVM 15).

I'll test and make a PR if confirmed.

akien-mga commented 2 years ago

I confirmed that #341 fixes support for Clang 14 now that it's stable. I haven't tested in-dev Clang 15 though so I don't know if more adjustments will be needed for it.