Ceres iOS

1,597 views
Skip to first unread message

Fabian Langguth

unread,
May 10, 2012, 6:02:33 AM5/10/12
to ceres-...@googlegroups.com
Hi,

I have Ceres compiled and running on my iPhone. It's a pretty hacky version and I would not call it a port, but if anyone is interested you can ask me :)

Best,
Fabian

Sameer Agarwal

unread,
May 10, 2012, 9:26:04 AM5/10/12
to ceres-...@googlegroups.com, Peter Lee
+pkl

Hey Fabian,
This is great to hear. Are there any significant code changes you had to make?
Peter Lee (cced) also has a port in progress. Perhaps the two of you can collaborate?

Sameer



--
----------------------------------------
Ceres Solver Google Group
http://groups.google.com/group/ceres-solver?hl=en?hl=en

Fabian Langguth

unread,
May 12, 2012, 7:59:25 AM5/12/12
to ceres-...@googlegroups.com, Peter Lee
Hi,

I did not make any big changes to the code. After setting the necessary defines most things compiled in Xcode. I only incuded the core cc files and left out all unit tests as they made more trouble. So I am not sure if everything will work perfectly, but I was able to run a simple example. If there are any further questions, I would be happy to help with the complete port!

Best,
Fabian

Peter Lee

unread,
May 14, 2012, 4:40:14 AM5/14/12
to Fabian Langguth, ceres-...@googlegroups.com
I have 2 of the examples running as well, but getting all the unit tests working would be important to be sure that the entire package works properly.

Peter.

Sameer Agarwal

unread,
May 14, 2012, 5:21:32 AM5/14/12
to ceres-...@googlegroups.com, Fabian Langguth
+1 on that.  The port has to include the tests. All the various platforms have their quircks and we would like the the suite to pass cleanly on everything we ship. e.g., Keir is currently dealing with a very odd test failure on windows...

Sameer

Tim Davis

unread,
May 21, 2012, 9:51:53 AM5/21/12
to ceres-...@googlegroups.com
If you need a light-weight sparse solver (in place of CHOLMOD / LAPACK / BLAS),
you might try CSparse.  It's been ported to an HP 50g calculator, so it should run on anything.
It won't be as fast for large sparse problems, but it should do the trick for moderate-sized ones.
It has a sparse Cholesky, a sparse LU, a sparse QR, and all the sparse matrix functions you
might want, all in 2200 lines of C.  Plus it comes with a textbook that describes the algorithms
line by line (OK the book is not open source ... :-)

CSparse is LGPL, as well.  The Supernodal factorization of SuiteSparse is GPL.

See http://www.cise.ufl.edu/research/sparse/CSparse/ for details.  The book is here:
http://www.ec-securehost.com/SIAM/FA02.html

Thanks,
Tim

Sameer Agarwal

unread,
May 21, 2012, 9:58:32 AM5/21/12
to ceres-...@googlegroups.com
Hi Tim,
This is a good idea. 

I have not looked at the CSparse documentation yet, but since you are here I thought I would ask.

One thing we use in CHOLMOD is the ability to solve the normal equations without actually forming them, i.e.

solve J'J x = b by only giving J' and b. Does CSparse have a similar facility ?  We can of course compute the normal equations explicitly but it would be nice not to. 

Sameer



--

Sameer Agarwal

unread,
May 21, 2012, 10:28:00 AM5/21/12
to ceres-...@googlegroups.com
I just looked and looks like we will have to compute the normal equations explicitly.
I will file an issue for this. Using CSparse in Ceres will require a bit of refactoring, since it was written with the assumption of all sparse operations being done using SuiteSparse.

I have created issue 31 to track this.


I am currently involved in refactoring the trust regions solver and the documentation, so it will be a while before I get to this.
Sameer

Tim Davis

unread,
May 22, 2012, 10:38:35 AM5/22/12
to ceres-...@googlegroups.com
CSparse can compute J'*J in about 3 or 4 lines of code.  From memory:

JT = cs_transpose (J) ;
JTJ = cs_multiply (JT, J) ;
use JTJ here
cs_spfree (JT)
cs_spfree (JTJ)

Sameer Agarwal

unread,
May 22, 2012, 10:43:08 AM5/22/12
to ceres-...@googlegroups.com

CSparse can compute J'*J in about 3 or 4 lines of code.  From memory:

JT = cs_transpose (J) ;
JTJ = cs_multiply (JT, J) ;
use JTJ here
cs_spfree (JT)
cs_spfree (JTJ)

Yes, but I was hoping not to spend memory on an extra matrix.  But thats fine, for cases where this is an issue, you probably do not want to be solving the problem on a phone anyways or using exact factorization. 

Sameer

Lloyd Hughes

unread,
Feb 24, 2014, 2:18:00 AM2/24/14
to ceres-...@googlegroups.com, fabian....@googlemail.com
Is it possible to get a copy of the ported code for iOS, or can you advise on what aspects you had to change to make it compatible?

Sameer Agarwal

unread,
Feb 24, 2014, 2:24:46 AM2/24/14
to ceres-...@googlegroups.com, Fabian Langguth
Lloyd,

Ceres should compile in a fairly straightforward manner on ios.

You can build something that depends only on the eigen, by using the miniglog implementation that ships with ceres. That should compile on anything unixish environment with a c++ compiler.

Fabian, if you had to do anything special/hacky to get it to compile, I would like to hear about it and document it.

Sameer


--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/7995d187-d94b-4ab2-b283-ff61f199b4e1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Keir Mierle

unread,
Feb 24, 2014, 12:54:15 PM2/24/14
to ceres-...@googlegroups.com, Fabian Langguth
Hi Fabian,

We'd love to make Ceres on iOS a first-class port. There shouldn't be any huge barriers, but Sameer and myself are Android guys (who would have guessed :) without iOS devices.

This is an open request for someone on this list to fly the iOS flag and take ownership of this port. Ownership would entail getting the port to work, documenting the steps, and making any necessary changes to build and docs so that the whole process is smooth.

Thanks,
Keir


Miguel Algaba Borrego

unread,
Jun 8, 2014, 2:54:03 PM6/8/14
to ceres-...@googlegroups.com, fabian....@googlemail.com
Hi all,

Since you released the 1.9.0 version including support for iOS, I thought it would be great to create a podspec to allow developers to use Ceres Solver easily with Cocoapods. Today I decided to start a podspec file to do that, however I have not succeeded yet (most likely due to the need to configure the config.h file depending on the target). In case anyone is interested in trying to create that podspec I would like to hear from you, here you can find what I have done so far.


Thanks a lot for your great work and best regards,
Miguel Algaba.

Sameer Agarwal

unread,
Jun 9, 2014, 12:49:17 AM6/9/14
to ceres-...@googlegroups.com
Miguel,

Thanks for doing this. I think you can start by using the flags from the Android.mk file.

-DCERES_NO_LAPACK \
-DCERES_NO_SUITESPARSE  \
-DCERES_NO_THREADS \
-DCERES_NO_CXSPARSE \
-DCERES_STD_UNORDERED_MAP

Sameer


Sameer Agarwal

