[Ves] Compiling VES on iOS

Alessandro Dal Grande adgror at gmail.com
Fri May 23 20:21:31 EDT 2014


Hi Casey,

I have reached the conclusion I cannot use this library for my project, as I have a deadline and the it is still not linking.

This time I passed CPPFLAGS=-stdlib=libc++ directly to the make command (and I could see it passed to the compiler), but I still get the same linking error; tried explicitly setting libc++ in XCode, together with different C++ dialects, but still nothing.

Thank you for your help with debugging.  

--  
Alessandro Dal Grande


On Friday, 23 May 2014 at 11:42, Alessandro Dal Grande wrote:

> It still seems Clang was using libstdc++ because if I switch to that, the errors disappear (but then I have OpenCV not linking! meh). I will try to compile once again, now I removed GCC from my system completely. libc++ should be the default in Mavericks, so don’t understand why this is happening; will make sure that it’s added to the CXX_FLAGS as I don’t see it in the Makefile.
>  
> --  
> Alessandro Dal Grande
>  
>  
> On Friday, 23 May 2014 at 11:15, Casey Goodlett wrote:
>  
> > Maybe in the xcode project you are using c++11 but compiled the libraries without.  I am not sure.
> >  
> >  
> > On Fri, May 23, 2014 at 2:02 PM, Alessandro Dal Grande <adgror at gmail.com (mailto:adgror at gmail.com)> wrote:
> > > Hi Casey,  
> > >  
> > > After adding:
> > >  
> > > $(PROJECT_DIR)/kiwi.framework/Headers
> > > $(PROJECT_DIR)/vtk.framework/Headers
> > >  
> > > to Header Search Paths for my target, the statement:  
> > >  
> > > #import <kiwi/vesKiwiViewerApp.h>
> > >  
> > > inside my .mm file doesn’t throw any compilation error any more. At this time the linker errors out with:
> > >  
> > > Undefined symbols for architecture armv7:
> > >   "std::ios_base::Init::~Init()", referenced from:
> > >       ___cxx_global_var_init in vtk(vtkUnicodeString.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkOutputWindow.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkOStreamWrapper.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkOStrStreamWrapper.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkObject.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkCommand.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkTimeStamp.cxx.o)
> > >       ...
> > >   "std::ios_base::Init::Init()", referenced from:
> > >       ___cxx_global_var_init in vtk(vtkUnicodeString.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkOutputWindow.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkOStreamWrapper.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkOStrStreamWrapper.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkObject.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkCommand.cxx.o)
> > >       ___cxx_global_var_init in vtk(vtkTimeStamp.cxx.o)
> > >       ...
> > > ld: symbol(s) not found for architecture armv7
> > > clang: error: linker command failed with exit code 1 (use -v to see invocation)
> > >  
> > >  
> > > What should I add to the Library Search Paths? I looked at the example applications, but they have static libraries instead of frameworks, so I cannot relate.
> > >  
> > > Thanks
> > >  
> > > PS: sorry but I cannot share the code at this time--  
> > > Alessandro Dal Grande
> > >  
> > >  
> > > On Friday, 23 May 2014 at 06:04, Casey Goodlett wrote:
> > >  
> > > > Alessanro,
> > > >  
> > > > You should normally have to add the include path for each framework as you have done.  I assume you also included the vtk.framework headers?  You will see the same in the KiwiSimple and KiwiViewer projects.
> > > >  
> > > > Another option that you may investigate is how to compile each file. I forget the name of the option, but its something like compile each file as objective-c / objective-c++ or by file type.  My experience has been best when I use "by file type".  You do have to be careful then that any ves/ves header is included in a file with .mm extension.  You can get strange build errors if some of the eigen headers get included in a file with .m extension.
> > > >  
> > > > Do you have a project file you can share?
> > > >  
> > > >  
> > > > On Fri, May 23, 2014 at 3:21 AM, Alessandro Dal Grande <adgror at gmail.com (mailto:adgror at gmail.com)> wrote:
> > > > > Update: I managed to compile by removing the c++11 flag I added.
> > > > >  
> > > > > OK, I don’t know how to go forward with the framework in XCode, the example app doesn’t work either. I tried to manually add to the include path the headers with:
> > > > >  
> > > > > $(PROJECT_DIR)/kiwi.framework/Headers
> > > > >  
> > > > > in the Build Settings, but that breaks OpenCV for some reason. If I don’t, the compiler errors out with:
> > > > >  
> > > > > […]/kiwi.framework/Headers/vesKiwiBaseApp.h:30:10: 'vesMath.h' file not found with <angled> include; use "quotes” instead  
> > > > >  
> > > > > --  
> > > > > Alessandro Dal Grande
> > > > >  
> > > > >  
> > > > > On Thursday, 22 May 2014 at 15:01, Alessandro Dal Grande wrote:
> > > > >  
> > > > > > Yup, it switched back to Clang:
> > > > > >  
> > > > > > [  0%] Building C object libarchive/CMakeFiles/archive.dir/archive_acl.c.o
> > > > > > cd /Users/ale/Desktop/projects/nifty/KiwiWebinar/Build/CMakeExternals/Build/libarchive-ios-simulator/libarchive && /usr/bin/cc  -DHAVE_CONFIG_H -Darchive_EXPORTS -fvisibility=hidden -fvisibility-inlines-hidden -mios-simulator-version-min=5.0 -fvisibility=hidden -fvisibility-inlines-hidden -mios-simulator-version-min=5.0 -g -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -fPIC -I/Users/ale/Desktop/projects/nifty/KiwiWebinar/Build/CMakeExternals/Source/libarchive/libarchive -I/Users/ale/Desktop/projects/nifty/KiwiWebinar/Build/CMakeExternals/Build/libarchive-ios-simulator -I/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/include/libxml2    -o CMakeFiles/archive.dir/archive_acl.c.o   -c /Users/ale/Desktop/projects/nifty/KiwiWebinar/Build/CMakeExternals/Source/libarchive/libarchive/archive_acl.c
> > > > > > /usr/local/Cellar/cmake/2.8.12.2/bin/cmake (http://2.8.12.2/bin/cmake) -E cmake_progress_report /Users/ale/Desktop/projects/nifty/KiwiWebinar/Build/CMakeExternals/Build/libarchive-ios-simulator/CMakeFiles 1
> > > > > >  
> > > > > >  
> > > > > >  
> > > > > > --  
> > > > > > Alessandro Dal Grande
> > > > > >  
> > > > > >  
> > > > > > On Thursday, 22 May 2014 at 14:58, Alessandro Dal Grande wrote:
> > > > > >  
> > > > > > > Sure I will try it now.
> > > > > > >  
> > > > > > > --  
> > > > > > > Alessandro Dal Grande
> > > > > > >  
> > > > > > >  
> > > > > > > On Thursday, 22 May 2014 at 14:56, Casey Goodlett wrote:
> > > > > > >  
> > > > > > > > That should not be a problem.
> > > > > > > >  
> > > > > > > > If you dont mind testing removing the find_program for the compilers in the simulator toolchain, it would help me to confirm that I understand the situation.
> > > > > > > >  
> > > > > > > > Thanks
> > > > > > > >  
> > > > > > > >  
> > > > > > > > On Thu, May 22, 2014 at 5:44 PM, Alessandro Dal Grande <adgror at gmail.com (mailto:adgror at gmail.com)> wrote:
> > > > > > > > > I think I can live without the simulator build, as I cannot test on it anyway, based on my app requirements ;)
> > > > > > > > >  
> > > > > > > > > Another strange thing that happens is I get warnings like this one:
> > > > > > > > >  
> > > > > > > > > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: for architecture: armv7 file: ./CMakeExternals/Install/vtk-ios-device/lib/libvtklibxml2-6.0.a(debugXML.c.o) has no symbols  
> > > > > > > > >  
> > > > > > > > > Is it fine, am I missing something?  
> > > > > > > > >  
> > > > > > > > > --  
> > > > > > > > > Alessandro Dal Grande
> > > > > > > > >  
> > > > > > > > >  
> > > > > > > > > On Thursday, 22 May 2014 at 14:30, Casey Goodlett wrote:
> > > > > > > > >  
> > > > > > > > > > You can use the same compiler for both simulator and device builds with the arch, sysroot, and ios-version-min flags set from the toolchain file.  In other words the compiler is the same for both builds but the build options are different.
> > > > > > > > > >  
> > > > > > > > > > The key flags are
> > > > > > > > > > -arch
> > > > > > > > > > -isysroot
> > > > > > > > > > -mios-simulator-version-min=5.0  
> > > > > > > > > > or
> > > > > > > > > > -mios-iphoneos-version-min=5.0  
> > > > > > > > > >  
> > > > > > > > > >  
> > > > > > > > > > Note the version min is key for the simulator build otherwise you may link against host (OS X) libraries.
> > > > > > > > > >  
> > > > > > > > > >  
> > > > > > > > > > On Thu, May 22, 2014 at 5:24 PM, Alessandro Dal Grande <adgror at gmail.com (mailto:adgror at gmail.com)> wrote:
> > > > > > > > > > > Yeah, I get the same:
> > > > > > > > > > >  
> > > > > > > > > > > $ c++ -v
> > > > > > > > > > > Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
> > > > > > > > > > >  
> > > > > > > > > > > Target: x86_64-apple-darwin13.1.0
> > > > > > > > > > > Thread model: posix
> > > > > > > > > > >  
> > > > > > > > > > >  
> > > > > > > > > > > This seems to be the compiler used for armv7/armv7s architectures though, so it should be working if I run the builds on my iDevice?  
> > > > > > > > > > >  
> > > > > > > > > > > Thanks  
> > > > > > > > > > >  
> > > > > > > > > > > --  
> > > > > > > > > > > Alessandro Dal Grande
> > > > > > > > > > >  
> > > > > > > > > > >  
> > > > > > > > > > > On Thursday, 22 May 2014 at 14:21, Casey Goodlett wrote:
> > > > > > > > > > >  
> > > > > > > > > > > >  
> > > > > > > > > > > > On Thu, May 22, 2014 at 5:17 PM, Alessandro Dal Grande <adgror at gmail.com (mailto:adgror at gmail.com)> wrote:
> > > > > > > > > > > > > Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1  
> > > > > > > > > > > > I believe that --with-gxx-include-dir line means you get libstdc++
> > > > > > > > > > > >  
> > > > > > > > > > > > Compare with  
> > > > > > > > > > > > $ c++ -v
> > > > > > > > > > > > Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
> > > > > > > > > > > > Target: x86_64-apple-darwin13.2.0
> > > > > > > > > > > > Thread model: posix  
> > > > > > > > > > > >  
> > > > > > > > > > > > --  
> > > > > > > > > > > > Casey B. Goodlett, Ph.D.
> > > > > > > > > > > > Technical Leader
> > > > > > > > > > > > Kitware, Inc. - North Carolina Office
> > > > > > > > > > > > http://www.kitware.com
> > > > > > > > > > > > (919) 969-6990 x310 (tel:%28919%29%20969-6990%20x310)  
> > > > > > > > > > >  
> > > > > > > > > >  
> > > > > > > > > >  
> > > > > > > > > >  
> > > > > > > > > > --  
> > > > > > > > > > Casey B. Goodlett, Ph.D.
> > > > > > > > > > Technical Leader
> > > > > > > > > > Kitware, Inc. - North Carolina Office
> > > > > > > > > > http://www.kitware.com
> > > > > > > > > > (919) 969-6990 x310 (tel:%28919%29%20969-6990%20x310)  
> > > > > > > > >  
> > > > > > > >  
> > > > > > > >  
> > > > > > > >  
> > > > > > > > --  
> > > > > > > > Casey B. Goodlett, Ph.D.
> > > > > > > > Technical Leader
> > > > > > > > Kitware, Inc. - North Carolina Office
> > > > > > > > http://www.kitware.com
> > > > > > > > (919) 969-6990 x310 (tel:%28919%29%20969-6990%20x310)  
> > > > > > >  
> > > > > >  
> > > > >  
> > > >  
> > > >  
> > > >  
> > > > --  
> > > > Casey B. Goodlett, Ph.D.
> > > > Technical Leader
> > > > Kitware, Inc. - North Carolina Office
> > > > http://www.kitware.com
> > > > (919) 969-6990 x310 (tel:%28919%29%20969-6990%20x310)  
> > >  
> >  
> >  
> >  
> > --  
> > Casey B. Goodlett, Ph.D.
> > Technical Leader
> > Kitware, Inc. - North Carolina Office
> > http://www.kitware.com
> > (919) 969-6990 x310  
>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ves/attachments/20140523/9d325d65/attachment-0003.html>


More information about the Ves mailing list