Bug 232443

Summary: graphics/opencv 3.4.1_8 staging failure
Product: Ports & Packages Reporter: Bertrand Petit <bsdpr>
Component: Individual Port(s)Assignee: freebsd-ports-bugs mailing list <ports-bugs>
Status: Open ---    
Severity: Affects Only Me CC: bsdpr, hiroo.ono+freebsd, swills, w.schwarzenfeld
Priority: --- Keywords: needs-qa
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Compressed build log
none
make install log
none
pkg version -v
none
patch to graphics/opencv/pkg-plist none

Description Bertrand Petit 2018-10-19 12:41:20 UTC
opencv was pullrd as a dependency of some parts of kde5, the opencv port fails to install during the staging phase and prevents the completion of the kde5 installation.

Port version is:
PORTNAME=       opencv
PORTVERSION=    3.4.1
PORTREVISION=   8
CATEGORIES=     graphics

Host is a newly installed 11.2 stable (svn r339356).

Error message issued:

# make install
===>  Installing for opencv-3.4.1_8
===>  Checking if opencv already installed
===>   Registering installation for opencv-3.4.1_8
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm.hpp:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm/conditioning.hpp:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm/fundamental.hpp:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm/io.hpp:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm/numeric.hpp:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm/projection.hpp:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm/reconstruct.hpp:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm/robust.hpp:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm/simple_pipeline.hpp:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm/triangulation.hpp:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/lib/libopencv_sfm.so:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/lib/libopencv_sfm.so.3.4:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/lib/libopencv_sfm.so.3.4.1:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/share/OpenCV/3rdparty/lib/libcorrespondence.a:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/share/OpenCV/3rdparty/lib/libmultiview.a:No such file or directory
pkg-static: Unable to access file /usr/obj/ports/usr/ports/graphics/opencv/work/stage/usr/local/share/OpenCV/3rdparty/lib/libnumeric.a:No such file or directory
*** Error code 74

Could someone give some help on this issue?
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2018-10-19 13:16:25 UTC
The paths in the errors look interesting: "/usr/obj/ports/usr/ports"

1) Is "/usr/obj/ports" an expected part of your configuration?

2) What is the method of installation (make install clean, portmaster <something>, something else?) and in how/where is it run?

3) Does the opencv port build succeed when attempting to install it directly (not via a dependency) from /usr/ports/ ? (run `make clean` before testing this)

4) If not, are the errors *exactly* the same as those initially reported? If not, how are they different? (provide an attachment with the full build log)

5) If the same errors are seen, do the reported missing files exist in path locations *without* the '/usr/obj/ports' prefix?

For example, for the first error/file reported: /usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm.hpp

Can you please also include (as attachments) the following:

- system information (uname -a)
- pkg version -v output
- contents of /etc/make.conf (if not empty)
Comment 2 Bertrand Petit 2018-10-19 14:17:07 UTC
Created attachment 198362 [details]
Compressed build log
Comment 3 Bertrand Petit 2018-10-19 14:18:38 UTC
Created attachment 198363 [details]
make install log
Comment 4 Bertrand Petit 2018-10-19 14:19:31 UTC
Created attachment 198364 [details]
pkg version -v
Comment 5 Bertrand Petit 2018-10-19 14:20:32 UTC
(In reply to Kubilay Kocak from comment #1)
> 1) Is "/usr/obj/ports" an expected part of your configuration?

This path is expected. The ports tree is nfs-mounted read-only. The work directory is set in make.conf:

MYPORTSDIR!=echo $(.CURDIR) | sed 's|/usr/ports/.*|/usr/ports|'
.if $(MYPORTSDIR) == /usr/ports
WRKDIRPREFIX=/usr/obj/ports
.endif
DISTDIR=/usr/obj/ports/usr/ports/distfiles
INDEXDIR=/var/db/ports/portupgrade

I never had any trouble with this setup which is about 10 years old.


> 2) What is the method of installation (make install clean, portmaster <something>, something else?) and in how/where is it run?

> 3) Does the opencv port build succeed when attempting to install it directly (not via a dependency) from /usr/ports/ ? (run `make clean` before testing this)

I did reproduce the issue doing "make clean ; make", and then "make install". The build phase terminated without aparent error.