unread,
Jun 9, 2014, 1:08:56 AM6/9/14
to ceres-...@googlegroups.com
actually the -DCERES_NO_LAPACK can probably be dropped if the acceleration framework is availble on ios (I do not know if it is). 
Sameer

Ricardo Sánchez-Sáez

unread,
Jul 3, 2014, 12:01:03 PM7/3/14
to ceres-...@googlegroups.com
Hi!

I think it would be *great* adding Ceres to Cocoapods. We are currently using it for a project and having it on Cocoapods would be very convenient.

It might be a good idea adding it as a precompiled universal library (instead of adding the source files). We could take a cue at how the this OpenSSL pod did it: 
Ricardo

Sameer Agarwal

unread,
Jul 3, 2014, 12:07:55 PM7/3/14
to ceres-...@googlegroups.com
Ricardo,
We would appreciate any help with this.
Sameer

Miguel Algaba Borrego

unread,
Jul 3, 2014, 1:27:57 PM7/3/14
to ceres-...@googlegroups.com
Hi all, following Sameer suggestions about the compiler flags I continued trying to make the spec file working for Ceres. I have not managed to make it work yet, but some of the issues that I got at first are fixed now. You can find my latest commit here https://github.com/MiguelAlgaba/Specs/commit/8ad1f9f09ff998c1abab46e17a3bcca0be77ad72. Ricardo, if you are also interested we could start from there and try to make it work.

Best!
Miguel A.

Lloyd

unread,
Jul 7, 2014, 8:03:45 AM7/7/14
to ceres-...@googlegroups.com
Hi,

I have been using ceres on iOS for a few months now. I created an XCode project to compile ceres, it has all the correct flags to get it to compile. I am using it for computer vision bundle adjustment type problems and it is running smoothly. I didn't include any test files in the XCode project mainly due to a lack for the need of them (I just needed to get ceres compiled and quickly). In case someone else is looking for this you can find the XCode project on my github at: https://github.com/system123/ceres-solver-ios  

It is also worth noting that this isn't the latest version of ceres-solver, but I am sure you could easily pull in the new code and adapt the XCode project file. It took a fair amount of effort to get this to compile so hopefully this will save time for anyone else wanting to do the same.

Maybe when I get some additional time I can look at doing this in a more robust way to ensure ceres can always ship with iOS build configs.

Cheers

Lloyd

Sameer Agarwal

unread,
Jul 7, 2014, 12:37:47 PM7/7/14
to ceres-...@googlegroups.com
Thanks for sharing Lloyd.

As far as I understand, cmake can use Xcode as a backend, so I am curious as to why the cmake XCode project generation did not work for you?
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/baba86aa-f80a-4d87-9b73-05e25367b915%40googlegroups.com.

Ricardo Sánchez-Sáez

unread,
Jul 7, 2014, 1:25:40 PM7/7/14
to ceres-...@googlegroups.com
In our case, we used plain cmake for iOS compiling (without Xcode as a backend).

See what we did below (not sure if it is the best approach).

If I have time I'll try to look into building the precompiled Cocoapod spec and/or looking into fixing Miguel Algaba compile-in-time Cocoapod spec (it may be worth to have both flavours just in case).

---

# starting in the ceres repo directory

# OS build
mkdir build
cd build
ccmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=/usr/local/include/eigen3 -DIOS_PLATFORM=OS -DCMAKE_INSTALL_PREFIX=/tmp/ceres-solver
# make install to assemble headers (headers will be in /tmp/ceres-solver/include)
make
make install 

# SIMULATOR build
mkdir build_simulator
cd build_simulator
ccmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=/usr/local/include/eigen3 -DIOS_PLATFORM=SIMULATOR
# make only (don't install)
make

# SIMULATOR64 build
mkdir build_simulator64
cd build_simulator64
ccmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=/usr/local/include/eigen3 -DIOS_PLATFORM=SIMULATOR64
# make only (don't install)
make

# flags I set manually on each build configuration (not sure if these should be used universally, double-check)
# CMAKE_CXX_FLAGS: -std=c++11
# CMAKE_CXX_FLAGS_RELEASE: -DNDEBUG -DEIGEN_NO_DEBUG -O3


# once everything has built:

# create universal library
lipo -create build/lib/libceres.a build_simulator/lib/libceres.a build_simulator64/lib/libceres.a -output libceres-universal.a

# required include paths for projects using ceres-solver:
# <base_dir>/include
# <base_dir>/include/ceres/internal/miniglog

---

Sameer Agarwal

unread,
Jul 7, 2014, 1:36:13 PM7/7/14
to ceres-...@googlegroups.com
Ricardo,


# flags I set manually on each build configuration (not sure if these should be used universally, double-check)
# CMAKE_CXX_FLAGS: -std=c++11
# CMAKE_CXX_FLAGS_RELEASE: -DNDEBUG -DEIGEN_NO_DEBUG -O3

You should not have to set the release flags.. If you are building in release mode they should be set automatically. Are they not?

Sameer

Sam Hare

unread,
Jul 7, 2014, 1:50:42 PM7/7/14
to ceres-...@googlegroups.com
Hi Sameer,

These instructions were based on my experience when compiling ceres-solver for iOS (Ricardo and I work together).

I opted not to use the Xcode backend for CMake and just generated a Makefile. Although CMake does report CMAKE_BUILD_TYPE as being Release, it doesn't seem to correctly set the release flags in the Makefile, so I was ending up with a debug build of the library. I therefore manually added these flags when running ccmake which seemed to do the trick for me.

I'm a bit new to CMake so I'm not sure if I'm doing something wrong, or if it's an issue with the CMake scripts?

Many thanks for the fantastic library.

Sam

Sameer Agarwal

unread,
Jul 7, 2014, 1:53:17 PM7/7/14
to ceres-...@googlegroups.com
Hi Sam,

Would you mind checking to see if adding the flag 

-DCMAKE_BUILD_TYPE=Release

to the command line fixes things for you? There maybe something going on with the ios cmake file. Alex can say more.

Sameer


--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/c201c206-de79-4dcf-9028-53a439bca06a%40googlegroups.com.

Sam Hare

unread,
Jul 7, 2014, 2:03:11 PM7/7/14
to ceres-...@googlegroups.com
Hi Sameer,

No this doesn't seem to change the behaviour for me. As before, ccmake shows the build type as Release, but when I build using make I get this sort of thing:

[  0%] Building CXX object internal/ceres/CMakeFiles/ceres.dir/array_utils.cc.o
cd /tmp/ceres-solver/build/internal/ceres && /usr/bin/clang++    -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -Werror -Wall -Wextra -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers   -arch armv7 -arch armv7s -arch arm64 -I/tmp/ceres-solver/include -I/tmp/ceres-solver/internal -I/tmp/ceres-solver/internal/ceres -I/tmp/ceres-solver/internal/ceres/miniglog -I/usr/local/include/eigen3 -I/tmp/ceres-solver/build/config    -o CMakeFiles/ceres.dir/array_utils.cc.o -c /tmp/ceres-solver/internal/ceres/array_utils.cc

i.e. it seems to be missing the release flags.

Sam

Sameer Agarwal

