Finding boost framework with Cmake for iOS - ios

I have Boost built as a framework for iOS. This is currently installed in Applications/Xcode.app/Contents/Developer/Library/Frameworks/.
When I create a "hand-generated" XCode project, I have no problems using this framework.
I'm now trying to use CMake to generate an XCode project. I found this helpful, cross-compiling toolchain (https://github.com/cristeab/ios-cmake). This works as long as I do not include
find_package( Boost )
But when the above line is added to my CMakeLists.txt file, I get a "Boost_INCLUDE_DIR-NOTFOUND"
So question is: has anyone had success in using CMake with Boost for iOS? If so, any help on how to go about it is greatly appreciated.
I found another SO user trying to do something similar here: How to find a iOS/mac OS X framework via Cmake
But it does not offer much details other than using "CMAKE_FRAMEWORK_PATH".
So any help is much appreciated.
Thanks...

find_package cannot find boost built for ios (tested on cmake 3.13 and 3.14)
Was able to solve it in following way.
Build boost using https://github.com/faithfracture/Apple-Boost-BuildScript
set BOOST_ROOT to Apple-Boost-BuildScript/src/boost_x_xx_x
for iOS:
set(Boost_INCLUDE_DIRS "${BOOST_ROOT}")
set(Boost_LIBRARIES "${BOOST_ROOT}/iphone-build/stage/lib/libboost_date_time.a")
set(Boost_LIBRARIES "${Boost_LIBRARIES};${BOOST_ROOT}/iphone-build/stage/lib/libboost_regex.a")
set(Boost_LIBRARIES "${Boost_LIBRARIES};${BOOST_ROOT}/iphone-build/stage/lib/libboost_system.a")
iOS simulator:
set(Boost_INCLUDE_DIRS "${BOOST_ROOT}")
set(Boost_LIBRARIES "${BOOST_ROOT}/iphonesim-build/stage/lib/libboost_date_time.a")
set(Boost_LIBRARIES "${Boost_LIBRARIES};${BOOST_ROOT}/iphonesim-build/stage/lib/libboost_regex.a")
set(Boost_LIBRARIES "${Boost_LIBRARIES};${BOOST_ROOT}/iphonesim-build/stage/lib/libboost_system.a")

I hope it's not too late:)
I came across almost same issue, find_package always complain that can not find the lib, even the search path is correct, notice that the similar issue also exist for Android NDK
For the ios I suggest:
Enable boost debug by set(Boost_DEBUG ON), then check the path specified is correct or not, ref to this link for more info
How can I get CMake to find my alternative Boost installation?
Try find_host_package instead of find_package, I found some clue in ios.cmake which may lead to the issue:
# only search the iOS sdks, not the remainder of the host filesystem
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Related

Lexical or preprocessor issue in react native while building ios app <React/RCTUtils.h> not found

When I am trying to build my ios app in xcode, the build is failing due to lexical or preprocessor issue the error shows up like this
This was a problem specific to the react-native-device-info module.
For your specific case you may try v1.6.1 or higher (currently at 2.0 as of May 21, 2019) of the library and that should fix things for you.
For others interested more generally in the problem, this is a react-native library that uses native code, so it has an XCode project embedded within it for use in react-native after you run react-native link react-native-device-info. Unfortunately, the library was not including any directories in it's header search path, so it was of course unable to find the header files for the react-native objects it was using locally.
A library user proposed a change that fixed that problem for tvOS, and I extended the change to cover iOS as well, and now the library no longer generates errors like this for iOS or tvOS targets.
Perhaps someone with a similar issue may find the specific changes required for the fix useful in their projects

How to get the ImageMagick library working with Swift 4/iOS 11?

I'm trying to get ImageMagick to work in my iOS project. Unfortunately everything I have tried so far has not worked.
Cocoapods
The most obvious approach would be to use the cocoapod. Unfortunately after installing the cocoapod there doesn't appear to be anything exposed to swift to import. Maybe I'm missing something obvious and if anyone has any ideas that would be great. Unfortunately the documentation is lacking as far as specific examples go.
Static library - approach #1
The official ImageMagick docs provide some instructions to compile the latest version of ImageMagick and include a static library in your Xcode project. Unfortunately the first step of the instructions requires running a bash script imagemagick_compile.sh which I cannot find. Once again I could be missing something obvious.
Static library - approach #2
After some additional searching I found the ~Claudio guy which the ImageMagick docs mention as the maintainer of the iOS version of ImageMagick. He has a repo with similar instructions as provided by ImageMagick but this repo includes a bash script to compile and generate a static library of ImageMagick. I tried running the script directly ./all.sh 6.8.8-9 but soon realized I hadn't setup a build directory they way his instructions outlined and I got stuck getting libpng installed correctly.
Static library - approach #3
The same repo with the instructions to compile and generate a static library also includes an old sample iOS project with a static library already included for an older version of ImageMagick. This just about worked except the ImageMagick library has a class Timer that clashes with the Timer class provided by Swift4/iOS so I couldn't get my project to compile using this static library of ImageMagick.
ImageMagick iOS Questions on SO
There are a handful of other questions on Stack Overflow that deal with running ImageMagick on iOS so I know other people have done it but nothing very recent. If anyone has any ideas that would be greatly appreciated, thanks!
Un-answered question on how to use ImageMagick on iOS: ImageMagick iOS image Potentially useful comment that includes some of the same links that I provided above.
Someone already using ImageMagick for iOS but gives no details on how it was implemented: ImageMagick circular dstortion on iOS
Un-answered question from someone already using ImageMagick in their app: Ios - ImageMagick - No Image Created after Distortion
More recent question related to warnings using the cocoapod version: iOS: ImageMagick compiler warnings in Xcode
Other questions: https://stackoverflow.com/search?q=imagemagick+ios Unfortunately I haven't found any of these that have helped.
To integrate ImageMagick into iOS you will need to do the following:
Install the library available here https://www.imagemagick.org/download/iOS/
You will need a Swift-Objective-C bridging header that includes:
#import "ImageMagick.h"
#import "MagickWand.h"
You will need to modify any functions that reference Timer to Foundation.Timer, this will resolve any conflicts with the ImageMagick library
You will need to add under Your target > Build Phases > Link Binary With Libraries > "libxml2.tbd".
Hope this helps

