Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latest versions of armadillo (9.850.1_1) and hdf5 (1.12.0) available from Homebrew do not interact together correctly, result in runtime error #52003

Closed
3 of 4 tasks
mikeroberts3000 opened this issue Mar 22, 2020 · 13 comments
Labels
outdated PR was locked due to age

Comments

@mikeroberts3000
Copy link

mikeroberts3000 commented Mar 22, 2020

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
  • ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

Note that I have chosen not to fix the issues reported by brew doctor because I don't know how, and they seem unrelated to the current issue.

Background

Armadillo is a C++ linear algebra library. HDF5 is a C++ library for reading and writing multidimensional arrays. Armadillo optionally depends on HDF5. Armadillo and HDF5 are both available by default on Homebrew. Under normal circumstances, both libraries can be installed by typing brew install armadillo and brew install hdf5.

What you were trying to do (and why)

I am trying to install Armadillo and HDF5 using Homebrew, so I can build and run a small snippet of example C++ code that uses both libraries. Here is the code I'm trying to run. This code creates a 2D array in memory, saves it to disk, then loads it from disk.

#include <iostream>
#include <armadillo>

int main (int argc, const char** argv) {

    arma::mat A = arma::randu<arma::mat>(3,4);
    std::cout << "A.n_rows = " << A.n_rows << std::endl;
    std::cout << "A.n_cols = " << A.n_cols << std::endl;
    A.save("tmp.h5", arma::hdf5_binary);

    arma::mat B;
    B.load("tmp.h5", arma::hdf5_binary);
    std::cout << "B.n_rows = " << B.n_rows << std::endl;
    std::cout << "B.n_cols = " << B.n_cols << std::endl;

    return 0;
}

What happened (include command output)

The first step is to install Armadillo.

brew install armadillo
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % brew install armadillo
Mikes-Mac-Pro:Downloads mike$ brew install armadillo
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
thefuck

==> Installing dependencies for armadillo: eigen, gmp, isl, mpfr, libmpc, gcc, hwloc, [email protected], libevent, open-mpi, openblas, arpack, szip and hdf5
==> Installing armadillo dependency: eigen
==> Downloading https://homebrew.bintray.com/bottles/eigen-3.3.7.catalina.bottle
==> Downloading from https://akamai.bintray.com/a7/a756d567dc590cdad796aa2d442d0
######################################################################## 100.0%
==> Pouring eigen-3.3.7.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/eigen/3.3.7: 487 files, 6.5MB
==> Installing armadillo dependency: gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.2.0.catalina.bottle.t
==> Downloading from https://akamai.bintray.com/2e/2e6acd6e62d1b8ef0800061e113ae
######################################################################## 100.0%
==> Pouring gmp-6.2.0.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/gmp/6.2.0: 20 files, 3.2MB
==> Installing armadillo dependency: isl
==> Downloading https://homebrew.bintray.com/bottles/isl-0.22.1.catalina.bottle.
==> Downloading from https://akamai.bintray.com/b5/b5319e3bbbb36ef3536d841999b74
######################################################################## 100.0%
==> Pouring isl-0.22.1.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/isl/0.22.1: 72 files, 4.7MB
==> Installing armadillo dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-4.0.2.catalina.bottle.
==> Downloading from https://akamai.bintray.com/14/140d29bfee0c8cf356fbb5391465f
######################################################################## 100.0%
==> Pouring mpfr-4.0.2.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/mpfr/4.0.2: 28 files, 4.7MB
==> Installing armadillo dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.1.0.catalina.bottl
######################################################################## 100.0%
==> Pouring libmpc-1.1.0.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/libmpc/1.1.0: 12 files, 361.9KB
==> Installing armadillo dependency: gcc
==> Downloading https://homebrew.bintray.com/bottles/gcc-9.3.0.catalina.bottle.t
==> Downloading from https://akamai.bintray.com/6b/6b84b7dcd0fe04ca70e7cac5dcf35
######################################################################## 100.0%
==> Pouring gcc-9.3.0.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/gcc/9.3.0: 1,461 files, 287.6MB
==> Installing armadillo dependency: hwloc
==> Downloading https://homebrew.bintray.com/bottles/hwloc-2.1.0.catalina.bottle
==> Downloading from https://akamai.bintray.com/94/94e4e238c45da330b53fde9c622e7
######################################################################## 100.0%
==> Pouring hwloc-2.1.0.catalina.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/hwloc/2.1.0: 881 files, 9.5MB
==> Installing armadillo dependency: [email protected]
==> Downloading https://homebrew.bintray.com/bottles/[email protected]
==> Downloading from https://akamai.bintray.com/d7/d7f992ebfd78f80828051f6dc6a1a
######################################################################## 100.0%
==> Pouring [email protected]
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/[email protected]/certs