unread,
Jul 7, 2014, 2:19:14 PM7/7/14
to ceres-...@googlegroups.com, Alex Stewart
Thanks for checking Sam. 

Alex can you take a look at this please?

Sameer
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/d7928a0d-7392-435d-9965-9c6b36efe846%40googlegroups.com.

Sameer Agarwal

unread,
Jul 7, 2014, 5:15:53 PM7/7/14
to Alex Stewart, ceres-...@googlegroups.com, s...@obviousengine.com
+ceres-solver
+sam

On Mon, Jul 7, 2014 at 2:14 PM, Alex Stewart <alex...@gmail.com> wrote:
Sam,

Can you please try with the patch here: https://ceres-solver-review.googlesource.com/#/c/5270/1

With this patch I'm getting the correct flags passed through.

-Alex

Sam Hare

unread,
Jul 7, 2014, 5:42:30 PM7/7/14
to ceres-...@googlegroups.com, alex...@gmail.com, s...@obviousengine.com
Hi Alex, 

Yes this does the trick for me. Running the same test as before I now get release flags passed through:

[  0%] Building CXX object internal/ceres/CMakeFiles/ceres.dir/array_utils.cc.o
cd /tmp/ceres-solver/build/internal/ceres && /usr/bin/clang++    -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -Werror -Wall -Wextra -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -DNDEBUG -O3 -fomit-frame-pointer -ffast-math  -arch armv7 -arch armv7s -arch arm64 -I/tmp/ceres-solver/include -I/tmp/ceres-solver/internal -I/tmp/ceres-solver/internal/ceres -I/tmp/ceres-solver/internal/ceres/miniglog -I/usr/local/include/eigen3 -I/tmp/ceres-solver/build/config    -o CMakeFiles/ceres.dir/array_utils.cc.o -c /tmp/ceres-solver/internal/ceres/array_utils.cc

Thanks for the fix,

Sam

Sameer Agarwal

unread,
Jul 7, 2014, 5:45:44 PM7/7/14
to ceres-...@googlegroups.com
Thanks for checking Sam. I have merged it into the master branch.
Sameer



Miguel Algaba Borrego

unread,
Jul 8, 2014, 4:49:36 PM7/8/14
to ceres-...@googlegroups.com
Hi, I have tried to compile Ceres for iOS using CMake but I'm getting a configuration error. The following are the commands I have executed and the CMake error I get:


mkdir ceres-solver-build
cd ceres-solver-build

mkdir device
cd device
cmake ../../ceres-solver -DCMAKE_TOOLCHAIN_FILE=../../ceres-solver/cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=/usr/local/Cellar/eigen/3.2.1/include/eigen3/ -DIOS_PLATFORM=OS -DCMAKE_INSTALL_PREFIX=~/Libraries/ceres-solver-install

-- Toolchain using default iOS SDK: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
CMake Error at CMakeLists.txt:39 (PROJECT):
  The CMAKE_C_COMPILER:

    clang

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:39 (PROJECT):
  The CMAKE_CXX_COMPILER:

    clang++

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/Users/miguelalgaba/Libraries/ceres-solver-build/device/CMakeFiles/CMakeOutput.log".

I have checked that that both CMAKE_CXX_COMPILER and CMAKE_C_COMPILER variables ares set to /usr/bin/clang++ and /usr/bin/clang respectively and that clang and clang++ are present within the /usr/bin directory

$ ls /usr/bin/clang*
/usr/bin/clang   /usr/bin/clang++

I have read Ricardo's script where he describes each step but it seems very similar to what I'm doing. Is this the right way to compile it?

Also, Ricardo if you have time to look at what I did please let me know. I will be really nice to get it to work :)

Thanks a lot in advance!
Miguel Algaba.

Alex Stewart

unread,
Jul 8, 2014, 4:58:14 PM7/8/14
to ceres-...@googlegroups.com
Do you have the Xcode command line tools installed?  I suspect not which is why clang and clang++ are not defined.

-Alex

Alex Stewart

unread,
Jul 8, 2014, 5:04:17 PM7/8/14
to ceres-...@googlegroups.com
Apologies I didn't see the last part of your email, have you checked that clang is on your current path?  'which clang' returns /usr/bin/clang?  Is this all in your usual shell not a script?

-Alex

Sam Hare

unread,
Jul 8, 2014, 5:16:15 PM7/8/14
to ceres-...@googlegroups.com
Bizarrely I found this exact same thing today when I tried to build from scratch as well, while yesterday it was working for me fine. 

I've just done some experimenting and it seems that the problem started because I upgrade cmake to version 3.0.0 yesterday (using homebrew). I just rolled back to 2.8.12.2 and it works again.

With cmake 3.0.0 if I change the lines: 

CMAKE_FORCE_C_COMPILER (clang Apple)
CMAKE_FORCE_CXX_COMPILER (clang++ Apple)

to 

CMAKE_FORCE_C_COMPILER (/usr/bin/clang Apple)
CMAKE_FORCE_CXX_COMPILER (/usr/bin/clang++ Apple)

It works, but it doesn't seem to find them on the path otherwise.

Sam

Miguel Algaba Borrego

unread,
Jul 8, 2014, 5:28:21 PM7/8/14
to ceres-...@googlegroups.com
Sam is right, I also updated cmake to the 3.0.0 recently and changing those lines within iOS.cmake fixes the issue. Any ideas why CMake doesn't find these paths?

Best,
Miguel Algaba.


Alex Stewart

unread,
Jul 9, 2014, 1:14:27 PM7/9/14
to ceres-...@googlegroups.com
I think this is an intended CMake 3.0 change, in versions >= 3, CMAKE_C/CXX_COMPILER should always be a full path to the compiler:


