Opened 9 months ago

Closed 4 months ago

#69381 closed defect (worksforme)

opencv4 @4.8.0_4+contrib build failure

Reported by: fmw42 (Fred Weinhaus) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.9.1
Keywords: Ventura, arm64 Cc: cooljeanius (Eric Gallager), stromnov (Andrey Stromnov)
Port: opencv4

Description

I was trying to install py39-opencv4 or py311-openc4 on Ventura on M1 Mac mini. Both installs gave error messages that they could not install opencv4.

sudo port clean py39-opencv4
--->  Cleaning py39-opencv4

sudo port install py39-opencv4
--->  Computing dependencies for opencv4
--->  Fetching archive for opencv4
--->  Attempting to fetch opencv4-4.8.0_4+contrib.darwin_22.arm64.tbz2 from https://packages.macports.org/opencv4
--->  Attempting to fetch opencv4-4.8.0_4+contrib.darwin_22.arm64.tbz2 from http://mirror.fcix.net/macports/packages/opencv4
--->  Attempting to fetch opencv4-4.8.0_4+contrib.darwin_22.arm64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/opencv4
--->  Building opencv4
Error: Failed to build opencv4: command execution failed 
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_opencv4/opencv4/main.log for details.
Error: Unable to execute port py39-opencv4: upgrade opencv4 failed



sudo port install py311-opencv4
--->  Computing dependencies for opencv4
--->  Fetching archive for opencv4
--->  Attempting to fetch opencv4-4.8.0_4+contrib.darwin_22.arm64.tbz2 from https://packages.macports.org/opencv4
--->  Attempting to fetch opencv4-4.8.0_4+contrib.darwin_22.arm64.tbz2 from http://mirror.fcix.net/macports/packages/opencv4
--->  Attempting to fetch opencv4-4.8.0_4+contrib.darwin_22.arm64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/opencv4
--->  Building opencv4
Error: Failed to build opencv4: command execution failed 
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_opencv4/opencv4/main.log for details.
Error: Unable to execute port py311-opencv4: upgrade opencv4 failed

I have attached the log file

Attachments (3)

opencv4_main.log.bz2 (31.1 KB) - added by jmroot (Joshua Root) 9 months ago.
opencv4_error_log.txt (4.5 MB) - added by fmw42 (Fred Weinhaus) 7 months ago.
new_error_log.txt (1.5 MB) - added by fmw42 (Fred Weinhaus) 6 months ago.

Change History (30)

comment:1 Changed 9 months ago by jmroot (Joshua Root)

Cc: stromnov@… stromnov mascguy@… removed
Owner: set to stromnov
Status: newassigned
Summary: Cannot install OpenCV4opencv4 @4.8.0_4+contrib build failure
:info:build ld: Undefined symbols:
:info:build   Imf_3_2::Chromaticities::Chromaticities(Imath_2_3::Vec2<float> const&, Imath_2_3::Vec2<float> const&, Imath_2_3::Vec2<float> const&, Imath_2_3::Vec2<float> const&), referenced from:
:info:build       cv::ExrDecoder::ExrDecoder() in grfmt_exr.cpp.o
:info:build   Imf_3_2::Header::Header(int, int, float, Imath_2_3::Vec2<float> const&, float, Imf_3_2::LineOrder, Imf_3_2::Compression), referenced from:
:info:build       cv::ExrEncoder::write(cv::Mat const&, std::__1::vector<int, std::__1::allocator<int>> const&) in grfmt_exr.cpp.o

Changed 9 months ago by jmroot (Joshua Root)

Attachment: opencv4_main.log.bz2 added

comment:2 Changed 8 months ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:3 Changed 7 months ago by mascguy (Christopher Nielsen)

Folks, does this issue still occur with the latest version of opencv4 (4.9.0)?

comment:4 in reply to:  3 ; Changed 7 months ago by cooljeanius (Eric Gallager)

Replying to mascguy:

Folks, does this issue still occur with the latest version of opencv4 (4.9.0)?

I just tested on x86_64 Big Sur and it built fine for me

comment:5 in reply to:  4 Changed 7 months ago by mascguy (Christopher Nielsen)