and run
  /usr/local/opt/[email protected]/bin/c_rehash

[email protected] is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

==> Summary
🍺  /usr/local/Cellar/[email protected]/1.1.1d: 7,983 files, 17.9MB
==> Installing armadillo dependency: libevent
==> Downloading https://homebrew.bintray.com/bottles/libevent-2.1.11_1.catalina.
==> Downloading from https://akamai.bintray.com/9d/9d262f9ffb2268340a89c713826d8
######################################################################## 100.0%
==> Pouring libevent-2.1.11_1.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/libevent/2.1.11_1: 1,063 files, 5MB
==> Installing armadillo dependency: open-mpi
==> Downloading https://homebrew.bintray.com/bottles/open-mpi-4.0.3.catalina.bot
==> Downloading from https://akamai.bintray.com/3b/3b143cf02a5345bb0d4df0777d3a3
######################################################################## 100.0%
==> Pouring open-mpi-4.0.3.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/open-mpi/4.0.3: 752 files, 11.3MB
==> Installing armadillo dependency: openblas
==> Downloading https://homebrew.bintray.com/bottles/openblas-0.3.9.catalina.bot
==> Downloading from https://akamai.bintray.com/7f/7f61aa85ee83058e3ac4898f74b67
######################################################################## 100.0%
==> Pouring openblas-0.3.9.catalina.bottle.tar.gz
==> Caveats
openblas is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS and LAPACK in the Accelerate framework.

For compilers to find openblas you may need to set:
  export LDFLAGS="-L/usr/local/opt/openblas/lib"
  export CPPFLAGS="-I/usr/local/opt/openblas/include"

==> Summary
🍺  /usr/local/Cellar/openblas/0.3.9: 23 files, 119.7MB
==> Installing armadillo dependency: arpack
==> Downloading https://homebrew.bintray.com/bottles/arpack-3.7.0_4.catalina.bot
==> Downloading from https://akamai.bintray.com/d1/d173bfd4d5cad74063506f0a85219
######################################################################## 100.0%
==> Pouring arpack-3.7.0_4.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/arpack/3.7.0_4: 37 files, 3.2MB
==> Installing armadillo dependency: szip
==> Downloading https://homebrew.bintray.com/bottles/szip-2.1.1_1.catalina.bottl
######################################################################## 100.0%
==> Pouring szip-2.1.1_1.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/szip/2.1.1_1: 11 files, 111.9KB
==> Installing armadillo dependency: hdf5
==> Downloading https://homebrew.bintray.com/bottles/hdf5-1.12.0.catalina.bottle
==> Downloading from https://akamai.bintray.com/6c/6c68f33613e960a0c9efec780d07d
######################################################################## 100.0%
==> Pouring hdf5-1.12.0.catalina.bottle.tar.gz
Warning: hdf5 dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.
🍺  /usr/local/Cellar/hdf5/1.12.0: 268 files, 16.3MB
==> Installing armadillo
==> Downloading https://homebrew.bintray.com/bottles/armadillo-9.850.1_1.catalin
==> Downloading from https://akamai.bintray.com/39/399cf48dfdf7e0a5d580003c438ed
######################################################################## 100.0%
==> Pouring armadillo-9.850.1_1.catalina.bottle.tar.gz
Warning: armadillo dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.
🍺  /usr/local/Cellar/armadillo/9.850.1_1: 593 files, 4.8MB
==> Caveats
==> hwloc
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> [email protected]
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/[email protected]/certs