The cmake_force_c/cxx_compiler() function bypasses some of the checks for validity of these variables (http://www.cmake.org/cmake/help/v3.0/manual/cmake-toolchains.7.html) although this is not really documented clearly in the CMake docs.

In practice, I don't think either of these lines are actually required any more (as there is no longer a GCC option), a quick test on my machine builds Ceres for iOS without them.  If you could confirm that you can successfully build and use Ceres for iOS without them present, I will remove them in master.

-Alex

Sam Hare

unread,
Jul 9, 2014, 2:35:52 PM7/9/14
to ceres-...@googlegroups.com
Hi Alex,

No this doesn't seem to work for me. The compilation worked fine but I wasn't able to link against the resulting library in an iOS project as it doesn't seem to contain the correct architectures. Xcode gives various linker errors saying "file was built for archive which is not the architecture being linked".

Sam

Alex Stewart

unread,
Jul 9, 2014, 2:47:30 PM7/9/14
to ceres-...@googlegroups.com
Interesting, OpenCV no longer explicitly set the compiler in their iOS.cmake / toolchain file, I'll have another look.

What did you set IOS_PLATFORM to?  Do you have a simulator / simulator64 mismatch somewhere?

-Alex

Sam Hare

unread,
Jul 9, 2014, 3:01:12 PM7/9/14
to ceres-...@googlegroups.com
I was passing in -DIOS_PLATFORM=OS from the command line, and with the same command it worked fine when I had the force compiler lines in with absolute paths.

Just comparing the variables in ccmake between both approaches it seems things get set up quite differently, and in particular without forcing the compiler I get:

CMAKE_CXX_COMPILER: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
CMAKE_C_COMPILER: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
CMAKE_LINKER-NOTFOUND
CMAKE_NM-NOTFOUND
and nothing for CMAKE_RANLIB

Also all the compiler flags look quite different.

I don't know if this is all specific to my machine or not though...

Sam






--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/HW6Q51QawYw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/7EBE24C8-8C69-4543-820D-2D969BA4A903%40gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Sam Hare
Obvious Engineering
Waterhouse, 8 Orsman Road, London N1 5QJ
+44-20-3286 2035
http://obviousengine.com
@ObviousVision

Ricardo Sánchez-Sáez

unread,
Aug 5, 2014, 5:20:19 PM8/5/14
to ceres-...@googlegroups.com, fabian....@googlemail.com
Hey guys,

we found a pretty serious problem: Ceres for iOS uses LAPACK, which in turn uses the dsyrk_ symbol, which is flagged by Apple as a private API. Including Ceres in your iOS App will make it not Validate during the App Store submission process.

Help?

Cheers.

Sameer Agarwal

unread,
Aug 5, 2014, 5:33:54 PM8/5/14
to ceres-...@googlegroups.com, fabian....@googlemail.com
A couple of things.

1. Apple is wrong.  dsyrk is a standard, well documented BLAS routine. 

They themselves provide a cblas API to talk to it


Now for some reason they may have an issue with using the fortran dsyrk_ routine instead of using the cblas interface. Which is again, idiotic, because BLAS implementations are far more prevalent than cblas interfaces.

One way around this is to use the cblas interface on apple/ios implementations. This should be relatively straightforward to do. The changes would be limited to internal/ceres/lapack.cc

2. Another option is to build with CERES_NO_LAPACK defined. That way, this function will never be used. In any case this is only used by DENSE_NORMAL_CHOLESKY, which you should have the need to use in fairly specialized circumstances anyways.

HTH,
Sameer



--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/3bf63c86-6d75-4774-b602-9cb18bb8380b%40googlegroups.com.

Ricardo Sánchez-Sáez

unread,
Aug 5, 2014, 6:19:44 PM8/5/14
to ceres-...@googlegroups.com, fabian....@googlemail.com
Thanks for the quickest reply!

We will look into it and let you know how it went.


On Tuesday, August 5, 2014 10:33:54 PM UTC+1, Sameer Agarwal wrote:
A couple of things.

1. Apple is wrong.  dsyrk is a standard, well documented BLAS routine. 

They themselves provide a cblas API to talk to it


Now for some reason they may have an issue with using the fortran dsyrk_ routine instead of using the cblas interface. Which is again, idiotic, because BLAS implementations are far more prevalent than cblas interfaces.

One way around this is to use the cblas interface on apple/ios implementations. This should be relatively straightforward to do. The changes would be limited to internal/ceres/lapack.cc

2. Another option is to build with CERES_NO_LAPACK defined. That way, this function will never be used. In any case this is only used by DENSE_NORMAL_CHOLESKY, which you should have the need to use in fairly specialized circumstances anyways.

HTH,
Sameer


On Tue Aug 05 2014 at 2:20:21 PM Ricardo Sánchez-Sáez <agen...@gmail.com> wrote:
Hey guys,

we found a pretty serious problem: Ceres for iOS uses LAPACK, which in turn uses the dsyrk_ symbol, which is flagged by Apple as a private API. Including Ceres in your iOS App will make it not Validate during the App Store submission process.

Help?

Cheers.
 


On Thursday, May 10, 2012 11:02:33 AM UTC+1, Fabian Langguth wrote:
Hi,

I have Ceres compiled and running on my iPhone. It's a pretty hacky version and I would not call it a port, but if anyone is interested you can ask me :)

Best,
Fabian

--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.

Ricardo Sánchez-Sáez

unread,
Aug 7, 2014, 6:17:05 AM8/7/14
to ceres-...@googlegroups.com, fabian....@googlemail.com
Using the CERES_NO_LAPACK worked fine. Thanks again!

So I guess we are one of the first iOS apps to be submitted to the app store using Ceres? (Given that nobody else seem to mention this problem online). ;D

Alessandro Dal Grande

unread,
Aug 26, 2014, 7:59:15 PM8/26/14
to ceres-...@googlegroups.com, fabian....@googlemail.com
I just tried to compile master, but I get this error from the linker:

Linking CXX static library ../../lib/libceres.a

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture array_utils.cc.o1409096694  502   20    100644  53780     `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture blas.cc.o       1409096698  502   20    100644  103184    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture block_jacobi_preconditioner.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture block_jacobian_writer.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture block_random_access_dense_matrix.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture block_random_access_diagonal_matrix.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture block_random_access_sparse_matrix.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture block_sparse_matrix.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture c_api.cc.o      1409096728  502   20    100644  62652     `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture cgnr_solver.cc.o1409096741  502   20    100644  157508    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture callbacks.cc.o  1409096735  502   20    100644  107416    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture compressed_col_sparse_matrix_utils.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture compressed_row_jacobian_writer.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture compressed_row_sparse_matrix.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture conditioned_cost_function.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture conjugate_gradients_solver.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture coordinate_descent_minimizer.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture corrector.cc.o  1409096760  502   20    100644  104376    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture covariance_impl.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture dense_normal_cholesky_solver.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture dense_qr_solver.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture dense_sparse_matrix.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture detect_structure.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture dogleg_strategy.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture dynamic_compressed_row_sparse_matrix.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture evaluator.cc.o  1409096837  502   20    100644  259148    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture file.cc.o       1409096823  502   20    100644  106748    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture gradient_checking_cost_function.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture implicit_schur_complement.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture incomplete_lq_factorization.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture iterative_schur_complement_solver.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture levenberg_marquardt_strategy.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture lapack.cc.o     1409096865  502   20    100644  104324    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture line_search.cc.o1409096875  502   20    100644  202104    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture line_search_direction.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture line_search_minimizer.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture line_search_preprocessor.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture linear_least_squares_problems.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture linear_solver.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture local_parameterization.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture loss_function.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture low_rank_inverse_hessian.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture minimizer.cc.o  1409096924  502   20    100644  110168    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture normal_prior.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture parameter_block_ordering.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture polynomial.cc.o 1409096994  502   20    100644  284016    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture preconditioner.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture preprocessor.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture problem_impl.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture program.cc.o    1409096975  502   20    100644  201808    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture reorder_program.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture residual_block.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture residual_block_utils.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_complement_solver.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_jacobi_preconditioner.cc.o???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture solver.cc.o     1409097033  502   20    100644  393992    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture sparse_normal_cholesky_solver.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture stringprintf.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture triplet_sparse_matrix.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture trust_region_preprocessor.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture trust_region_minimizer.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture trust_region_strategy.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture types.cc.o      1409097048  502   20    100644  148396    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture wall_time.cc.o  1409097057  502   20    100644  105472    `

???? malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_2_2.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_2_3.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_2_4.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_2_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_3_3.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_3_4.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_3_9.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_3_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_4_3.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_4_4.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_4_8.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_4_9.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_4_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_2_d_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_4_4_2.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_4_4_3.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_4_4_4.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_4_4_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture partitioned_matrix_view_d_d_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_2_2.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_2_3.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_2_4.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_2_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_3_3.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_3_4.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_3_9.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_3_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_4_3.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_4_4.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_4_8.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_4_9.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_4_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_2_d_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_4_4_2.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_4_4_3.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_4_4_4.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_4_4_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture schur_eliminator_d_d_d.cc.o malformed object (unknown load command 1)

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: for object: ../../lib/libceres.a(arm64) architecture logging.cc.o    1409097414  502   20    100644  50524     `

???? malformed object (unknown load command 1)

make[2]: *** [lib/libceres.a] Error 1

make[1]: *** [internal/ceres/CMakeFiles/ceres.dir/all] Error 2

make: *** [all] Error 2

Alessandro Dal Grande

unread,
Aug 26, 2014, 8:53:48 PM8/26/14
to ceres-...@googlegroups.com, fabian....@googlemail.com
If I comment out the compiler overriding settings it compiles, but it links with this warning:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib: warning for library: /tmp/ceres-solver/lib/libceres.a the table of contents is empty (no object file members in the library define global symbols)

And then it's not usable in XCode.

Alex Stewart

unread,
Aug 27, 2014, 5:26:41 AM8/27/14
to ceres-...@googlegroups.com
Alessandro,

Could you check if the fix outlined here works for you:  http://llvm.org/bugs/show_bug.cgi?id=19179

From the paths in your email:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib

It looks this could well be your issue.

-Alex

Alessandro Dal Grande

unread,
Aug 27, 2014, 4:06:30 PM8/27/14
to ceres-...@googlegroups.com
Hi Alex, where should I change that setting? I compiled successfully by dumping everything in an empty XCode project, by the way.

Thanks

Thorsten Lubinski

unread,
Sep 27, 2014, 7:48:24 PM9/27/14
to ceres-...@googlegroups.com

Hi,

I just tried to get ceres running with Xcode 6 and iOS 8. I'm able to compile the static library but I fail to actually use the lib :(.

COMPILING (following the instructions from Ricardo with a few minor changes):

- download cedes-solver-1.9.0
- changes to  ./cmake/iOS.cmake:
#absolute path to clang
CMAKE_FORCE_C_COMPILER (/usr/bin/clang clang)
CMAKE_FORCE_CXX_COMPILER (/usr/bin/clang++ clang++)
#additional flag
set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden -std=cx11")

- compile with cmake
# OS build
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=/usr/local/Cellar/eigen/3.2.2/include/eigen3 -DIOS_PLATFORM=OS -DCMAKE_INSTALL_PREFIX=/tmp/ceres-solver -DCMAKE_BUILD_TYPE=Release
# make install to assemble headers (headers will be in /tmp/ceres-solver/include)
make
make install 

# SIMULATOR build
mkdir build_simulator
cd build_simulator
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=/usr/local/Cellar/eigen/3.2.2/include/eigen3 -DIOS_PLATFORM=SIMULATOR -DCMAKE_BUILD_TYPE=Release
# make only (don't install)
make

# SIMULATOR64 build
mkdir build_simulator64
cd build_simulator64
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=/usr/local/Cellar/eigen/3.2.2/include/eigen3 -DIOS_PLATFORM=SIMULATOR64 -DCMAKE_BUILD_TYPE=Release
# make only (don't install)
make

# once everything has built:

# create universal libraries
lipo -create build/lib/libceres.a build_simulator/lib/libceres.a build_simulator64/lib/libceres.a -output libceres-universal.a
lipo -create build/lib/libminiglog.a build_simulator/lib/libminiglog.a build_simulator64/lib/libminiglog.a -output libminiglog-universal.a

INTEGRATION
- create a new Xcode-project (Objective-C)
- drag'n'drop both universal libraries
- add the following headers:

/tmp/ceres-solver/include #for ceres
/tmp/ceres-solver/include/ceres/internal/miniglog #for miniglog
/tmp/ceres-solver #for Eigen

- create a new cpp-file (hello.cpp and hello.h)

//  hello.cpp


#include "hello.h"

#include "ceres/ceres.h"

#include "glog/logging.h"


using ceres::NumericDiffCostFunction;

using ceres::CENTRAL;

using ceres::CostFunction;

using ceres::Problem;

using ceres::Solver;

using ceres::Solve;


// A cost functor that implements the residual r = 10 - x.

struct CostFunctor {

    bool operator()(const double* const x, double* residual) const {

        residual[0] = 10.0 - x[0];

        return true;

    }

};


int hallo() {

    // The variable to solve for with its initial value. It will be

    // mutated in place by the solver.

    double x = 0.5;

    const double initial_x = x;

    // Build the problem.

    Problem problem;


    //...rest of the example...

    

    std::cout << "x : " << initial_x

    << " -> " << x << "\n";

    return 0;

}


BUILD XCODE-PROJECT


I get a ton of Linker-errors:


Undefined symbols for architecture x86_64:

  "std::string::size() const", referenced from:

      MessageLogger::LogToSinks(int) in libceres.a(problem_impl.cc.o)

      std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libceres.a(residual_block.cc.o)...


"std::string::c_str() const", referenced from:

      MessageLogger::LogToSinks(int) in libceres.a(problem_impl.cc.o)

      MessageLogger::LogToSinks(int) in libceres.a(residual_block.cc.o)...


[... a lot more...]


It seems a standard-lib is missing but I don't know how to fix that. I tested with different settings for "C++ Language Dialect" and "C++ Standard Library" but no luck.


Any advice?


Best

Thorsten



Sam Hare

unread,
Sep 29, 2014, 7:21:54 PM9/29/14
to ceres-...@googlegroups.com
Hi Thorsten,

I'm not sure if it's just a typo in your message, but in your additional flags you should use "-std=c++11" -- maybe this is the problem?

Sam

Thorsten Lubinski

unread,
Sep 30, 2014, 9:03:19 PM9/30/14
to ceres-...@googlegroups.com

Hi Sam,

thanks for your suggestion. So I recompiled the library with c++11 and it got much bigger (~235 MB), which is probably a good sign. Then I went to Xcode and changed "C++ Dialect" to "C++11" and "C++ Standard Library" to "libc++". Unfortunately I get the same errors:

Undefined symbols for architecture x86_64:

  "std::string::size() const", referenced from:

...

If I change the "C++ Standard Library" to "libstdc++" I get compiler errors:

No member named 'shared_ptr' in namespace 'std'
...

More ideas?

Best
Thorsten 

Thorsten Lubinski

unread,
Sep 30, 2014, 10:54:56 PM9/30/14
to ceres-...@googlegroups.com

ok, clang has it's own std-lib. I had to add "-stdlib=libc++" to the flags and now it works.

set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -stdlib=libc++")

Keir Mierle

unread,
Oct 1, 2014, 10:58:52 AM10/1/14
to ceres-...@googlegroups.com
Hi Thorsten,

Nice that you got it working! Would you be willing to update the build and/or docs to handle this? Ideally the out-of-box experience would be better, but I can't test this myself.

Thanks,
Keir

--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.

Greg Coombe

unread,
Mar 16, 2015, 9:06:56 PM3/16/15
to ceres-...@googlegroups.com
Sorry to dredge up an old thread, but we hit this problem recently when submitting an app to the Apple Store.

In our case, we're not using DENSE_NORMAL_CHOLESKY, so we just went ahead and turned off LAPACK.

We found that using "cmake -DCERES_NO_LAPACK ..." did not work fully, and we had to use "cmake -DLAPACK=OFF ...".



Sameer Agarwal

unread,
Mar 16, 2015, 11:57:18 PM3/16/15
to ceres-...@googlegroups.com
Hi Greg,
I am a bit surprised by -DCERES_NO_LAPACK not being enough. I will look into it.
Sameer


Sameer Agarwal

unread,
Mar 17, 2015, 12:16:22 AM3/17/15
to ceres-...@googlegroups.com
Greg,
Could you try

https://ceres-solver-review.googlesource.com/#/c/6390/

to see if this solves your problem.

Sameer


To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver+unsubscribe@googlegroups.com.

Alex Stewart

unread,
Mar 17, 2015, 6:12:41 AM3/17/15
to ceres-...@googlegroups.com
Greg,

It looks like we were missing an #ifdef guard around dsyrk(), but just to clarify, passing -DLAPACK=OFF to CMake on the command line (or turning it off in the GUI) is the intended way to disable LAPACK when using CMake to build Ceres, not passing -DCERES_NO_LAPACK.

Under the hood, LAPACK=OFF results in CERES_NO_LAPACK being enabled in the config.h (<BUILD_DIR>/config/ceres/internal/config.h, which is installed to the same location as the public Ceres headers) generated by CMake for the current build.

Passing -DCERES_NO_LAPACK directly to CMake would only result in CERES_NO_LAPACK being defined in CMake’s scope, it would not be present in config.h or passed onto the compiler.  Note that if you are building Ceres without CMake (e.g. for Android) then you would need to pass the flags directly to the compiler and provide an empty config.h, which is what we do in Android.mk (or you could configure your own config.h manually).

Currently when building Ceres for iOS, we disable SUITESPARSE, CXSPARSE, GFLAGS & OPENMP, if the rules for submission to the App store have changed, we should probably add LAPACK to this list as well.

-Alex

To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUCvH2VTsY1q0GmNaYU8omsaNfhbuphV1pXSfPp69b0yJA%40mail.gmail.com.

Greg Coombe

unread,
Mar 17, 2015, 2:50:46 PM3/17/15
to ceres-...@googlegroups.com
I think this will work:

https://ceres-solver-review.googlesource.com/6391

It's just a brute-force disabling of LAPACK for iOS (like Alex suggested). Perhaps Apple will come to their senses later, and we can revert this.



Ricardo Sánchez-Sáez

unread,
Sep 10, 2015, 7:32:55 AM9/10/15
to ceres-...@googlegroups.com
Hi,

I'm trying to compile the latest master for iOS using Xcode 7 GM, but it doesn't seem work.

Here's the updated version of the script that Sam made and that continued to work on Xcode 6.x:

---

#!/bin/bash

EIGEN_PATH=/opt/local/include/eigen3

# build for device
mkdir -p build
cd build
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=${EIGEN_PATH} -DIOS_PLATFORM=OS -DEIGENSPARSE=ON -DCMAKE_INSTALL_PREFIX=..
make -j8
# install headers in ..
make install
# delete the installed lib (we want a universal one)
rm ../lib/libceres.a
cd ..

# build for simulator
mkdir -p build_simulator
cd build_simulator
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=${EIGEN_PATH} -DEIGENSPARSE=ON -DIOS_PLATFORM=SIMULATOR
make -j8
cd ..

# build for simulator64
mkdir -p build_simulator64
cd build_simulator64
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/iOS.cmake -DEIGEN_INCLUDE_DIR=${EIGEN_PATH} -DEIGENSPARSE=ON -DIOS_PLATFORM=SIMULATOR64
make -j8
cd ..

# create universal library
mkdir -p lib
lipo -create build/lib/libceres.a build_simulator/lib/libceres.a build_simulator64/lib/libceres.a -output lib/libceres-universal.a

# clean up
rm -rf build build_simulator build_simulator64

---

When trying to use with Xcode 7 GM installed in /Applications/Xcode.app, each individual lib compiles fine, but it fails when trying to build the universal library:

fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: archive with no architecture specification: build/lib/libceres.a (can't determine architecture for it)


I get this when I try to get the info:

--$ lipo -info build/lib/libceres.a 

fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: archive with no architecture specification: build/lib/libceres.a (can't determine architecture for it)


Simulator builds are correct though:

--$ lipo -info build_simulator/lib/libceres.a 

input file build_simulator/lib/libceres.a is not a fat file

Non-fat file: build_simulator/lib/libceres.a is architecture: i386


---

By looking at the CMake I suspected the `ar` path wasn't being set properly, so I replaced these lines:

# Force the compilers to gcc for iOS
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (/usr/bin/clang Apple)
CMAKE_FORCE_CXX_COMPILER (/usr/bin/clang++ Apple)
set(CMAKE_AR ar CACHE FILEPATH "" FORCE)

by this one:

set(CMAKE_AR /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar CACHE FILEPATH "" FORCE)

and tried again. This produced a linking error when trying to create the library archive using the correct 'ar':

[ 19%] Linking CXX static library ../../lib/libceres.a
cd ceres-solver-src/ios/build/internal/ceres && /opt/local/bin/cmake -P CMakeFiles/ceres.dir/cmake_clean_target.cmake
cd ceres-solver-src/ios/build/internal/ceres && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/ceres.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar cq ../../lib/libceres.a  CMakeFiles/ceres.dir/array_utils.cc.o CMakeFiles/ceres.dir/blas.cc.o CMakeFiles/ceres.dir/block_evaluate_preparer.cc.o CMakeFiles/ceres.dir/block_jacobi_preconditioner.cc.o CMakeFiles/ceres.dir/block_jacobian_writer.cc.o CMakeFiles/ceres.dir/block_random_access_dense_matrix.cc.o CMakeFiles/ceres.dir/block_random_access_diagonal_matrix.cc.o CMakeFiles/ceres.dir/block_random_access_matrix.cc.o CMakeFiles/ceres.dir/block_random_access_sparse_matrix.cc.o CMakeFiles/ceres.dir/block_sparse_matrix.cc.o CMakeFiles/ceres.dir/block_structure.cc.o CMakeFiles/ceres.dir/c_api.cc.o CMakeFiles/ceres.dir/canonical_views_clustering.cc.o CMakeFiles/ceres.dir/cgnr_solver.cc.o CMakeFiles/ceres.dir/callbacks.cc.o CMakeFiles/ceres.dir/compressed_col_sparse_matrix_utils.cc.o CMakeFiles/ceres.dir/compressed_row_jacobian_writer.cc.o CMakeFiles/ceres.dir/compressed_row_sparse_matrix.cc.o CMakeFiles/ceres.dir/conditioned_cost_function.cc.o CMakeFiles/ceres.dir/conjugate_gradients_solver.cc.o CMakeFiles/ceres.dir/coordinate_descent_minimizer.cc.o CMakeFiles/ceres.dir/corrector.cc.o CMakeFiles/ceres.dir/covariance.cc.o CMakeFiles/ceres.dir/covariance_impl.cc.o CMakeFiles/ceres.dir/cxsparse.cc.o CMakeFiles/ceres.dir/dense_normal_cholesky_solver.cc.o CMakeFiles/ceres.dir/dense_qr_solver.cc.o CMakeFiles/ceres.dir/dense_sparse_matrix.cc.o CMakeFiles/ceres.dir/detect_structure.cc.o CMakeFiles/ceres.dir/dogleg_strategy.cc.o CMakeFiles/ceres.dir/dynamic_compressed_row_jacobian_writer.cc.o CMakeFiles/ceres.dir/dynamic_compressed_row_sparse_matrix.cc.o CMakeFiles/ceres.dir/evaluator.cc.o CMakeFiles/ceres.dir/file.cc.o CMakeFiles/ceres.dir/gradient_checking_cost_function.cc.o CMakeFiles/ceres.dir/gradient_problem.cc.o CMakeFiles/ceres.dir/gradient_problem_solver.cc.o CMakeFiles/ceres.dir/implicit_schur_complement.cc.o CMakeFiles/ceres.dir/iterative_schur_complement_solver.cc.o CMakeFiles/ceres.dir/levenberg_marquardt_strategy.cc.o CMakeFiles/ceres.dir/lapack.cc.o CMakeFiles/ceres.dir/line_search.cc.o CMakeFiles/ceres.dir/line_search_direction.cc.o CMakeFiles/ceres.dir/line_search_minimizer.cc.o CMakeFiles/ceres.dir/line_search_preprocessor.cc.o CMakeFiles/ceres.dir/linear_least_squares_problems.cc.o CMakeFiles/ceres.dir/linear_operator.cc.o CMakeFiles/ceres.dir/linear_solver.cc.o CMakeFiles/ceres.dir/local_parameterization.cc.o CMakeFiles/ceres.dir/loss_function.cc.o CMakeFiles/ceres.dir/low_rank_inverse_hessian.cc.o CMakeFiles/ceres.dir/minimizer.cc.o CMakeFiles/ceres.dir/normal_prior.cc.o CMakeFiles/ceres.dir/parameter_block_ordering.cc.o CMakeFiles/ceres.dir/partitioned_matrix_view.cc.o CMakeFiles/ceres.dir/polynomial.cc.o CMakeFiles/ceres.dir/preconditioner.cc.o CMakeFiles/ceres.dir/preprocessor.cc.o CMakeFiles/ceres.dir/problem.cc.o CMakeFiles/ceres.dir/problem_impl.cc.o CMakeFiles/ceres.dir/program.cc.o CMakeFiles/ceres.dir/reorder_program.cc.o CMakeFiles/ceres.dir/residual_block.cc.o CMakeFiles/ceres.dir/residual_block_utils.cc.o CMakeFiles/ceres.dir/schur_complement_solver.cc.o CMakeFiles/ceres.dir/schur_eliminator.cc.o CMakeFiles/ceres.dir/schur_jacobi_preconditioner.cc.o CMakeFiles/ceres.dir/scratch_evaluate_preparer.cc.o CMakeFiles/ceres.dir/single_linkage_clustering.cc.o CMakeFiles/ceres.dir/solver.cc.o CMakeFiles/ceres.dir/solver_utils.cc.o CMakeFiles/ceres.dir/sparse_matrix.cc.o CMakeFiles/ceres.dir/sparse_normal_cholesky_solver.cc.o CMakeFiles/ceres.dir/split.cc.o CMakeFiles/ceres.dir/stringprintf.cc.o CMakeFiles/ceres.dir/suitesparse.cc.o CMakeFiles/ceres.dir/triplet_sparse_matrix.cc.o CMakeFiles/ceres.dir/trust_region_preprocessor.cc.o CMakeFiles/ceres.dir/trust_region_minimizer.cc.o CMakeFiles/ceres.dir/trust_region_strategy.cc.o CMakeFiles/ceres.dir/types.cc.o CMakeFiles/ceres.dir/visibility.cc.o CMakeFiles/ceres.dir/visibility_based_preconditioner.cc.o CMakeFiles/ceres.dir/wall_time.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_2_2.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_2_3.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_2_4.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_2_d.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_3_3.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_3_4.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_3_6.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_3_9.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_3_d.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_4_3.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_4_4.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_4_8.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_4_9.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_4_d.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_2_d_d.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_4_4_2.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_4_4_3.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_4_4_4.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_4_4_d.cc.o CMakeFiles/ceres.dir/generated/partitioned_matrix_view_d_d_d.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_2_2.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_2_3.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_2_4.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_2_6.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_2_d.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_3_3.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_3_4.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_3_6.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_3_9.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_3_d.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_4_3.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_4_4.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_4_8.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_4_9.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_4_d.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_2_d_d.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_4_4_2.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_4_4_3.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_4_4_4.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_4_4_d.cc.o CMakeFiles/ceres.dir/generated/schur_eliminator_d_d_d.cc.o CMakeFiles/ceres.dir/miniglog/glog/logging.cc.o
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: library member: ../../lib/libceres.a(array_utils.cc.o) is not an object file (not allowed in a library with multiple architectures)


Any ideas on what to try next?

---

By the way, I think you should update the CMake file so the Xcode and ar paths are obtained through the 'xcode-select -p' command, instead of defaulting to '/Applications/Xcode.app' like it does now. This would make testing with betas with multiple Xcode versions installed easier.

---

Best!
Ricardo


You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/HW6Q51QawYw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CAGzi3puzXMHYCav34Xqb336GG_GuVLeCSZRasHY%3D6ESVety0%2Bg%40mail.gmail.com.

Ricardo Sánchez-Sáez

unread,
Sep 14, 2015, 2:03:00 PM9/14/15
to ceres-...@googlegroups.com
Sorry to insist. I'm not familiar with CMake and am out of ideas, any tips on what to try next?

Getting Ceres to recompile from Xcode 7 would get rid a ton of linker warnings that are produced when using a static library compiled with Xcode 6.x from within Xcode 7.

Thanks!

Alex Stewart

unread,
Sep 14, 2015, 4:38:20 PM9/14/15
to ceres-...@googlegroups.com
Ricardo,

1) What is the output of:

file build/lib/libceres.a

(i.e. the library compiled for the device)?  I would expect it to be something like this:

lib/libceres.a: Mach-O universal binary with 3 architectures
lib/libceres.a (for architecture armv7): current ar archive random library
lib/libceres.a (for architecture armv7s): current ar archive random library
lib/libceres.a (for architecture arm64): current ar archive random library

2) Have you installed the corresponding: Command Line Tools for Xcode 7 GM available from here:


?  If you haven’t, and you’ve got some hybrid of Xcode 6 tools with Xcode 7 SDKs, I would not expect good things.

3) If you have installed the Xcode 7 command line tools and you still have Xcode 6 installed, have you run xcode-select to update the command line tool links in /usr/bin to the version you want to use since installed the Xcode 7 command line tools?  It would appear that at least some of them (lipo below) are consistent with where you said Xcode 7 was, but it might be possible that some are inconsistent.

