Opened 8 months ago

Closed 6 months ago

#55280 closed defect (fixed)

ceres-solver refuses to build under 10.8

Reported by: SchmollTroll Owned by: mamoll (Mark Moll)
Priority: Normal Milestone:
Component: ports Version: 2.4.2
Keywords: mountainlion Cc:
Port: ceres-solver


Hi there,

I tried to install ceres-solver as a part of the dependencies for OpenMVS. I did a "port selfupdate", "port upgrade outdated", "port clean ceres-solver" and finaly "port install ceres-solver". Since I'm not very familiar with these log files I attached it here.

Many thanks for your work!

Attachments (1)

ceres-solver.log (393.2 KB) - added by SchmollTroll 8 months ago.
ceres-solver build log

Download all attachments as: .zip

Change History (7)

Changed 8 months ago by SchmollTroll

Attachment: ceres-solver.log added

ceres-solver build log

comment:1 Changed 8 months ago by ryandesign (Ryan Schmidt)

Owner: set to mamoll
Status: newassigned

Probably because Mountain Lion and earlier default to libstdc++. We can try to fix this, but you will have far fewer problems compiling modern software in MacPorts if you upgrade to Mavericks or later, which default to libc++.

At minimum, I find this line in the portfile suspicious and wrong:

configure.ldflags-append -lc++

comment:2 Changed 6 months ago by SchmollTroll

I saved my 10.8 system into a VM and updated to 10.11 ElCapitan. Here OpenMVG build without any problems, so this ticket can be closed if not of any interest for somebody else. Thanks for your work and the best wishes for the new year.

comment:3 Changed 6 months ago by mamoll (Mark Moll)

@ryandesign, is this the correct change in the Portfile:

if {${configure.cxx_stdlib} eq "libstdc++"} {
    configure.ldflags-append -lstdc++
} else {
    configure.ldflags-append -lc++

comment:4 Changed 6 months ago by kencu (Ken)

This software goes to some considerable lengths to try to control the c++11 requirements. See point 9 here <>.

The thing that seems to cause the issue building the examples is in examples/CMakeLists.txt, where it does this:

add_executable(curve_fitting_c curve_fitting.c)
target_link_libraries(curve_fitting_c ceres)
# Force CMake to link curve_fitting_c using the C linker, this is important
# when Ceres was compiled using C++11 to ensure that -std=c++11 is not passed
# through.
set_target_properties(curve_fitting_c PROPERTIES LINKER_LANGUAGE C)

indeed, commenting out that line

# set_target_properties(curve_fitting_c PROPERTIES LINKER_LANGUAGE C)

allows the build to build through without adding -lc++ to the ldflags.

It is also possible to just not build the examples and tests, as I notice they are not installed anyway. These are controlled with a couple of options in the main CMakeLists.txt file.

option(BUILD_TESTING "Enable tests" ON)
option(BUILD_EXAMPLES "Build examples" ON)

comment:5 Changed 6 months ago by mamoll (Mark Moll)

In 618bc74fe7e34dbfa0d586035b7f8e8ba9730606/macports-ports:

math/ceres-solver: disable build of test and examples, which aren't installed anyway. Remove (now unnecessary) ugly hack. See discussion at #55280

comment:6 Changed 6 months ago by mamoll (Mark Moll)

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.