Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#53339 closed defect (fixed)

OpenCV 3.2.0 fails building bundled freetype

Reported by: BSeppke (Benjamin Seppke) Owned by: stromnov (Andrey Stromnov)
Priority: Normal Milestone:
Component: ports Version: 2.3.5
Keywords: Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Port: opencv

Description

After updating to 3.2.0, I get the following error while building opencv using +contrib+python35+qt5 variants:

:info:build Undefined symbols for architecture x86_64:
:info:build   "_FT_Done_Face", referenced from:
:info:build       cv::freetype::FreeType2Impl::~FreeType2Impl() in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::loadFontData(cv::String, int) in freetype.cpp.o
:info:build   "_FT_Done_FreeType", referenced from:
:info:build       cv::freetype::FreeType2Impl::~FreeType2Impl() in freetype.cpp.o
:info:build   "_FT_Init_FreeType", referenced from:
:info:build       cv::freetype::FreeType2Impl::FreeType2Impl() in freetype.cpp.o
:info:build   "_FT_Load_Glyph", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build   "_FT_New_Face", referenced from:
:info:build       cv::freetype::FreeType2Impl::loadFontData(cv::String, int) in freetype.cpp.o
:info:build   "_FT_Outline_Decompose", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build   "_FT_Outline_Transform", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build   "_FT_Outline_Translate", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build   "_FT_Render_Glyph", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build   "_FT_Set_Pixel_Sizes", referenced from:
:info:build       cv::freetype::FreeType2Impl::putText(cv::_InputOutputArray const&, cv::String const&, cv::Point_<int>, int, cv::Scalar_<double>, int, int, bool) in freetype.cpp.o
:info:build   "_hb_buffer_add_utf8", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build   "_hb_buffer_create", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build   "_hb_buffer_destroy", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build   "_hb_buffer_get_glyph_infos", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build   "_hb_buffer_guess_segment_properties", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build   "_hb_font_destroy", referenced from:
:info:build       cv::freetype::FreeType2Impl::~FreeType2Impl() in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::loadFontData(cv::String, int) in freetype.cpp.o
:info:build   "_hb_ft_font_create", referenced from:
:info:build       cv::freetype::FreeType2Impl::loadFontData(cv::String, int) in freetype.cpp.o
:info:build   "_hb_shape", referenced from:
:info:build       cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build       cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.cpp.o
:info:build ld: symbol(s) not found for architecture x86_64

A complete log is attached to this ticket.

Attachments (1)

main.log (1.1 MB) - added by BSeppke (Benjamin Seppke) 8 years ago.
Error log

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by BSeppke (Benjamin Seppke)

Attachment: main.log added

Error log

comment:1 Changed 8 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: MarcusCalhoun-Lopez added

comment:2 Changed 8 years ago by mf2k (Frank Schima)

Owner: set to stromnov
Status: newassigned

In the future, please Cc the port maintainers (port info --maintainers opencv), if any.

comment:3 Changed 8 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: assignedclosed

In e7e10c27/macports-ports:

opencv: patch to find external libraries

Fixes #53339

comment:4 Changed 8 years ago by RJVB (René Bertin)

That's a bit of a tricky hack which wouldn't work with all patch implementations; on Linux patch typically refuses to patch files with a symlink in their path and that seems to apply here. Patching files outside of the current working directory also doesn't work reliably (otherwise one could do --- ../opencv_contrib-3.2.0/foo.orig etc.).

2 safe solutions:

post-patch {
    system -W ${workpath}/opencv_contrib-${version} "patch -p1 -i ${filespath}/patch-freetype.diff"
}

but that would defeat my proposed enhancement of storing applied patchfiles in the statefile, or

post-extract {
    file rename ${workpath}/opencv_contrib-${version} ${worksrcpath}/opencv_contrib
}
post-patch {
    file rename ${worksrcpath}/opencv_contrib ${workpath}/opencv_contrib-${version}
}

Both are kludgy, but MacPorts hasn't really been conceived for ports that get additional sources from outside ${worksrcpath}.

@stromnov : if you have time you could try looking into getting everything to unpack into a parent directory so you get something like

> ls -R `port work opencv`
build
opencv/opencv-3.2.0
opencv/opencv_contrib-3.2.0

The idea is to redefine the work directory structure such that the patch command will be invoked in opencv, not in the actual directory holding the sources. This could (but may well not) be as simple as adding a line

worksrcdir opencv

but you could also do the re-arranging in a post-extract step (that will probably have less unforeseen side-effects). You'd have to add the appropriate directory to the patchfiles and add a configure.args argument so that CMake finds the correct CMakeLists.txt .

Like this the port will also be ready for using the muniversal PG if and when a simple +universal build no longer works.

Note: See TracTickets for help on using tickets.