-Alex


Ricardo Sánchez-Sáez

unread,
Sep 15, 2015, 12:10:47 PM9/15/15
to ceres-...@googlegroups.com
Hey Alex,

thanks for your help!

1) This is the output of 'file' on the file compiled with the original CMake:

--$ file build/lib/libceres.a 

build/lib/libceres.a: current ar archive


--$ file build_simulator/lib/libceres.a 

build_simulator/lib/libceres.a: current ar archive random library



---

2 & 3) I manually reinstalled Xcode 7 GM command line tools, and chose them using xcode-select. Same results as my previous email.

Alex Stewart

unread,
Sep 15, 2015, 4:36:35 PM9/15/15
to ceres-...@googlegroups.com
Ricardo,

What about:

otool -fh build/lib/libceres.a

?  Are there actually objects for multiple architectures (armv7 armv7s arm64) listed?  I’m wondering whether you’re encountering a similar issue to this one:


although unfortunately that has a rather unsatisfying resolution.  Did you also use the Xcode 7 beta prior to installing the GM?

For the second error you encountered earlier:

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: library member: ../../lib/libceres.a(array_utils.cc.o) is not an object file (not allowed in a library with multiple architectures)

specifically this part:

Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib

I would expect you to be using this version of ranlib when building multiple architectures for the device:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib

as indeed happens on Xcode 6 on my machine.

What we’re doing is not, I think, materially different to most other projects using CMake to build for iOS.  Using xcode-select -p to determine the path for ar is not I think necessary, as the act of running xcode-select should update the contents of /usr/bin to run the matching tools from the specified developer directory.  As a result, /usr/bin/ar and <PATH_TO_ACTIVE_DEVELOPER_DIR>/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar should refer to the same entity.  However, it would be better to use xcode-select to determine the active developer directory from which to search for the SDKs.

-Alex

-- 
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.

Ricardo Sánchez-Sáez

unread,
Sep 15, 2015, 6:40:43 PM9/15/15
to ceres-...@googlegroups.com
Dear Alex,

thanks again for your help.

otool outputs this:

--$ otool -fh build/lib/libceres.a

Archive : build/lib/libceres.a

build/lib/libceres.a(array_utils.cc.o): is not an object file

build/lib/libceres.a(blas.cc.o): is not an object file


... and the same error for all the rest of .cc.o files.

---

The '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/' folder doesn't contain the 'ar' or 'ranlib' utilities. I can see them on '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/'.

---

As the forum thread says, I had Xcode 7 beta installed alongside the GM, but I deleted it. As a last resort, I'll try deleting all Xcode versions, restarting, and reinstalling Xcode 7 GM, and restarting again. I'll let you know how that goes.

