[Ves] Crosscompile for iOS 7 including arm64
Aashish Chaudhary
aashish.chaudhary at kitware.com
Fri Feb 7 09:06:46 EST 2014
I haven't switched to the 10.9 yet but I may have experienced similar
issues. We are hoping to push a fix today.
You are using Master branch I guess?
- Aashish
On Fri, Feb 7, 2014 at 2:33 AM, Benedikt Huss <benedikt.huss at gmail.com>wrote:
> Hi,
>
> I'm trying to compile VES for iOS including arm64 with iOS 7.0 SDK on OS X
> 10.9.1, CMake 2.8-12 - but it always fails.
>
> I've changed the toolchains-files like this:
>
> diff --git a/CMake/toolchains/toolchain-ios-device.cmake
> b/CMake/toolchains/toolchain-ios-device.cmake
> index af6aedf..c11069f 100644
> --- a/CMake/toolchains/toolchain-ios-device.cmake
> +++ b/CMake/toolchains/toolchain-ios-device.cmake
> @@ -1,24 +1,19 @@
> set(CMAKE_SYSTEM_NAME Darwin)
>
> -exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE
> XCODE_DEVELOPER_DIR)
> +# Force the compilers to gcc for iOS
> +INCLUDE (CMakeForceCompiler)
> +CMAKE_FORCE_C_COMPILER (gcc gcc)
> +CMAKE_FORCE_CXX_COMPILER (g++ g++)
>
> -find_program(CMAKE_C_COMPILER NAME gcc
> - PATHS
> - "${XCODE_DEVELOPER_DIR}/Platforms/iPhoneOS.platform/Developer/usr/bin/"
> -
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
> - /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
> - NO_DEFAULT_PATH)
> +# Skip the platform compiler checks for cross compiling
> +set (CMAKE_CXX_COMPILER_WORKS TRUE)
> +set (CMAKE_C_COMPILER_WORKS TRUE)
>
> -find_program(CMAKE_CXX_COMPILER NAME g++
> - PATHS
> - "${XCODE_DEVELOPER_DIR}/Platforms/iPhoneOS.platform/Developer/usr/bin/"
> -
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
> - /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
> - NO_DEFAULT_PATH)
> +exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE
> XCODE_DEVELOPER_DIR)
>
> -set(CMAKE_OSX_ARCHITECTURES "armv7;armv7s")
> -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=5.0
> -fvisibility=hidden -fvisibility-inlines-hidden")
> -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -miphoneos-version-min=5.0
> -fvisibility=hidden -fvisibility-inlines-hidden")
> +set(CMAKE_OSX_ARCHITECTURES "armv7" "armv7s" "arm64")
> +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=6.0
> -fvisibility=hidden -fvisibility-inlines-hidden")
> +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -miphoneos-version-min=6.0
> -fvisibility=hidden -fvisibility-inlines-hidden")
>
> # Set the CMAKE_OSX_SYSROOT to the latest SDK found
> set(CMAKE_OSX_SYSROOT)
> @@ -28,7 +23,7 @@ set(possible_sdk_roots
> /Developer/Platforms/iPhoneOS.platform/Developer/SDKs
> )
> foreach(sdk_root ${possible_sdk_roots})
> - foreach(sdk iPhoneOS4.3.sdk iPhoneOS5.0.sdk iPhoneOS5.1.sdk
> iPhoneOS6.0.sdk iPhoneOS6.1.sdk iPhoneOS7.0.sdk)
> + foreach(sdk iPhoneOS6.0.sdk iPhoneOS6.1.sdk iPhoneOS7.0.sdk)
> if (EXISTS ${sdk_root}/${sdk} AND IS_DIRECTORY ${sdk_root}/${sdk})
> set(CMAKE_OSX_SYSROOT ${sdk_root}/${sdk})
> endif()
> @@ -39,11 +34,13 @@ if (NOT CMAKE_OSX_SYSROOT)
> endif()
> message(STATUS "-- Using iOS SDK: ${CMAKE_OSX_SYSROOT}")
>
> +SET (CMAKE_C_FLAGS "-arch armv7 -arch armv7s -arch arm64 -isysroot
> ${CMAKE_OSX_SYSROOT} -std=c99 -x objective-c -DNDEBUG=1")
> +SET (CMAKE_CXX_FLAGS "-arch armv7 -arch armv7s -arch arm64 -isysroot
> ${CMAKE_OSX_SYSROOT} -x objective-c++ -DNDEBUG=1")
> +
> +SET (CMAKE_EXE_LINKER_FLAGS "-miphoneos-version-min=6.0")
> +SET (CMAKE_SHARED_LINKER_FLAGS "-miphoneos-version-min=6.0")
> +SET (CMAKE_MODULE_LINKER_FLAGS "-miphoneos-version-min=6.0")
>
> -set(CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING
> "osx architectures")
> -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")
> -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
> -set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}" CACHE PATH "osx sysroot")
> set(MACOSX_BUNDLE_GUI_IDENTIFIER CACHE STRING
> "com.kitware.\${PRODUCT_NAME:identifier}")
>
>
> diff --git a/CMake/toolchains/toolchain-ios-simulator.cmake
> b/CMake/toolchains/toolchain-ios-simulator.cmake
> index 2ab3e7d..ef4baa2 100644
> --- a/CMake/toolchains/toolchain-ios-simulator.cmake
> +++ b/CMake/toolchains/toolchain-ios-simulator.cmake
> @@ -1,34 +1,29 @@
> set(CMAKE_SYSTEM_NAME Darwin)
>
> -exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE
> XCODE_DEVELOPER_DIR)
> +# Force the compilers to gcc for iOS
> +INCLUDE (CMakeForceCompiler)
> +CMAKE_FORCE_C_COMPILER (gcc gcc)
> +CMAKE_FORCE_CXX_COMPILER (g++ g++)
>
> -find_program(CMAKE_C_COMPILER NAME gcc
> - PATHS
> -
> "${XCODE_DEVELOPER_DIR}/Platforms/iPhoneSimulator.platform/Developer/usr/bin/"
> -
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/
> - /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/
> - NO_DEFAULT_PATH)
> +# Skip the platform compiler checks for cross compiling
> +set (CMAKE_CXX_COMPILER_WORKS TRUE)
> +set (CMAKE_C_COMPILER_WORKS TRUE)
>
> -find_program(CMAKE_CXX_COMPILER NAME g++
> - PATHS
> -
> "{XCODE_DEVELOPER_DIR}/Platforms/iPhoneSimulator.platform/Developer/usr/bin/"
> -
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/
> - /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/
> - NO_DEFAULT_PATH)
> +exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE
> XCODE_DEVELOPER_DIR)
>
> -set(CMAKE_OSX_ARCHITECTURES i386)
> -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden
> -fvisibility-inlines-hidden")
> -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden
> -fvisibility-inlines-hidden")
> +set(CMAKE_OSX_ARCHITECTURES "i386" "x86_64")
> +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=6.0
> -fvisibility=hidden -fvisibility-inlines-hidden")
> +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -miphoneos-version-min=6.0
> -fvisibility=hidden -fvisibility-inlines-hidden")
>
> # Set the CMAKE_OSX_SYSROOT to the latest SDK found
> set(CMAKE_OSX_SYSROOT)
> set(possible_sdk_roots
> -
> "${XCODE_DEVELOPER_DIR}/Platforms/iPhoneSimulator.platform/Developer/SDKs"
> -
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs
> - /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs
> + "${XCODE_DEVELOPER_DIR}/Platforms/iPhoneOS.platform/Developer/SDKs"
> +
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
> + /Developer/Platforms/iPhoneOS.platform/Developer/SDKs
> )
> foreach(sdk_root ${possible_sdk_roots})
> - foreach(sdk iPhoneSimulator4.3.sdk iPhoneSimulator5.0.sdk
> iPhoneSimulator5.1.sdk iPhoneSimulator6.0.sdk iPhoneSimulator6.1.sdk
> iPhoneSimulator7.0.sdk)
> + foreach(sdk iPhoneOS6.0.sdk iPhoneOS6.1.sdk iPhoneOS7.0.sdk)
> if (EXISTS ${sdk_root}/${sdk} AND IS_DIRECTORY ${sdk_root}/${sdk})
> set(CMAKE_OSX_SYSROOT ${sdk_root}/${sdk})
> endif()
> @@ -39,21 +34,14 @@ if (NOT CMAKE_OSX_SYSROOT)
> endif()
> message(STATUS "-- Using iOS SDK: ${CMAKE_OSX_SYSROOT}")
>
> -# If the we are on 7.0 or higher SDK we should add simulator version min
> to get
> -# things to compile. This is probably more properly handled with a
> compiler version
> -# check but this works for now.
> -if(CMAKE_OSX_SYSROOT MATCHES iPhoneSimulator7.0.sdk)
> - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
> -mios-simulator-version-min=5.0")
> - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mios-simulator-version-min=5.0")
> -else()
> - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
> -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000")
> - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}
> -D__PHONE_OS_VERSION_MIN_REQIORED=50000")
> -endif()
> +SET (CMAKE_C_FLAGS "-arch i386 -arch x86_64 -isysroot
> ${CMAKE_OSX_SYSROOT} -std=c99 -x objective-c -DNDEBUG=1")
> +SET (CMAKE_CXX_FLAGS "-arch i386 -arch x86_64 -isysroot
> ${CMAKE_OSX_SYSROOT} -x objective-c++ -DNDEBUG=1")
> +
> +SET (CMAKE_EXE_LINKER_FLAGS "-miphoneos-version-min=6.0")
> +SET (CMAKE_SHARED_LINKER_FLAGS "-miphoneos-version-min=6.0")
> +SET (CMAKE_MODULE_LINKER_FLAGS "-miphoneos-version-min=6.0")
>
> -set(CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING
> "osx architectures")
> -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")
> -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
> -set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}" CACHE PATH "osx sysroot")
> +set(MACOSX_BUNDLE_GUI_IDENTIFIER CACHE STRING
> "com.kitware.\${PRODUCT_NAME:identifier}")
>
>
> set(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT})
>
> When I configure a superbuild and run make, the following errors occur:
>
> [ 13%] Performing build step for 'curl-ios-device'
> Scanning dependencies of target libcurl
> [ 1%] Building C object lib/CMakeFiles/libcurl.dir/file.c.o
> [ 2%] Building C object lib/CMakeFiles/libcurl.dir/timeval.c.o
> [ 3%] Building C object lib/CMakeFiles/libcurl.dir/base64.c.o
> [ 4%] Building C object lib/CMakeFiles/libcurl.dir/hostip.c.o
> [ 5%] Building C object lib/CMakeFiles/libcurl.dir/progress.c.o
> [ 6%] Building C object lib/CMakeFiles/libcurl.dir/formdata.c.o
> In file included from
> /Volumes/iOS/KiwiGit/build/CMakeExternals/Source/curl/lib/formdata.c:39:
> /Volumes/iOS/KiwiGit/build/CMakeExternals/Source/curl/lib/strequal.h:33:8:
> error:
> expected parameter declarator
> size_t strlcat(char *dst, const char *src, size_t siz);
> ^
> /usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
> __builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
> ^
> /usr/include/secure/_common.h:39:62: note: expanded from macro
> '__darwin_obsz'
> #define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIF...
> ^
> /usr/include/secure/_common.h:30:32: note: expanded from macro
> '_USE_FORTIFY_LEVEL'
> # define _USE_FORTIFY_LEVEL 2
> ^
> In file included from
> /Volumes/iOS/KiwiGit/build/CMakeExternals/Source/curl/lib/formdata.c:39:
> /Volumes/iOS/KiwiGit/build/CMakeExternals/Source/curl/lib/strequal.h:33:8:
> error:
> expected ')'
> /usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
> __builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
> ^
> /usr/include/secure/_common.h:39:62: note: expanded from macro
> '__darwin_obsz'
> #define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIF...
> ^
> /usr/include/secure/_common.h:30:32: note: expanded from macro
> '_USE_FORTIFY_LEVEL'
> # define _USE_FORTIFY_LEVEL 2
> ^
> /Volumes/iOS/KiwiGit/build/CMakeExternals/Source/curl/lib/strequal.h:33:8:
> note:
> to match this '('
> /usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
> __builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
> ^
> /usr/include/secure/_common.h:39:53: note: expanded from macro
> '__darwin_obsz'
> #define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIF...
> ^
> In file included from
> /Volumes/iOS/KiwiGit/build/CMakeExternals/Source/curl/lib/formdata.c:39:
> /Volumes/iOS/KiwiGit/build/CMakeExternals/Source/curl/lib/strequal.h:33:8:
> warning:
> type specifier missing, defaults to 'int' [-Wimplicit-int]
> size_t strlcat(char *dst, const char *src, size_t siz);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
> __builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
> ^~~~~~~~~~~~~~~~~~~~
> /usr/include/secure/_common.h:39:31: note: expanded from macro
> '__darwin_obsz'
> #define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIF...
> ^~~~~~~~~~~~~~~~~~~~~
> In file included from
> /Volumes/iOS/KiwiGit/build/CMakeExternals/Source/curl/lib/formdata.c:39:
> /Volumes/iOS/KiwiGit/build/CMakeExternals/Source/curl/lib/strequal.h:33:8:
> error:
> conflicting types for '__builtin___strlcat_chk'
> /usr/include/secure/_string.h:111:3: note: expanded from macro 'strlcat'
> __builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
> ^
> /Volumes/iOS/KiwiGit/build/CMakeExternals/Source/curl/lib/strequal.h:33:8:
> note:
> '__builtin___strlcat_chk' is a builtin with type 'unsigned long
> (char *,
> const char *, unsigned long, unsigned long)'
> /usr/include/secure/_string.h:111:3: note: expanded from macro 'strlcat'
> __builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
> ^
> 1 warning and 3 errors generated.
> make[5]: *** [lib/CMakeFiles/libcurl.dir/formdata.c.o] Error 1
> make[4]: *** [lib/CMakeFiles/libcurl.dir/all] Error 2
> make[3]: *** [all] Error 2
> make[2]: *** [CMakeExternals/Stamp/curl-ios-device/curl-ios-device-build]
> Error 2
> make[1]: *** [CMakeFiles/curl-ios-device.dir/all] Error 2
> make: *** [all] Error 2
>
> Best regards,
> Benedikt
>
> _______________________________________________
> Ves mailing list
> Ves at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/ves
>
>
--
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ves/attachments/20140207/30b5c8c6/attachment-0003.html>
More information about the Ves
mailing list