Replying to cooljeanius:

Replying to mascguy:

Folks, does this issue still occur with the latest version of opencv4 (4.9.0)?

I just tested on x86_64 Big Sur and it built fine for me

Great to hear Eric!

@fmw42 Fred, how about you?

comment:6 Changed 7 months ago by fmw42 (Fred Weinhaus)

No it still fails the same way when I try to install py311-opencv4 on my M1 Mac mini with Ventura complaining about the Chromaticities.

comment:7 in reply to:  6 Changed 7 months ago by mascguy (Christopher Nielsen)

Replying to fmw42:

No it still fails the same way when I try to install py311-opencv4 on my M1 Mac mini with Ventura complaining about the Chromaticities.

That might be related to ports imath and openexr, which were both updated a short time ago. (And those updates may not published for another hour-ish.)

Once an hour has passed, can you resync your ports tree, and update everything outdated?

Assuming that imath and openexr are updated, go ahead and retry installation of py311-opencv4.

comment:8 Changed 7 months ago by fmw42 (Fred Weinhaus)

OK thanks. I will try later or tomorrow. As mentioned above, the error was related to OpenEXR Chromaticities.

Changed 7 months ago by fmw42 (Fred Weinhaus)

Attachment: opencv4_error_log.txt added

comment:9 Changed 7 months ago by fmw42 (Fred Weinhaus)

I tested again this morning to upgrade py311-opencv4 and it failed again with what looks like the same issue with OpenEXR Chromaticities. I have just uploaded the error log file. See attachments.

Last edited 6 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:10 Changed 7 months ago by mascguy (Christopher Nielsen)

Cc: stromnov added; mascguy removed
Owner: changed from stromnov to mascguy

comment:11 Changed 6 months ago by fmw42 (Fred Weinhaus)

Any update on this ticket? Tried again today to install/upgrade and it failed again.

comment:12 in reply to:  11 Changed 6 months ago by mascguy (Christopher Nielsen)

Replying to fmw42:

Any update on this ticket? Tried again today to install/upgrade and it failed again.

It looks like you have Xcode Command-Line Tools 15.0 installed, along with Xcode 14.3:

:debug:sysinfo macOS 13.6 (darwin/22.6.0) arch arm
:debug:sysinfo MacPorts 2.9.3
:debug:sysinfo Xcode 14.3, CLT 15.0.0.0.1.1694021235

You should downgrade the Command-Line Tools back to 14.3, to ensure it matches with Xcode itself:

https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_for_Xcode_14.3/Command_Line_Tools_for_Xcode_14.3.dmg

Once you've done that, run sudo port clean opencv4, to clear the log. Then try the install again.

Changed 6 months ago by fmw42 (Fred Weinhaus)

Attachment: new_error_log.txt added

comment:13 Changed 6 months ago by fmw42 (Fred Weinhaus)

I downloaded Command Line Tools 14.3.1 and installed that. I presume it wrote over the 15.0 version. If that is not the case, please let me know how to delete that 15.0 version. I could not find it anywhere.

Then I did

sudo port selfupdate
Password:
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.9.3 installed,
MacPorts base version 2.9.3 downloaded.
--->  Updating the ports tree
--->  MacPorts base is already the latest version