---

Have you tried building Ceres with Xcode 7 GM?

Thanks again,
Ricardo


You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/HW6Q51QawYw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/95C552E9-F0FF-4406-8BC3-EE53CE12E429%40gmail.com.

Ricardo Sánchez-Sáez

unread,
Sep 16, 2015, 7:09:19 PM9/16/15
to ceres-...@googlegroups.com
Same results with the just released Xcode 7.0

Sam Hare

unread,
Sep 17, 2015, 3:25:22 PM9/17/15
to ceres-...@googlegroups.com
Hi Alex,

I think perhaps this might have something to do with the combination of ar + ranlib.

If I try and manually create a (partial) archive using the command which ceres is using I get the following:

>> ar cq ../../lib/libceres.a  CMakeFiles/ceres.dir/array_utils.cc.o
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: library member: ../../lib/libceres.a(array_utils.cc.o) is not an object file (not allowed in a library with multiple architectures)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: library member: ../../lib/libceres.a(array_utils.cc.o) is not an object file (not allowed in a library with multiple architectures)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: library member: ../../lib/libceres.a(array_utils.cc.o) is not an object file (not allowed in a library with multiple architectures)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar: internal ranlib command failed\]

Resulting in:

>> file ../../lib/libceres.a
../../lib/libceres.a: current ar archive

