Cross-Compiling Ceres for Maemo (running on an Nokia N900)

221 views
Skip to first unread message

Sebastian Koch

unread,
Jul 9, 2012, 10:23:07 AM7/9/12
to ceres-...@googlegroups.com
Hi everybody,

I managed to cross-compile ceres for maemo running on an Nokia N900.
It's not such a big process, but to conserve it for posterity I'm
posting it to this mailing list.

First of all one needs the NokiaQT SDK [0]. Then to be able to cross
compile for the N900 with CMake one needs to download [1] and set all
necessary paths in that file.

Now after Downloading GFlags and GLog I wrote CMakeList.txt files for
them (attached to this email, adapted from a file found at [2]). I was
able to build gflags, glog and eigen with
mkdir build; cd build; cmake ../
-DCMAKE_TOOLCHAIN_FILE=~/ceres-maemo/toolchain-nokiaqtsdk.cmake; make;
make install
in their respective folders, while setting an appropriate install path.

Then compiling ceres was as easy as

cmake ../ -DCMAKE_TOOLCHAIN_FILE=~/ceres-maemo/toolchain-nokiaqtsdk.cmake
-DGFLAGS_LIB=~/ceres-maemo/gflags/build/libgflags.so
-DGFLAGS_INCLUDE=~/ceres-maemo/gflags/src/
-DGLOG_LIB=~/ceres-maemo/glog/build/libglog.so
-DGLOG_INCLUDE=~/ceres-maemo/glog/src/
-DEIGEN_INCLUDE=~/ceres-maemo/eigen/install/include/eigen3/Eigen/


I was able to compile the tests, except for the suitesparse tests.
After running them I only encountered 2 errors, see [3].

I'm using ceres to solve a small bundle adjustment problem, but
haven't run any performance tests yet. It seems to work just fine.

Cheers,

Sebastian


[0] http://www.developer.nokia.com/info/sw.nokia.com/id/e920da1a-5b18-42df-82c3-907413e525fb/Nokia_Qt_SDK.html
[1] https://github.com/seichter/CMake-Toolchain-Collection/raw/master/toolchain-nokiaqtsdk.cmake
[2] http://code.google.com/p/gflags/issues/detail?id=36
[3]
[ RUN ] GradientCheckingProblemImpl.ProblemDimensionsMatch
F0709 15:12:38.548614 11975 parameter_block.h:155] Check failed:
UpdateLocalParameterizationJacobian() Local parameterization Jacobian
computation failedfor x: 000000000nan -2.01335e-06 5.30653e-315
0000021.0006
*** Check failure stack trace: ***
@ 0x4005b3d8 google::LogMessage::Fail()
@ 0x400630a8 google::LogMessage::SendToLog()
@ 0x4005ed88 google::LogMessage::Flush()
@ 0x40060958 google::LogMessageFatal::~LogMessageFatal()
@ 0x3abfc ceres::internal::ParameterBlock::SetParameterization()
Aborted

[ RUN ] Problem.AddingParametersAndResidualsResultsInExpectedProblem
F0709 15:12:39.867950 11999 parameter_block.h:155] Check failed:
UpdateLocalParameterizationJacobian() Local parameterization Jacobian
computation failedfor x: 000000000nan 000006.48438 000000000nan
-3.81121e-07
*** Check failure stack trace: ***
@ 0x4005b3d8 google::LogMessage::Fail()
@ 0x400630a8 google::LogMessage::SendToLog()
@ 0x4005ed88 google::LogMessage::Flush()
@ 0x40060958 google::LogMessageFatal::~LogMessageFatal()
@ 0x33938 ceres::internal::ParameterBlock::SetParameterization()
@ 0x4004c000 (unknown)
Aborted
CMakeLists_glog.txt
CMakeLists_gflags.txt

Keir Mierle

unread,
Jul 9, 2012, 3:46:34 PM7/9/12
to ceres-...@googlegroups.com
Hi Sebastian,