Compiling rabbitmq-c with ios-cmake

I have been trying to compile rabbitmq-c as per hte instructions from R_R (Not able to build rabbitmq-c for iOS application) but I get the following error:
CMake Error at /Users/karela/appDir/ios-cmake/toolchain/iOS.cmake:101 (message): No iOS SDK's found in default seach path /Developer/Platforms/iPhoneOS.platform/Developer. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.
I have searched all I could but cannot figure out what's wrong. Probably something with ios-cmake toolchain but not sure why and how to fix it.
Thanks,
I'm using ios-cmake too, even if I didn't success yet, I can give you the solution of your problem.
When you use cmake, you should add this :
-DCMAKE_IOS_SDK_ROOT=/path/to/Platform/Developer/SDK
For exemple, this is my path :
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk

OpenCV 2.4.4 and Tesseract 3.02.02 Don't link together

I'm using iOS 6.1 and XCode 4.6
I have a problem, OpenCV needs to be compiled with libc++ (LLVM C++ 11), while Tesseract 3.02.03 needs to be compiled with "default compiler".
How can I overcome this problem. at this point I can compile and link only If I comment out OpenCV code or comment out OCR code. cannot make them both work together.
Any ideas??
I am by no means an expert with C++ but I had the same problem and by some trial and error and lots of internet searching I think I managed to solve it.
As I understand it, the problem is that opencv and tesseract are built with different standard libraries. The latest opencv is built with libc++ while tesseract is built with stdlibc++
The solution is to rebuild one of them so they both use the same standard library. I decided to recompile tesseract and followed the instructions found here which references a build script that is used to build the library.
I modified this script (again, by trial an error, not really sure this is the best way) to used the clang++ compiler (CXX="/usr/bin/clang++") and use libc++ (CXXFLAGS="$CFLAGS -stdlib=libc++") and it compiles (albiet with some warnings). You may also need to copy some headers as the script doesn't seem to copy them all.
Then just use this library instead of the downloaded one in your iOS project (remember to change back to libc++ in build settings) and everything will compile and link just fine.
So far it seems to work properly in runtime.

Flex ANE, iOS and ARC

Good day
I have created a static library with Xcode. Then I compiled my ANE using adobe's ADT tool. Thereafter I've included the ANE in my FlashBuilder project. However, when attempting to package my project, I get the following error:
"Error occurred while packaging the application:
Undefined Symbols: "_obj_storeStrong", referenced from ...
.
"_obj_release", referenced from ...
.
"
My guess is that ARC is probably not supported for ANE's. I'm guessing that this is probably due to the fact that FlashBuilder is recompiling the entire AIR + the native libs into one iOS application, probably using their own compiler or something (which is why Air apps for iOS can be compiled on windows platforms as well), and this compiler is probably not 4.3 ready yet?
I have attempted adding the flag -fobjc-arc to my ios-platformoptions.xml as well (where this file is the parameter to the -platformoptions flag of adt), but still no joy. It results once again in an error when packaging. Perhaps any other flag I can try to use here?
Any corrections, suggestions, alternative ideas or comments will be most welcome. I am very new to Xcode, Objective C and ANE, so please excuse any incorrect statements or assumptions, and please correct me on these.
I would be glad if somebody can please confirm weather I am correct with my assumption that I cannot use ARC at this stage on ANE's.
Thanks
Christo
START EDIT:
Very late update, sorry.
You might be able to use ARC after all. There is a library called arc lite that I forgot to mention and it works. I created an ANE for MapKit on iOS targeting the 5.0.x SDK. When I tried to move to a device that only had 4.3.x ( could have been 4.3.3 or 4.3.5 ) the app crashed or would not compile. I found information on the arc lite library that is included in the newer sdks, followed the instructions on how to include this library and pow! A working ANE on a 4.3.x device without rewriting my code!
Hope all of this helps and half of my original comment :)
Markus
END EDIT
I don't think ARC is supported just yet. There isn't much to go on in terms of settings or examples of what the settings should be in Xcode. Take a look at any of the Xcode ANE projects you can get your hands on. You will see that most or all of the projects have:
Object-C Automatice Reference counting = NO
Objective-C++ Automatic Reference counting = NO
Take a look at the following:
Vibration ANE - On Adobe Devnet site
Liquid Photo - http://www.liquid-photo.com/2011/10/30/common-native-extension-issues/
Liquid Photo - http://www.liquid-photo.com/2011/10/28/native-extension-for-adobe-air-and-ios-101/
There are a lot of examples in Github but you have to find them via Google. Pull down the Xcode ANE projects and compare the settings.
Hope this helps!!!
Markus

Resources