sudo port clean opencv4
--->  Cleaning opencv4
bash-5.2$ sudo port clean py39-opencv4
--->  Cleaning py39-opencv4
bash-5.2$ sudo port install py39-opencv4
--->  Computing dependencies for libsdl2
--->  Fetching archive for libsdl2
--->  Attempting to fetch libsdl2-2.30.3_0.darwin_22.arm64.tbz2 from http://mirror.fcix.net/macports/packages/libsdl2
--->  Attempting to fetch libsdl2-2.30.3_0.darwin_22.arm64.tbz2.rmd160 from http://mirror.fcix.net/macports/packages/libsdl2
--->  Installing libsdl2 @2.30.3_0
--->  Cleaning libsdl2
--->  Computing dependencies for libsdl2
--->  Deactivating libsdl2 @2.30.2_0
--->  Cleaning libsdl2
--->  Activating libsdl2 @2.30.3_0
--->  Cleaning libsdl2
--->  Computing dependencies for ffmpeg
--->  Fetching archive for ffmpeg
--->  Attempting to fetch ffmpeg-4.4.4_7+gpl2.darwin_22.arm64.tbz2 from http://mirror.fcix.net/macports/packages/ffmpeg
--->  Attempting to fetch ffmpeg-4.4.4_7+gpl2.darwin_22.arm64.tbz2.rmd160 from http://mirror.fcix.net/macports/packages/ffmpeg
--->  Installing ffmpeg @4.4.4_7+gpl2
--->  Cleaning ffmpeg
--->  Computing dependencies for ffmpeg
--->  Deactivating ffmpeg @4.4.4_6+gpl2
--->  Cleaning ffmpeg
--->  Activating ffmpeg @4.4.4_7+gpl2
--->  Cleaning ffmpeg
--->  Computing dependencies for libarchive
--->  Fetching archive for libarchive
--->  Attempting to fetch libarchive-3.7.4_0.darwin_22.arm64.tbz2 from http://mirror.fcix.net/macports/packages/libarchive
--->  Attempting to fetch libarchive-3.7.4_0.darwin_22.arm64.tbz2.rmd160 from http://mirror.fcix.net/macports/packages/libarchive
--->  Installing libarchive @3.7.4_0
--->  Cleaning libarchive
--->  Computing dependencies for libarchive
--->  Deactivating libarchive @3.7.3_0
--->  Cleaning libarchive
--->  Activating libarchive @3.7.4_0
--->  Cleaning libarchive
--->  Computing dependencies for hdf5
--->  Fetching archive for hdf5
--->  Attempting to fetch hdf5-1.14.4.2_1+cxx+fortran+gfortran+hl.darwin_22.arm64.tbz2 from http://mirror.fcix.net/macports/packages/hdf5
--->  Attempting to fetch hdf5-1.14.4.2_1+cxx+fortran+gfortran+hl.darwin_22.arm64.tbz2.rmd160 from http://mirror.fcix.net/macports/packages/hdf5
--->  Installing hdf5 @1.14.4.2_1+cxx+fortran+gfortran+hl
--->  Cleaning hdf5
--->  Computing dependencies for hdf5
--->  Deactivating hdf5 @1.14.4.2_0+cxx+fortran+gfortran+hl
--->  Cleaning hdf5
--->  Activating hdf5 @1.14.4.2_1+cxx+fortran+gfortran+hl
--->  Cleaning hdf5
--->  Computing dependencies for opencv4
--->  Fetching archive for opencv4
--->  Attempting to fetch opencv4-4.9.0_1+contrib.darwin_22.arm64.tbz2 from http://mirror.fcix.net/macports/packages/opencv4
--->  Attempting to fetch opencv4-4.9.0_1+contrib.darwin_22.arm64.tbz2 from https://packages.macports.org/opencv4
--->  Attempting to fetch opencv4-4.9.0_1+contrib.darwin_22.arm64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/opencv4
--->  Fetching distfiles for opencv4
--->  Verifying checksums for opencv4
--->  Extracting opencv4
--->  Applying patches to opencv4
--->  Configuring opencv4
--->  Building opencv4                                   
Error: Failed to build opencv4: command execution failed 
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_opencv4/opencv4/main.log for details.
Error: Unable to execute port py39-opencv4: upgrade opencv4 failed
--->  Some of the ports you installed have notes:
  ffmpeg has the following notes:
    Support for rav1e now disabled by default; enable via +rav1e
    This build of ffmpeg includes GPLed code and is therefore licensed under GPL
    v2 or later. The following modules are GPLed:
      libvidstab libx264 libx265 libxvid postproc
    To include all nonfree, GPLed and LGPL code use variant +nonfree. To remove
    nonfree and GPLed code leaving only LGPL code remove the +gpl2 variant.
  hdf5 has the following notes:
    Mac users may need to set the environment variable "HDF5_USE_FILE_LOCKING"
    to the five-character string "FALSE" when accessing network mounted files.
    This is an application run-time setting, not a configure or build setting.
    Otherwise errors such as "unable to open file" or "HDF5 error" may be
    encountered.