On Mon, Jul 9, 2012 at 7:23 AM, Sebastian Koch <sebi...@gmail.com> wrote:
Hi everybody,

I managed to cross-compile ceres for maemo running on an Nokia N900.
It's not such a big process, but to conserve it for posterity I'm
posting it to this mailing list.

Very cool! Thanks for posting your notes.
 
First of all one needs the NokiaQT SDK [0]. Then to be able to cross
compile for the N900 with CMake one needs to download [1] and set all
necessary paths in that file.

Now after Downloading GFlags and GLog I wrote CMakeList.txt files for
them (attached to this email, adapted from a file found at [2]). I was
able to build gflags, glog and eigen with
mkdir build; cd build; cmake ../
-DCMAKE_TOOLCHAIN_FILE=~/ceres-maemo/toolchain-nokiaqtsdk.cmake; make;
make install
in their respective folders, while setting an appropriate install path.

Then compiling ceres was as easy as

cmake ../ -DCMAKE_TOOLCHAIN_FILE=~/ceres-maemo/toolchain-nokiaqtsdk.cmake
-DGFLAGS_LIB=~/ceres-maemo/gflags/build/libgflags.so
-DGFLAGS_INCLUDE=~/ceres-maemo/gflags/src/
-DGLOG_LIB=~/ceres-maemo/glog/build/libglog.so
-DGLOG_INCLUDE=~/ceres-maemo/glog/src/
-DEIGEN_INCLUDE=~/ceres-maemo/eigen/install/include/eigen3/Eigen/


I was able to compile the tests, except for the suitesparse tests.
After running them I only encountered 2 errors, see [3].

I'm using ceres to solve a small bundle adjustment problem, but
haven't run any performance tests yet. It seems to work just fine.

Great to hear!
 
Cheers,

Sebastian


[0] http://www.developer.nokia.com/info/sw.nokia.com/id/e920da1a-5b18-42df-82c3-907413e525fb/Nokia_Qt_SDK.html
[1] https://github.com/seichter/CMake-Toolchain-Collection/raw/master/toolchain-nokiaqtsdk.cmake
[2] http://code.google.com/p/gflags/issues/detail?id=36
[3]
[ RUN      ] GradientCheckingProblemImpl.ProblemDimensionsMatch
F0709 15:12:38.548614 11975 parameter_block.h:155] Check failed:
UpdateLocalParameterizationJacobian() Local parameterization Jacobian
computation failedfor x: 000000000nan -2.01335e-06 5.30653e-315
0000021.0006
*** Check failure stack trace: ***
    @ 0x4005b3d8  google::LogMessage::Fail()
    @ 0x400630a8  google::LogMessage::SendToLog()
    @ 0x4005ed88  google::LogMessage::Flush()
    @ 0x40060958  google::LogMessageFatal::~LogMessageFatal()
    @    0x3abfc  ceres::internal::ParameterBlock::SetParameterization()
Aborted

This points to either stack corruption or an uninitialized read.
 
[ RUN      ] Problem.AddingParametersAndResidualsResultsInExpectedProblem
F0709 15:12:39.867950 11999 parameter_block.h:155] Check failed:
UpdateLocalParameterizationJacobian() Local parameterization Jacobian
computation failedfor x: 000000000nan 000006.48438 000000000nan
-3.81121e-07
*** Check failure stack trace: ***
    @ 0x4005b3d8  google::LogMessage::Fail()
    @ 0x400630a8  google::LogMessage::SendToLog()
    @ 0x4005ed88  google::LogMessage::Flush()
    @ 0x40060958  google::LogMessageFatal::~LogMessageFatal()
    @    0x33938  ceres::internal::ParameterBlock::SetParameterization()
    @ 0x4004c000  (unknown)
Aborted

This looks like the same error as above.

I found that there is a bug that was hiding before. I can find the misbehaviour via valgrind:

==5335== Conditional jump or move depends on uninitialised value(s)
==5335==    at 0x4E00AB: ceres::internal::IsArrayValid(int, double const*) (/home/keir/wrk/ceres-solver.git/internal/ceres/array_utils.cc:49)
==5335==    by 0x4C81EC: ceres::internal::ParameterBlock::UpdateLocalParameterizationJacobian() (/home/keir/wrk/ceres-solver.git/internal/ceres/parameter_block.h:214)
==5335==    by 0x4C7EA5: ceres::internal::ParameterBlock::SetParameterization(ceres::LocalParameterization*) (/home/keir/wrk/ceres-solver.git/internal/ceres/parameter_block.h:157)
==5335==    by 0x4C76B9: ceres::internal::ProblemImpl::AddParameterBlock(double*, int, ceres::LocalParameterization*) (/home/keir/wrk/ceres-solver.git/internal/ceres/problem_impl.cc:323)
==5335==    by 0x4AB4A3: ceres::internal::GradientCheckingProblemImpl_ProblemDimensionsMatch_Test::TestBody() (/home/keir/wrk/ceres-solver.git/internal/ceres/gradient_checking_cost_function_test.cc:350)
==5335==    by 0x51203F: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3394)
==5335==    by 0x50C15D: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3430)
==5335==    by 0x4EFB95: testing::Test::Run() (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3466)
==5335==    by 0x4F07AB: testing::TestInfo::Run() (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3642)
==5335==    by 0x4F114E: testing::TestCase::Run() (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3749)
==5335==    by 0x4F7216: testing::internal::UnitTestImpl::RunAllTests() (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:5541)
==5335==    by 0x5134A1: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3394)
==5335== 
==5335== Conditional jump or move depends on uninitialised value(s)
==5335==    at 0x4E00C6: ceres::internal::IsArrayValid(int, double const*) (/home/keir/wrk/ceres-solver.git/internal/ceres/array_utils.cc:49)
==5335==    by 0x4C81EC: ceres::internal::ParameterBlock::UpdateLocalParameterizationJacobian() (/home/keir/wrk/ceres-solver.git/internal/ceres/parameter_block.h:214)
==5335==    by 0x4C7EA5: ceres::internal::ParameterBlock::SetParameterization(ceres::LocalParameterization*) (/home/keir/wrk/ceres-solver.git/internal/ceres/parameter_block.h:157)
==5335==    by 0x4C76B9: ceres::internal::ProblemImpl::AddParameterBlock(double*, int, ceres::LocalParameterization*) (/home/keir/wrk/ceres-solver.git/internal/ceres/problem_impl.cc:323)
==5335==    by 0x4AB4A3: ceres::internal::GradientCheckingProblemImpl_ProblemDimensionsMatch_Test::TestBody() (/home/keir/wrk/ceres-solver.git/internal/ceres/gradient_checking_cost_function_test.cc:350)
==5335==    by 0x51203F: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3394)
==5335==    by 0x50C15D: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3430)
==5335==    by 0x4EFB95: testing::Test::Run() (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3466)
==5335==    by 0x4F07AB: testing::TestInfo::Run() (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3642)
==5335==    by 0x4F114E: testing::TestCase::Run() (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3749)
==5335==    by 0x4F7216: testing::internal::UnitTestImpl::RunAllTests() (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:5541)
==5335==    by 0x5134A1: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/keir/wrk/ceres-solver.git/internal/ceres/gmock_gtest_all.cc:3394)
==5335== 

I'll get this fixed soon. Thanks for the report!

Another request: Do you think you would be willing to work with glog upstream to get the cmake build working there?

Keir
 

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

Keir Mierle

unread,
Jul 9, 2012, 3:47:50 PM7/9/12
to ceres-...@googlegroups.com

Sameer Agarwal

unread,
Jul 11, 2012, 2:26:16 PM7/11/12
to ceres-...@googlegroups.com
The fix is in the master branch now. Thanks to Markus Moll for pointing out the cause of this test failure.
Reply all
Reply to author
Forward
0 new messages