and run
  /usr/local/opt/[email protected]/bin/c_rehash

[email protected] is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

==> openblas
openblas is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS and LAPACK in the Accelerate framework.

For compilers to find openblas you may need to set:
  export LDFLAGS="-L/usr/local/opt/openblas/lib"
  export CPPFLAGS="-I/usr/local/opt/openblas/include"
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % 

Note that this step installs Armadillo and HDF5, so I should be ready to build my example code.

make
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % make                           
g++ armadillo_experiment_2.cpp \
	-o armadillo_experiment_2 \
	-std=c++11 \
	-I/usr/local/include \
	-I/usr/local/include \
	-L/usr/local/lib -larmadillo \
	-L/usr/local/lib -lhdf5 \
	-DARMA_USE_HDF5
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % 

My makefile executed successfully, so now I should be able to run my example code.

./armadillo_experiment_2
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % ./armadillo_experiment_2
A.n_rows = 3
A.n_cols = 4

warning: Mat::load(): unsupported or missing HDF5 data in A.h5
B.n_rows = 0
B.n_cols = 0
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 %

Note that I am getting a warning message, and the matrix B has 0 rows and 0 columns, indicating that it was not loaded correctly.

What you expected to happen

I expect that my example code does not print out a warning message. I further expect that matrices A and B report the same number of rows and columns. This would indicate that loading and saving HDF5 files with Armadillo is working correctly.

Step-by-step reproduction instructions (by running brew install commands)

See "What Happened" above.

Interestingly, I can fix this problem by manually reverting to slightly earlier versions of Armadillo (9.850.1) and HDF5 (1.10.6) in Homebrew.

brew unlink armadillo
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % brew unlink armadillo                              
Unlinking /usr/local/Cellar/armadillo/9.850.1_1... 7 symlinks removed
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 %
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/9620946e004a29744f9c5e4a27800cba6d6d6b9b/Formula/armadillo.rb
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/9620946e004a29744f9c5e4a27800cba6d6d6b9b/Formula/armadillo.rb
==> Consider using `brew extract armadillo ...`!
This will extract your desired armadillo version to a stable tap instead of
installing from an unstable URL!

######################################################################## 100.0%
Warning: armadillo 9.850.1_1 is available and more recent than version 9.850.1.
==> Downloading https://homebrew.bintray.com/bottles/armadillo-9.850.1.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/f5/f5747f1e0d77cb7b7474ff6ab140929a7857561a5b98b6a9c53b7aa2595a9ab1
######################################################################## 100.0%
==> Pouring armadillo-9.850.1.catalina.bottle.tar.gz
Warning: armadillo dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.
🍺  /usr/local/Cellar/armadillo/9.850.1: 593 files, 4.8MB
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 %
brew unlink hdf5
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % brew unlink hdf5     
Unlinking /usr/local/Cellar/hdf5/1.12.0... 160 symlinks removed
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 %
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/7342a4cadf5191d8ae4e83a83e4fbbc3e96d434e/Formula/hdf5.rb
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/7342a4cadf5191d8ae4e83a83e4fbbc3e96d434e/Formula/hdf5.rb
==> Consider using `brew extract hdf5 ...`!
This will extract your desired hdf5 version to a stable tap instead of
installing from an unstable URL!

######################################################################## 100.0%
Warning: hdf5 1.12.0 is available and more recent than version 1.10.6.
==> Downloading https://homebrew.bintray.com/bottles/hdf5-1.10.6.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/9e/9ece0ebb705a669c6c74b1305631077d9bbbd625c7ed67c0bb4d3b2b3a31dc88
######################################################################## 100.0%
==> Pouring hdf5-1.10.6.catalina.bottle.tar.gz
Warning: hdf5 dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.
🍺  /usr/local/Cellar/hdf5/1.10.6: 258 files, 14.8MB
Removing: /Users/mike/Library/Caches/Homebrew/hdf5--1.10.6.catalina.bottle.tar.gz... (5.4MB)
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % 