If instead I use libtool -static (which I think is intended to be a replacement for ar + ranlib on the mac) I get:

>> libtool -static -o ../../lib/libceres.a  CMakeFiles/ceres.dir/array_utils.cc.o
>> file ../../lib/libceres.a
../../lib/libceres.a: Mach-O universal binary with 3 architectures
../../lib/libceres.a (for architecture armv7): current ar archive random library
../../lib/libceres.a (for architecture armv7s): current ar archive random library
../../lib/libceres.a (for architecture arm64): current ar archive random library

Which looks more promising.

So is it maybe possible to use libtool -static rather than ar + ranlib when compiling for iOS?

Sam

Alex Stewart

unread,
Sep 20, 2015, 3:20:46 PM9/20/15
to ceres-...@googlegroups.com
Ricardo & Sam,

Apologies for the delayed response, please can you try the following CL: https://ceres-solver-review.googlesource.com/#/c/7050/ (see below for instructions if you haven’t used Gerrit before).

It should hopefully fix all of the issues (it certainly does for me on Xcode 7) - if you could also test on Xcode 6 if you still have that available it would be very helpful too - thanks.

-Alex

== Instructions for using a CL from Gerrit (if you haven’t used it before):

1) Download (top right in Gerrit) > Checkout (copies command to clipboard).
2) cd <CERES_SOURCE_DIR> && git pull && <PASTE_CMD>
3) Your Ceres repo will now be in ‘detached head’ mode, with the changes applied (git checkout master will get you back to a clean master).
4) Rebuild Ceres (in this case please blow away your build directory before rebuilding).


Keir Mierle

unread,
Sep 20, 2015, 8:40:39 PM9/20/15
to ceres-...@googlegroups.com
Hi Alex & Sam,

This is now merged in master, so you can also just use that.

Thanks Alex for the patch!

Keir

Sam Hare

unread,
Sep 21, 2015, 2:08:52 PM9/21/15
to ceres-...@googlegroups.com
Hi Alex,

Thanks a lot for the patch, this looks great.

I can confirm everything is working well now with Xcode 7. Unfortunately I no longer have access to Xcode 6 on my machine, I will see if I can find someone who hasn't yet upgraded to test.

Best,

Sam

On Sun, Sep 20, 2015 at 12:20 PM, Alex Stewart <alex...@gmail.com> wrote:

Alex Stewart

unread,
Sep 21, 2015, 6:41:17 PM9/21/15
to ceres-...@googlegroups.com
Thanks Sam, there was an issue with Xcode 6 that I fixed in master today, but it would be great if you could also confirm it works for you.

-Alex
Reply all
Reply to author
Forward
0 new messages