Quantlib with boost for iOS build on xcode 4.6 - ios

I'm trying to build quantlib for xcode 4.6.
The project of concern is this one: https://github.com/philipbarnes/quantlib-on-iOS
This quantlib project relies on this boost project: https://gitorious.org/boostoniphone/boostoniphone
My problem is I cannot get this boost to build, but I can get another version to build on github also by Pete.
One of the steps in building quantlib for iOS asks to set the boost dir. I tried to adjust this to no avail. 
This means I have a dir 'boostoniphone-huuskpes-boostoniphone' - which does not build and was said to be the version to use with the quantlib on iPhone project,
and the dir 'boostoniphone-master' which did build - it has a different build structure with folders and maybe setting the $BOOSTDIR variable in the quantlib project isn't so simple.
These outputs from the console have been shorted for more comfortable reading
My gitorious boost output says:
3 warnings generated.
darwin.archive bin.v2/libs/thread/build/darwin-6.1~iphonesim/release/architecture-x86/link- static/macosx-version-iphonesim-6.0/target-os-iphone/threading-multi/libboost_thread.a
common.copy stage/lib/libboost_thread.a
...updated 120 targets...
=================================================================
Done
Splitting all existing fat binaries...
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo: can't open input file: /Users/colman/Downloads/boostoniphone-huuskpes- boostoniphone_/src/boost_1_51_0/bin.v2/libs/thread/build/darwin-4.2.1~iphone/release/architecture- arm/link-static/macosx-version-iphone-6.0/target-os-iphone/threading-multi/libboost_thread.a (No such file or directory)
...
and continues with problem repeated , then this error is next
...
ar: obj/*.o: No such file or directory
...armv7s
ar: obj/*.o: No such file or directory
...i386
ar: obj/*.o: No such file or directory
liboficate: thread
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo: can't open input file: /Users/colman/Downloads/boostoniphone-huuskpes- boostoniphone_/src/boost_1_51_0/bin.v2/libs/thread/build/darwin-4.2.1~iphone/release/architecture-arm/link-static/macosx-version-iphone-6.0/target-os-iphone/threading-multi/libboost_thread.a (No such file or directory)
as the other boost project works for me it, I try to link it into the buildql.sh script as a boost ref, but I get:
checking for arm-apple-darwin10-gcc... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple- darwin10-llvm-gcc-4.2
checking whether the C compiler works... no
configure: error: in `/Users/colman/Downloads/boostoniphone-huuskpes-boostoniphone_/QuantLib-1.2.1':
configure: error: C compiler cannot create executables
See `config.log' for more details
and
/Applications/Xcode.app/Contents//Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo: can't open input file: /Users/colman/Downloads/boostoniphone-huuskpes-boostoniphone_/QuantLib-1.2.1/prefix/armv7/lib/libQuantLib.a (No such file or directory)
A pointer to how to make frameworks may also be a solution? But I think getting the quantlib for iOS project to work is the real solution.
Coming back to the BOOST variable, in the buildql.sh file, changes such as the following have been made:
#: ${BOOST_HOME:=$HOME/workspace/huuskpes-boostoniphone}
: ${BOOST_HOME:=$HOME/workspace/boostoniphone-master/}
: ${BOOST_SRC:=$BOOST_HOME/src/boost_1_51_0}
The following were also altered to attempt to fit the 'boostoniphone-master'
: ${SRCDIR:=`pwd`/src}
: ${BUILDDIR:=`pwd`/build}
: ${PREFIXDIR:=`pwd`/prefix}
: ${FRAMEWORKDIR:=`pwd`/framework}
Thanks for any hints, potential solutions.

Changes to the buildql.sh script look like this:
: ${BOOST_HOME:=/Volumes/Untitled\ 1/workspace/boostoniphone-master/iphone-build/stage/lib}
: ${BOOST_SRC_HOME:=/Volumes/Untitled\ 1/workspace/boostoniphone-master/boostoniphone-master}
: ${BOOST_SRC:=$BOOST_SRC_HOME/src/boost_1_51_0/boost}
...
: ${SRCDIR:=/Volumes/Untitled\ 1/workspace/quantlib-on-iOS-master/QuantLib-1.2.1/src}
: ${BUILDDIR:=/Volumes/Untitled\ 1/workspace/quantlib-on-iOS-master/QuantLib-1.2.1/build}
: ${PREFIXDIR:=/Volumes/Untitled\ 1/workspace/quantlib-on-iOS-master/QuantLib-1.2.1/prefix}
: ${PREFIXDIR_2:=/Volumes/Untitled\ 1/workspace/quantlib-on-iOS-master/QuantLib-1.2.1/prefix}
: ${FRAMEWORKDIR:=/Volumes/Untitled\ 1/workspace/quantlib-on-iOS-master/./ql/.libs/libQuantLib.a}
Build command runs with a new error:
./buildql.sh -with-boost-include=/opt/local/include/ --with-boost-lib=/Volumes/Untitled 1/workspace/boostoniphone-master/iphone-build/stage --prefix=/opt/local/
Current output looks like this:
libtool: link: (cd .libs/libExperimental.lax/libAmortizingBonds.a && ar x "/Volumes/Untitled 1/workspace/quantlib-on-iOS-master/QuantLib-1.2.1/ql/experimental/amortizingbonds/.libs/libAmortizingBonds.a")
../../libtool: line 1096: cd: .libs/libExperimental.lax/libAmortizingBonds.a: No such file or directory
make[3]: *** [libExperimental.la] Error 1
make[2]: *** [install-recursive] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [install-recursive] Error 1
=================================================================
Done
rm: /Volumes/Untitled: Resource busy
=================================================================
Framework: Setting up directories...
=================================================================
Framework: Creating symlinks...
ln: 1/workspace/quantlib-on-iOS-master/./ql/.libs/libQuantLib.a/ql.framework/Versions/Current: No such file or directory
ln: 1/workspace/quantlib-on-iOS-master/./ql/.libs/libQuantLib.a/ql.framework/Headers: No such file or directory
ln: 1/workspace/quantlib-on-iOS-master/./ql/.libs/libQuantLib.a/ql.framework/Resources: No such file or directory
ln: 1/workspace/quantlib-on-iOS-master/./ql/.libs/libQuantLib.a/ql.framework/Documentation: No such file or directory
ln: 1/workspace/quantlib-on-iOS-master/./ql/.libs/libQuantLib.a/ql.framework/ql: No such file or directory
=================================================================
Framework: Lipoing library into /Volumes/Untitled 1/workspace/quantlib-on-iOS-master/./ql/.libs/libQuantLib.a/ql.framework/Versions/A/ql
/Applications/Xcode.app/Contents//Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo: can't open input file: $ /Applications/Xcode.app/Contents//Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo -create -arch armv7 /Volumes/Untitled 1/workspace/quantlib-on-iOS- master/QuantLib-1.2.1/1/workspace/quantlib-on-iOS-master/QuantLib-1.2.1/ql/.libs/libQuantLib.a -arch armv7s /Volumes/Untitled 1/workspace/quantlib-on-iOS-master/QuantLib-1.2.1/1/workspace/quantlib-on-iOS-master/QuantLib-1.2.1/ql/.libs/libQuantLib.a -arch i386 /Volumes/Untitled 1/workspace/quantlib-on-iOS-master/QuantLib-1.2.1/1/workspace/quantlib-on-iOS-master/ QuantLib-1.2.1/ql/.libs/libQuantLib.a -o /Volumes/Untitled (No such file or directory)
Aborted: Lipo failed

Rather than go into all the script details the following is the solution:
Set the paths carefully, that means, try not to have spaces or have data on external drive (although you can)
Set the parameters for the ARM chip, simulator and the iOS version installed very very carefully!
All in all that should be the most of it.

Related

when i build "gomobile bind" a go project with opencv4 ,error come ,how can i solve

Gomobile bind error
The array mean what, Anybody ever had this problem?
go build -tags ios -buildmode=c-archive -o/var/folders/vp/3ztk4jzn3hq35qfmp3qwrfm80000gp/T/gomobile-work135205628/faceTest-arm.a gobind failed: exit status 2
# gocv.io/x/gocv
In file included from calib3d.cpp:1:
In file included from ../../../../../gocv.io/x/gocv/calib3d.h:5:
In file included from /usr/local/Cellar/opencv/4.0.0/include/opencv4/opencv2/opencv.hpp:52:
In file included from /usr/local/Cellar/opencv/4.0.0/include/opencv4/opencv2/core.hpp:52:
/usr/local/Cellar/opencv/4.0.0/include/opencv4/opencv2/core/cvdef.h:659:10:
fatal error: 'array' file not found

Adding Library to CMake on CLI

I'm trying to build OpenCV with CUDA support using Arch Linux's AUR. In their build configuration some options are passed to CMake, I have modified those to add CUDA features. Upon attempting compilation I get the following error:
[ 10%] Built target pch_Generate_opencv_reg
In file included from /home/meurer/Downloads/opencv-git/src/modules/cudacodec/opencv_cudacodec_pch_dephelp.cxx:1:0:
/home/meurer/Downloads/opencv-git/src/opencv/modules/cudacodec/src/precomp.hpp:59:14: fatal error: dynlink_nvcuvid.h: No such file or directory
#include <dynlink_nvcuvid.h>
^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/build.make:63: modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/opencv_cudacodec_pch_dephelp.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:6834: modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/all] Error 2
I searched my filesystem and found the rogue header file in /usr/include/nvidia-sdk/dynlink_nvcuvid.h. Due to how AUR works, I believe I can only configure CMake via command line options (See links 1, 2 under _cmakeopts=...).
What argument can I pass to CMake to make it search for the appropriate libraries under the aforementioned directory, as well as the ones it already uses?

use Pod instead of import Parse and Bolts framework

Currently I have a project and import Parse and Bolts framework manually.
I want to use Pod to instead of manually import. After Pod install, Build project is fine.
However, When I use simulator to run project then get below error message
fatal error: lipo: input file (/Users/anchi/Library/Developer/Xcode/DerivedData/xxxxxxx/Build/Products/Debug-iphonesimulator/xxxxxxx.app/Frameworks/Bolts.framework/Bolts) must be a fat file when the -extract option is specified
fatal error: lipo: can't open input file: /Users/anchi/Library/Developer/Xcode/DerivedData/xxxxxxx/Build/Products/Debug-iphonesimulator/xxxxxxx.app/Frameworks/Bolts.framework/Bolts-x86_64 (No such file or directory)
mv: /Users/anchi/Library/Developer/Xcode/DerivedData/xxxxxxx/Build/Products/Debug-iphonesimulator/xxxxxxx.app/Frameworks/Bolts.framework/Bolts-merged: No such file or directory
rm: /Users/anchi/Library/Developer/Xcode/DerivedData/xxxxxxx/Build/Products/Debug-iphonesimulator/xxxxxxx.app/Frameworks/Bolts.framework/Bolts-x86_64: No such file or directory
fatal error: lipo: input file (/Users/anchi/Library/Developer/Xcode/DerivedData/xxxxxxx/Build/Products/Debug-iphonesimulator/xxxxxxx.app/Frameworks/Parse.framework/Parse) must be a fat file when the -extract option is specified
fatal error: lipo: can't open input file: /Users/anchi/Library/Developer/Xcode/DerivedData/xxxxxxx/Build/Products/Debug-iphonesimulator/xxxxxxx.app/Frameworks/Parse.framework/Parse-x86_64 (No such file or directory)
mv: /Users/anchi/Library/Developer/Xcode/DerivedData/xxxxxxx/Build/Products/Debug-iphonesimulator/xxxxxxx.app/Frameworks/Parse.framework/Parse-merged: No such file or directory
rm: /Users/anchi/Library/Developer/Xcode/DerivedData/xxxxxxx/Build/Products/Debug-iphonesimulator/xxxxxxx.app/Frameworks/Parse.framework/Parse-x86_64: No such file or directory
use simulator run app will display error message, after clear and re-run will success. However, stop simulator and re-run will fail. That means, every time run simulator I have to clear first. Have any expert can help ? (xcode 7.3.1)

Mingw doesn't find file strsafe.h while compiling OpenVC library

I want start playing with the OpenCV library, but I have a problem during the build process. I am on Windows 10 with the Mingw compiler. When I launch the command mingw32-make after a while, I get the following errors:
C:\Github\opencv\modules\videoio\src\cap_dshow.cpp:337:21: fatal error: strsafe.h: No such file or directory
#include <strsafe.h>
^
compilation terminated.
modules\videoio\CMakeFiles\opencv_videoio.dir\build.make:187: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_dshow.cpp.obj' failed
mingw32-make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_dshow.cpp.obj] Error 1
CMakeFiles\Makefile2:4340: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed
mingw32-make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
The incriminated file is cap_dshow.cpp, and the compiler says that is missing the header file strsafe.h. Inside the folder C:\MinGW\include this file is not present and I don't know where to find this.
I've installed MinGW compiler (and other things) with a tool called "MinGW Installation Manager". With this tool I can install also other libraries, but I don't know if one of these contains the file strsafe.h.
My question is likely a duplicate of this, but the accepted answer has a broken link.
I have Microsoft SDK installed and found the strsafe.h file in "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin".
Adding "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin" to the Path system environment variable worked.

compiling stasm for mac

I'm try to to build the stasm library on my mac and hopefully port it to the iphone.
stasm download: http://www.milbo.users.sonic.net/stasm/download.html
I am using the makefile for linux provided.
after some changes to header include paths for libjpeg and opencv, I am stuck with this error
g++ -c ../stasm/violajones.cpp -O3 -Wall -pedantic -I/home/john/OpenCV-2.1.0/include/opencv -I../gsl -I../gsl/gsl -I../image -I../jpeg -I../mat -I../rowley -I../stasm -I../tasm
In file included from ../stasm/violajones.cpp:24:
/opt/local/include/opencv/cv.h:63:33: error: opencv2/core/core_c.h: No such file or directory
/opt/local/include/opencv/cv.h:64:33: error: opencv2/core/core.hpp: No such file or directory
/opt/local/include/opencv/cv.h:65:39: error: opencv2/imgproc/imgproc_c.h: No such file or directory
/opt/local/include/opencv/cv.h:66:39: error: opencv2/imgproc/imgproc.hpp: No such file or directory
/opt/local/include/opencv/cv.h:67:38: error: opencv2/video/tracking.hpp: No such file or directory
/opt/local/include/opencv/cv.h:68:45: error: opencv2/features2d/features2d.hpp: No such file or directory
/opt/local/include/opencv/cv.h:69:35: error: opencv2/flann/flann.hpp: No such file or directory
/opt/local/include/opencv/cv.h:70:39: error: opencv2/calib3d/calib3d.hpp: No such file or directory
/opt/local/include/opencv/cv.h:71:43: error: opencv2/objdetect/objdetect.hpp: No such file or directory
/opt/local/include/opencv/cv.h:72:37: error: opencv2/legacy/compat.hpp: No such file or directory
/opt/local/include/opencv/cv.h:79:37: error: opencv2/core/internal.hpp: No such file or directory In file included
from ../stasm/violajones.cpp:25:
/opt/local/include/opencv/highgui.h:47:39: error: opencv2/highgui/highgui_c.h: No such file or directory
/opt/local/include/opencv/highgui.h:48:39: error: opencv2/highgui/highgui.hpp: No such file or directory
the original makefile is uploaded here https://github.com/tsaizhenling/stuff/blob/master/makefile
i have tried changing the directory as trojanfoe suggested
but still same error :(
I have opencv and opencv2 residing in /opt/local/include/
Update:
tried J-16 SDiZ's suggestion and this brought me forward. I had to remove the pedantic flag but i'm still stuck with the following error
g++ -c ../stasm/tab.cpp -O3 -Wall -I/opt/local/include/opencv
-I/opt/local/include -I../gsl -I../gsl/gsl -I../image -I../jpeg -I../mat -I../rowley -I../stasm -I../tasm make: * No rule to make target -lm', needed bystasm'. Stop.
makefile is updated
Update:
Finally got everything fixed with help from J-16 SDiZ.
had to update the linker flags because opencv changed the library names
makefile is updated in case anyone needs it
Change
INCL=\
-I$(OPENCV_HOME)/include/opencv\
-I../gsl\
to
INCL=\
-I$(OPENCV_HOME)/include/opencv\
-I$(OPENCV_HOME)/include \
-I../gsl\
And you should not use ${LIB} in the dependency.
change
something: xxxxxx $(LIBS) $(OBJ)
to
something: xxxxxx $(OBJ)
I think you should learn how Makefile works, this is a makefile problem.
There are Mac/Linux build scripts for Stasm here:
https://github.com/juan-cardelino/stasm
You can build for iOS easily using this:
https://code.google.com/p/ios-cmake/wiki/HowTo

Resources