I have uploaded the error log file (new_error_log.txt)

Last edited 6 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:14 Changed 6 months ago by fmw42 (Fred Weinhaus)

I now get:

clang --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

and

xcodebuild -version
Xcode 14.3
Build version 14E222b

and

/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version
Xcode 14.3
Build version 14E222b

and

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 14.3.1.0.1.1683849156
volume: /
location: /
install-time: 1715025966

but

softwareupdate --history | grep Command
Command Line Tools for Xcode                       13.4       05/12/2022, 11:00:50  
Command Line Tools for Xcode                       14.0       09/13/2022, 10:28:57  
Command Line Tools for Xcode                       14.0       04/25/2023, 11:17:54  
Command Line Tools for Xcode                       14.2       04/25/2023, 11:17:54  
Command Line Tools for Xcode                       14.3       04/25/2023, 11:17:54  
Command Line Tools for Xcode                       14.3       06/03/2023, 13:31:20  
Command Line Tools for Xcode                       15.0       09/18/2023, 12:08:32  

I do not understand why it does not show version 14.3 re-installed after 9/18/23. I installed it again 3 days ago just before testing as above. I am sorry but I do not know how to remove the 15.0 version. Can you give me some instructions?

Last edited 6 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:15 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

I don't know what softwareupdate --history does. Maybe it only shows updates installed via software update; you installed CLT 14.3 manually from a dmg, not using software update. I believe you have been successful in installing CLT 14.3, and it has evidently not helped the problem you are experiencing. FWIW, I am not able to reproduce the build failure on macOS 12.7.4 with CLT 13.2.

comment:16 Changed 6 months ago by fmw42 (Fred Weinhaus)

Might it be an M1 Mac issue?

P.S. I was using the same configuration with CLT 14.3 before updating MacPorts and trying to reinstall OpenCV and other ports that had gone outdated back in Feb when I first reported this issue. (Updated to Ventura a year ago). Up until then it had installed flawlessly on the same M1 Mac in Ventura (13).

Is there a way to install OpenCV without OpenEXR, which seems to be the item that is failing?

Last edited 6 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:17 in reply to:  16 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to fmw42:

Might it be an M1 Mac issue?

We had successful builds of opencv4 on Mac OS X 10.7 and up on Intel and on macOS 11 and up on Apple Silicon: https://ports.macports.org/port/opencv4/details/

Is there a way to install OpenCV without OpenEXR, which seems to be the item that is failing?

The opencv4 port depends on the openexr port unconditionally.

comment:18 Changed 6 months ago by fmw42 (Fred Weinhaus)

Perhaps it has to do with one of the other ports that it needs for which that version is incompatible? Might you know from the log that I provided which it might be (possibly OpenEXR) that I can downgrade and see if that works?

Is there anything else I can test and provide that might give you more insight?

Version 0, edited 6 months ago by fmw42 (Fred Weinhaus) (next)

comment:19 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

No, I am saying that I have tested on macOS 12 on x86_64 and it builds for me, and automated builds on the buildbot succeeded on all OS versions and architectures with which the port indicates it is compatible (OS X 10.7 and later). I do not know why the problem you are seeing is happening for you or how to solve it.

comment:20 Changed 6 months ago by fmw42 (Fred Weinhaus)

Sorry that is not clear to me. Was it tested on OSX 13 on an M1 Mac? I assume it is compatible with that configuration, is it not

comment:21 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

If you go to the link I provided earlier you can see build results from our build machines. The port built successfully on Intel builders running macOS 10.7 through 14 inclusive and on Apple Silicon builders running macOS 12 through 14 inclusive. I am not the maintainer of this port and cannot state with what systems it is expected to be compatible.

See also #69193 for a similar issue you reported with gimp2.

comment:22 Changed 6 months ago by fmw42 (Fred Weinhaus)

A removal of all my ports and then installing py312-opencv4 finally worked. SUCCESS

Today, I tried removing all my ports with sudo port -fp uninstall installed. Then I tried installing py312-opencv4 before installing any other ports. I got the following error messages:

Error: Requested variants "" do not match those the build was started with: "+contrib".
Error: Please use the same variants again, or run 'port clean opencv4' first to remove the existing partially completed build.
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_opencv4/opencv4/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there
is a bug.
Error: Processing of port py312-opencv4 failed

So I then cleaned opencv4 with sudo port clean opencv4 and tried again to install py312-opencv4. This time, I got py312-opencv4 to install without complaint. I then finished installing my other ports.

Question: Why did I get the message that opencv4 needed cleaning when I had removed every one of my ports.

I do not understand why I could not install py39-opencv4 before. I guess there was a conflict with one of the ports previously installed and the previous attempts to install py39-opencv4 did not overwrite that port with the needed version or dependencies. Perhaps the conflict was with OpenEXR. Or perhaps py39-opencv4 was the issue.

Last edited 6 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:23 in reply to:  22 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to fmw42:

Question: Why did I get the message that opencv4 needed cleaning when I had removed every one of my ports.

Uninstalling installed ports and cleaning work directories of in-progress builds are two separate things.

I do not understand why I could not install py39-opencv4 before.

Neither do I.

I guess there was a conflict with one of the ports previously installed

Yes that could be.

and the previous attempts to install py39-opencv4 did not overwrite that port with the needed version or dependencies. Perhaps the conflict was with OpenEXR. Or perhaps py39-opencv4 was the issue.

py39-opencv4 declares a dependency on openexr. Therefore when you try to install py39-opencv4 MacPorts will ensure openexr is up to date first.

comment:24 Changed 6 months ago by fmw42 (Fred Weinhaus)

py39-opencv4 declares a dependency on openexr. Therefore when you try to install py39-opencv4 MacPorts will ensure openexr is up to date first.

If it ensured openexr is up-to-date, then why did the install not work. Seems to me that perhaps it saw that openexr was installed and did not update it and that old version was not compatible

Last edited 6 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:25 in reply to:  24 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to fmw42:

py39-opencv4 declares a dependency on openexr. Therefore when you try to install py39-opencv4 MacPorts will ensure openexr is up to date first.

If it ensured openexr is up-to-date, then why did the install not work.

As I have repeatedly said, I do not know. Presumably it means something other than openexr was the cause. If we knew what the problem was we would fix it. If you or anybody knows how to fix this or any problem in any port, please submit a pull request, as always.

Seems to me that perhaps it saw that openexr was installed and did not update it and that old version was not compatible

That is not possible. That's not how MacPorts works. As I said, MacPorts will upgrade dependencies first.

Ok, there are two ways that it is possible. One is if you upgrade to a new version of let's say openexr, and then deliberately downgrade to an older still-installed version using sudo port activate. Then, when you install a port that depends on openexr, MacPorts will not upgrade openexr to the new version first because it sees that it is already installed but deactivated so it assumes you did this deliberately and know what you're doing. The other way is if you install or upgrade a port using the -n flag to tell MacPorts not to upgrade dependencies first. But neither of those things happened here because your log says:

--     OpenEXR:                     OpenEXR::OpenEXR (ver 3.2.4)

and that is the latest version available in MacPorts, so your openexr was already up to date.

There is an openexr bug report about this which was closed without any clear solution being discovered.

comment:26 Changed 6 months ago by fmw42 (Fred Weinhaus)

Thanks for all the replies to my questions and help on this ticket. Sorry this was such a difficult problem to solve. It was @ryandesign's reply above about all the test on various environments that causes something in my mind to click about trying with a clean install after removing all my ports and starting over again. This ticket can be closed now.. Sorry I do not know if or how I can close it.

Last edited 6 months ago by fmw42 (Fred Weinhaus) (previous) (diff)

comment:27 in reply to:  26 Changed 4 months ago by mascguy (Christopher Nielsen)

Resolution: worksforme
Status: assignedclosed

Replying to fmw42:

Thanks for all the replies to my questions and help on this ticket. Sorry this was such a difficult problem to solve. It was @ryandesign's reply above about all the test on various environments that causes something in my mind to click about trying with a clean install after removing all my ports and starting over again. This ticket can be closed now.. Sorry I do not know if or how I can close it.

Great, glad the issue is resolved!

Note: See TracTickets for help on using tickets.