Now that I am on slightly older versions of Armadillo and HDF5, building and running my example code works as expected.

make
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % make
g++ armadillo_experiment_2.cpp \
	-o armadillo_experiment_2 \
	-std=c++11 \
	-I/usr/local/include \
	-I/usr/local/include \
	-L/usr/local/lib -larmadillo \
	-L/usr/local/lib -lhdf5 \
	-DARMA_USE_HDF5
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % 
./armadillo_experiment_2
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % ./armadillo_experiment_2       
A.n_rows = 3
A.n_cols = 4
B.n_rows = 3
B.n_cols = 4
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 %

Output of brew gist-logs

brew gist-logs armadillo
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % brew gist-logs armadillo
Error: No logs.
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 %
brew gist-logs hdf5
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % brew gist-logs hdf5     
Error: No logs.
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 %

Output of brew config and brew doctor

Note that I have chosen not to fix the issues reported by brew doctor because I don't know how, and they seem unrelated to the current issue.

brew config
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % brew config
HOMEBREW_VERSION: 2.2.10
ORIGIN: https://github.com/Homebrew/brew
HEAD: 48a1637b24a0c329905a981f4cff547c7fa47943
Last commit: 13 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 7ae32dc9c1ab3268af40d23522d37d648b46a440
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
CPU: dodeca-core 64-bit kabylake
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/bin/ruby
Clang: 11.0 build 1100
Git: 2.24.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 10.15.4-x86_64
CLT: 11.0.33.17
Xcode: 11.3
XQuartz: 2.7.8 => /opt/X11
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 %
brew doctor
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 % brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/mike/Library/Enthought/Canopy/edm/envs/User/bin/python2-config
  /Users/mike/Library/Enthought/Canopy/edm/envs/User/bin/geos-config
  /Users/mike/Library/Enthought/Canopy/edm/envs/User/bin/freetype-config
  /Users/mike/Library/Enthought/Canopy/edm/envs/User/bin/xslt-config
  /Users/mike/Library/Enthought/Canopy/edm/envs/User/bin/libpng16-config
  /Users/mike/Library/Enthought/Canopy/edm/envs/User/bin/python2.7-config
  /Users/mike/Library/Enthought/Canopy/edm/envs/User/bin/libpng-config
  /Users/mike/Library/Enthought/Canopy/edm/envs/User/bin/xml2-config
  /Users/mike/Library/Enthought/Canopy/edm/envs/User/bin/python-config
  /Users/mike/Library/Enthought/Canopy/edm/envs/User/bin/wx-config

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libQGLViewer.2.6.4.dylib
  /usr/local/lib/libndfuse.2.dylib
  /usr/local/lib/libopencv_calib3d.4.0.0.dylib
  /usr/local/lib/libopencv_core.4.0.0.dylib
  /usr/local/lib/libopencv_dnn.4.0.0.dylib
  /usr/local/lib/libopencv_features2d.4.0.0.dylib
  /usr/local/lib/libopencv_flann.4.0.0.dylib
  /usr/local/lib/libopencv_gapi.4.0.0.dylib
  /usr/local/lib/libopencv_highgui.4.0.0.dylib
  /usr/local/lib/libopencv_imgcodecs.4.0.0.dylib
  /usr/local/lib/libopencv_imgproc.4.0.0.dylib
  /usr/local/lib/libopencv_ml.4.0.0.dylib
  /usr/local/lib/libopencv_objdetect.4.0.0.dylib
  /usr/local/lib/libopencv_photo.4.0.0.dylib
  /usr/local/lib/libopencv_stitching.4.0.0.dylib
  /usr/local/lib/libopencv_video.4.0.0.dylib
  /usr/local/lib/libopencv_videoio.4.0.0.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/QGLViewer/camera.h
  /usr/local/include/QGLViewer/config.h
  /usr/local/include/QGLViewer/constraint.h
  /usr/local/include/QGLViewer/domUtils.h
  /usr/local/include/QGLViewer/frame.h
  /usr/local/include/QGLViewer/keyFrameInterpolator.h
  /usr/local/include/QGLViewer/manipulatedCameraFrame.h
  /usr/local/include/QGLViewer/manipulatedFrame.h
  /usr/local/include/QGLViewer/mouseGrabber.h
  /usr/local/include/QGLViewer/qglviewer.h
  /usr/local/include/QGLViewer/quaternion.h
  /usr/local/include/QGLViewer/vec.h
  /usr/local/include/opencv4/opencv2/calib3d/calib3d_c.h
  /usr/local/include/opencv4/opencv2/core/core_c.h
  /usr/local/include/opencv4/opencv2/core/cv_cpu_dispatch.h
  /usr/local/include/opencv4/opencv2/core/cv_cpu_helper.h
  /usr/local/include/opencv4/opencv2/core/cvdef.h
  /usr/local/include/opencv4/opencv2/core/hal/interface.h
  /usr/local/include/opencv4/opencv2/core/types_c.h
  /usr/local/include/opencv4/opencv2/cvconfig.h
  /usr/local/include/opencv4/opencv2/features2d/hal/interface.h
  /usr/local/include/opencv4/opencv2/flann/all_indices.h
  /usr/local/include/opencv4/opencv2/flann/allocator.h
  /usr/local/include/opencv4/opencv2/flann/any.h
  /usr/local/include/opencv4/opencv2/flann/autotuned_index.h
  /usr/local/include/opencv4/opencv2/flann/composite_index.h
  /usr/local/include/opencv4/opencv2/flann/config.h
  /usr/local/include/opencv4/opencv2/flann/defines.h
  /usr/local/include/opencv4/opencv2/flann/dist.h
  /usr/local/include/opencv4/opencv2/flann/dummy.h
  /usr/local/include/opencv4/opencv2/flann/dynamic_bitset.h
  /usr/local/include/opencv4/opencv2/flann/general.h
  /usr/local/include/opencv4/opencv2/flann/ground_truth.h
  /usr/local/include/opencv4/opencv2/flann/heap.h
  /usr/local/include/opencv4/opencv2/flann/hierarchical_clustering_index.h
  /usr/local/include/opencv4/opencv2/flann/index_testing.h
  /usr/local/include/opencv4/opencv2/flann/kdtree_index.h
  /usr/local/include/opencv4/opencv2/flann/kdtree_single_index.h
  /usr/local/include/opencv4/opencv2/flann/kmeans_index.h
  /usr/local/include/opencv4/opencv2/flann/linear_index.h
  /usr/local/include/opencv4/opencv2/flann/logger.h
  /usr/local/include/opencv4/opencv2/flann/lsh_index.h
  /usr/local/include/opencv4/opencv2/flann/lsh_table.h
  /usr/local/include/opencv4/opencv2/flann/matrix.h
  /usr/local/include/opencv4/opencv2/flann/nn_index.h
  /usr/local/include/opencv4/opencv2/flann/object_factory.h
  /usr/local/include/opencv4/opencv2/flann/params.h
  /usr/local/include/opencv4/opencv2/flann/random.h
  /usr/local/include/opencv4/opencv2/flann/result_set.h
  /usr/local/include/opencv4/opencv2/flann/sampling.h
  /usr/local/include/opencv4/opencv2/flann/saving.h
  /usr/local/include/opencv4/opencv2/flann/simplex_downhill.h
  /usr/local/include/opencv4/opencv2/flann/timer.h
  /usr/local/include/opencv4/opencv2/highgui/highgui_c.h
  /usr/local/include/opencv4/opencv2/imgcodecs/imgcodecs_c.h
  /usr/local/include/opencv4/opencv2/imgcodecs/ios.h
  /usr/local/include/opencv4/opencv2/imgproc/hal/interface.h
  /usr/local/include/opencv4/opencv2/imgproc/imgproc_c.h
  /usr/local/include/opencv4/opencv2/imgproc/types_c.h
  /usr/local/include/opencv4/opencv2/videoio/cap_ios.h
  /usr/local/include/opencv4/opencv2/videoio/videoio_c.h

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
  /usr/local/lib/libndfuse.la

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
  /usr/local/lib/pkgconfig/ndfuse.pc

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  qt@4

Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so:
  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc

