mosra / magnum-integration

Integration libraries for the Magnum C++11 graphics engine
https://magnum.graphics/
Other
99 stars 45 forks source link

Fail to build target iOS #77

Closed linuxaged closed 3 years ago

linuxaged commented 3 years ago

Xcode 12.2 iOS SDK 14.2 CMake 3.19.1

have tried both default magnum toolchain and polly toolchain.

with magnum default toolchain:

➜  build-ios git:(master) cmake .. \
                        -DCMAKE_BUILD_TYPE=Release \
                        -DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/iOS.cmake \
                        -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
                        -DCMAKE_OSX_ARCHITECTURES="arm64" \
                        -DBUILD_STATIC=ON \
                        -DWITH_IMGUI=ON \
                        -DIMGUI_DIR=/Users/jjj/workspace/imgui \
                        -DCMAKE_INSTALL_PREFIX=/Users/jjj/workspace/ios-libs \
                        -DCMAKE_PREFIX_PATH=/Users/jjj/workspace/ios-libs \
                        -G Xcode
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find Corrade (missing: CORRADE_INCLUDE_DIR
_CORRADE_CONFIGURE_FILE)
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:577 (_FPHSA_FAILURE_MESSAGE)
modules/FindCorrade.cmake:311 (find_package_handle_standard_args)
modules/FindMagnum.cmake:233 (find_package)
CMakeLists.txt:37 (find_package)

-- Configuring incomplete, errors occurred!
See also "/Users/jjj/workspace/magnum-integration/build-ios/CMakeFiles/CMakeOutput.log".

with polly toolchain:

➜  build-ios git:(master) export POLLY_ROOT=$HOME/workspace/polly
➜  build-ios git:(master) export XCODE_XCCONFIG_FILE=$HOME/workspace/polly/scripts/NoCodeSign.xcconfig
➜  build-ios git:(master) export POLLY_IOS_DEVELOPMENT_TEAM="xxxxxxxx"
➜  build-ios git:(master) cmake .. \
                        -DCMAKE_BUILD_TYPE=Release \
                        -DCMAKE_TOOLCHAIN_FILE=${POLLY_ROOT}/ios-14-0-dep-9-3-arm64.cmake \
                        -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
                        -DCMAKE_OSX_ARCHITECTURES="arm64" \
                        -DBUILD_STATIC=ON \
                        -DWITH_IMGUI=ON \
                        -DIMGUI_DIR=/Users/jjj/workspace/imgui \
                        -DCMAKE_INSTALL_PREFIX=/Users/jjj/workspace/ios-libs \
                        -DCMAKE_PREFIX_PATH=/Users/jjj/workspace/ios-libs \
                        -G Xcode
-- [polly] Used toolchain: iOS 14.2 / Deployment 9.3 / arm64 / clang / c++14 support
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Corrade: /usr/local/include  found components: Containers rc Utility 
-- Found Magnum: /usr/local/include   
-- LIB_SUFFIX variable is not defined. It will be autodetected now.
-- You can set it manually with -DLIB_SUFFIX=<value> (64 for example)
-- LIB_SUFFIX autodetected as '', libraries will be installed into /Users/jjj/workspace/ios-libs/lib
-- Found Git: /usr/bin/git (found version "2.24.3 (Apple Git-128)") 
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find OpenGL (missing: OPENGL_INCLUDE_DIR)
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:577 (_FPHSA_FAILURE_MESSAGE)
/Applications/CMake.app/Contents/share/cmake-3.19/Modules/FindOpenGL.cmake:421 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
modules/FindMagnum.cmake:836 (find_package)
src/Magnum/ImGuiIntegration/CMakeLists.txt:29 (find_package)

-- Configuring incomplete, errors occurred!
See also "/Users/jjj/workspace/magnum-integration/build-ios/CMakeFiles/CMakeOutput.log".
mosra commented 3 years ago

Hi, the

Could NOT find Corrade (missing: CORRADE_INCLUDE_DIR
_CORRADE_CONFIGURE_FILE)

is one of the "usual crosscompiling issues" that CMake suffers from. Did you try with -DCMAKE_FIND_ROOT_PATH=/Users/jjj/workspace/ios-libs as I suggested on Gitter? That usually helps.

I have no idea what the Polly toolchain does, looks like it ignored the iOS installation altogether and found the native Corrade/Magnum in /usr/local instead, which is just wrong.

linuxaged commented 3 years ago

With -DCMAKE_FIND_ROOT_PATH=/Users/jjj/workspace/ios-libs i got the same error:

➜  build-ios git:(master) cmake .. \
                        -DCMAKE_BUILD_TYPE=Release \
                        -DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/iOS.cmake \
                        -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
                        -DCMAKE_OSX_ARCHITECTURES="arm64" \
                        -DBUILD_STATIC=ON \
                        -DWITH_IMGUI=ON \
                        -DIMGUI_DIR=/Users/jjj/workspace/imgui \
                        -DCMAKE_INSTALL_PREFIX=/Users/jjj/workspace/ios-libs \
                        -DCMAKE_PREFIX_PATH=/Users/jjj/workspace/ios-libs \
                        -DCMAKE_FIND_ROOT_PATH=/Users/jjj/workspace/ios-libs \
                        -G Xcode
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find Corrade (missing: CORRADE_INCLUDE_DIR
_CORRADE_CONFIGURE_FILE)
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:577 (_FPHSA_FAILURE_MESSAGE)
modules/FindCorrade.cmake:311 (find_package_handle_standard_args)
modules/FindMagnum.cmake:233 (find_package)
CMakeLists.txt:37 (find_package)

-- Configuring incomplete, errors occurred!
See also "/Users/jjj/workspace/magnum-integration/build-ios/CMakeFiles/CMakeOutput.log".
mosra commented 3 years ago

:eyes:

Stupid question, but ... /Users/jjj/workspace/ios-libs/include/Corrade/configure.h exists, right? This worked for building Magnum, right? There has to be something different between how you built Magnum and this which causes the error.

linuxaged commented 3 years ago

Oh my fault, have not checked that. So ~ not parsed correctly in zsh, the Corrade i built was not installed in ~/workspace/ios-libs. absolute path should be used.

The correct script i'm using:

mosra commented 3 years ago

So ~ not parsed correctly in zsh

Soo ... you ended up with a folder literally named ~? :sweat_smile: If that's so, I'm happy with my Bash and don't ever want to use anything else, haha :)