> 4) If not, are the errors *exactly* the same as those initially reported? If not, how are they different? (provide an attachment with the full build log)

# cd /usr/ports/graphics/opencv
# make clean
===>  Cleaning for opencv-3.4.1_8
# make 2>&1 | tee /tmp/opencv-build.log
[See attachement]
# make install 2>&1 | tee /tmp/opencv-install.log
[See attachement]


> 5) If the same errors are seen, do the reported missing files exist in path locations *without* the '/usr/obj/ports' prefix?

>For example, for the first error/file reported: /usr/ports/graphics/opencv/work/stage/usr/local/include/opencv2/sfm.hpp

They can't exist at that locatation because of the read-only nature of the mountpoint:

$ mount | grep /usr/ports
10.1.1.13:/usr/ports on /usr/ports (nfs, read-only)


> - system information (uname -a)

FreeBSD titus.<...> 11.2-STABLE FreeBSD 11.2-STABLE #0: Tue Oct 16 11:38:15 CEST 2018     elrond@titus.<...>:/home/elrond/syswork/FreeBSD-work/11-LOCAL/obj/home/elrond/syswork/FreeBSD-work/11-LOCAL/src/sys/TITUS  amd64

The source tree was obtained from svn r339356. There are also some funny paths there. :-)


> - pkg version -v output

(The ports tree is circa two days old.)
[See atachement]


> - contents of /etc/make.conf (if not empty)
Here it is, in full:

# We compile outside of the ports dir
MYPORTSDIR!=echo $(.CURDIR) | sed 's|/usr/ports/.*|/usr/ports|'
.if $(MYPORTSDIR) == /usr/ports
WRKDIRPREFIX=/usr/obj/ports
.endif
DISTDIR=/usr/obj/ports/usr/ports/distfiles
INDEXDIR=/var/db/ports/portupgrade

WITH_PKG=YES
# Use OpenSSL from the ports
DEFAULT_VERSIONS+=ssl=openssl
OPTIONS_UNSET=EXAMPLES
Comment 6 Walter Schwarzenfeld freebsd_triage 2018-10-20 15:37:40 UTC
I don't know if the error is related (if it is not so tell me and I open an other PR).
I got on 11.2-RELEASE:
/usr/local/bin/ld: /usr/local/lib/libsz.a(sz_api.o): relocation R_X86_64_32 against `.rodata.cst16' can not be used when making a shared object; recompile with -fPIC
/usr/local/bin/ld: /usr/local/lib/libsz.a(rice.o): relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC

i hat to recompile science/szip with
CONFIGURE_ARGS+= --with-pic
(and after this hdf5)

After this is compiles und installs fine.

btw, it does not patch if EXTRA_MODULES is set to off
Applying extra patch /usr/ports/graphics/opencv/files/extra-patch-modules_sfm_src_libmv__light_libmv_numeric_numeric.cc
File to patch:

If you can confirm this please add sunpoet as maintainer of science/szip to CC-List.
Comment 7 Walter Schwarzenfeld freebsd_triage 2018-10-20 15:48:16 UTC
Maybe, it is the same problem as mentioned in bug #228743.
Comment 8 Hiroo Ono 2019-04-14 09:39:13 UTC
The sfm module needs EIGEN3 enabled, but the pkg-plist does not consider the option.
In the build log, there is:

-- Module opencv_sfm disabled because the following dependencies are not found: Eigen

In the patch attached to bug #237135 to update OpenCV to 3.4.5, I also addressed this problem.
For now, adding %%EIGEN3%% at the top of the lines from include/opencv2/sfm.hpp to include/opencv2/sfm/triangulation.hpp in pkg-plist would help.
Comment 9 Hiroo Ono 2019-04-14 09:46:07 UTC
Created attachment 203665 [details]
patch to graphics/opencv/pkg-plist

If you want to disable Eigen3, this patch to pkg-plist may help.
I did not test with OpenCV 3.4.1 though.
Comment 10 Hiroo Ono 2019-04-14 09:48:40 UTC
(In reply to Hiroo Ono from comment #9)
Forgot to mention that enabling EIGEN3 option is sufficient to workaround the problem.