Warning: Your XQuartz (2.7.8) is outdated.
Please install XQuartz 2.7.11 (or delete the current version).
XQuartz can be updated using Homebrew Cask by running:
  brew cask reinstall xquartz

Warning: Some installed formulae are missing dependencies.
You should `brew install` the missing dependencies:
  brew install hicolor-icon-theme

Run `brew missing` for more details.
mike@Mikes-MacBook-Pro-15-2018-Work-2 armadillo_experiment_2 %

Why do I think this a Homebrew bug (or maybe an HDF5 bug), but not an Armadillo bug?

I think this is a Homebrew bug (or maybe an HDF5 bug) because the maintainers of Armadillo have not released a "9.850.1_1" version of their library. This version string comes from Homebrew. In my self-contained reproducible example above, both the non-working and working cases use the same version of the Armadillo source code. Therefore, I do not believe it is possible that this issue is caused by the latest version of the Armadillo source code.

It is possible that this issue is caused by the latest version of the HDF5 source code. But I couldn't test this specific hypothesis because I couldn't test the latest version of Armadillo available in Homebrew (9.850.1_1) with the older version of HDF5 available in Homebrew (1.10.6). Similarly, I couldn't test Armadillo 9.850.1 with HDF5 1.12.0. I got a dyld: Library not loaded...image not found error when I tried either of these combinations.

Regardless, even if this is a problem with the latest version of the HDF5 source code, it would be preferable for the dependencies in Homebrew to be configured to work around the issue. In other words, it would be preferable for Homebrew to use the previous version of HDF5 with the latest version of Armadillo, if this bug is indeed caused by HDF5.

@mikeroberts3000 mikeroberts3000 changed the title latest versions of armadillo (9.850.1_1) and hdf5 (1.12.0) available from Homebrew do not interact together correctly, results in runtime error latest versions of armadillo (9.850.1_1) and hdf5 (1.12.0) available from Homebrew do not interact together correctly, result in runtime error Mar 22, 2020
@mikeroberts3000
Copy link
Author

mikeroberts3000 commented Mar 23, 2020

Update: I think this issue is due to breaking changes in HDF5 in 1.10 vs 1.12. This excerpt is from the official “MIGRATING FROM HDF5 1.10 TO HDF5 1.12” documentation:

There were many existing functions that were modified in 1.12. Applications created with 1.10 or earlier that use these functions will encounter errors when compiled with 1.12. This page describes how to compile 1.10 and earlier applications with 1.12 without modifying an application, and provides details on the functions that changed for users who wish to update their applications.

https://portal.hdfgroup.org/display/HDF5/Migrating+from+HDF5+1.10+to+HDF5+1.12

Looking at this documentation page in more detail, I found a simple workaround. I can fix the problem simply by adding -DH5_USE_110_API to the compiler flags in my makefile.

Going forward, I'm not sure what the cleanest fix is to this problem. There are several good alternatives. First, I can fix it in my makefile (as described in this post), but this step is currently undocumented in the Armadillo documentation. Second, the Armadillo source code could define H5_USE_110_API before including any of the HDF5 headers, since Armadillo is indeed relying on the 1.10 API. Third, Homebrew could require that the latest version of Armadillo use the 1.10 version of HDF5 as an explicit dependency.

Regardless, I'm adding this workaround here it helps anyone that comes across this problem in future.

@SMillerDev
Copy link
Member

Could you make a pull request adding that to the Armadillo formula?

@iMichka
Copy link
Member

iMichka commented Mar 23, 2020

I agree that armadillo should use [email protected]. It would be great if a test could be added for this too (in the armadillo formula).

Also, this should be reported to the armadillo developers so that they update their code.

@jeffin143
Copy link

@mikeroberts3000
Copy link
Author

mikeroberts3000 commented Mar 23, 2020

Hi friends, I don't know how to edit Homebrew formulae correctly, so I'd prefer to avoid doing that task.

However, I'm happy to contribute the example code snippet in this thread as a unit test. I have also reached out to the Armadillo developers and referred them to my findings here. @conradsnicta is a lead developer on Armadillo, and his commit mentioned above is targeted specifically at this issue.

@conradsnicta conradsnicta mentioned this issue Apr 1, 2020
5 tasks
@iMichka
Copy link
Member

iMichka commented Apr 1, 2020

I believe Homebrew should review the relevant policies for package updates and API breakage. Packages like HDF5 should never be updated willy-nilly if they contain API breaks. Instead, there should be coordination with dependent packages.

We do rebuild all reverse dependencies from source. We guarantee (or at least we try) that at build time, the brew libraries can be built. Armadillo was rebuilt and tested when we updated hdf5.

We also have a minimal "runtime" test: https://github.com/Homebrew/homebrew-core/blob/master/Formula/armadillo.rb#L28-L38

We can not test everything. We guarantee that armadillo itself compiles, we make a minimal runtime test. But we can't possibly test everything.

Ideally armadillo has a test suite (I bet it does). In general we hope that upstream has some sort of CI with the whole test suite running, where they can test different hdf5 versions.

Runtime behaviour is mostly upstream's responsibility, not the responsibility of the package manager (though we try to help on a best effort basis when something breaks).

@jonchang
Copy link
Contributor

jonchang commented Apr 1, 2020

If armadillo had a make check command we could run it in the formula to test for hdf5 API issues at build time. Otherwise, we can update the test do block to detect this kind of breakage in the future.

@jonchang
Copy link
Contributor

jonchang commented Apr 1, 2020

#52408

@iMichka
Copy link
Member

iMichka commented Apr 1, 2020

If armadillo had a make check command we could run it in

We could; but we have tried to avoid to do this too much. These tests are often slow for most of packages, and often drag in another bunch of dependencies. I prefer to rely on upstream's CI capability to test stuff by themselves.

@SMillerDev
Copy link
Member

I think there's even an audit to say that should only be done for cryptography software.

@Bo98
Copy link
Member

Bo98 commented Apr 1, 2020

Armadillo 9.860.1 has been merged.

I strongly encourage someone who is familiar with armadillo to improve the current tests if they wish to help prevent this happening again.

It is simply infeasible to suggest that all automated tests are ditched and every feature of every dependent is manually tested. Several hours of effort can go into updating certain formula and it's just not possible to extend that into days/weeks. If you feel strongly against this, please do monitor hdf5 releases and take on the task of creating the hdf5 pull request.

@Bo98 Bo98 closed this as completed Apr 1, 2020
@mikeroberts3000
Copy link
Author

Based on my reading of the automated test that @Bo98 posted, it appears as though my small example code snippet in this thread could be included. Are these automated allowed write to (and read from) the filesystem? Can they link against HDF5, in addition to linking against Armadillo (presumably yes because HDF5 is a dependency of Armadillo)? If so, I think my code snippet could be added to the current automated tests.

Again, I'm not familiar with the syntax for authoring Homebrew formulae, so I don't trust myself to do this correctly. But I think testing the most basic HDF5-Armadillo compatibility would fit into the existing automated testing framework, and would not require any additional dependencies.

@Bo98
Copy link
Member

Bo98 commented Apr 1, 2020

Yeah, that looks like it might work. I’ll have a look.

@lock lock bot added the outdated PR was locked due to age label May 5, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

6 participants