coin-or-tools / homebrew-coinor

A Repository of Homebrew Formulae for COIN-OR Projects
11 stars 13 forks source link

Issue installing cbc on MacBook with Apple M2 Max chip #85

Open alessandrozocca opened 1 year ago

alessandrozocca commented 1 year ago

I encountered an issue while trying to install cbc on my MacBook with Apple M2 Max chip.

After running the command

brew tap coin-or-tools/coinor
brew install coin-or-tools/coinor/cbc

I get the following error message

==> Downloading https://formulae.brew.sh/api/formula.json
######################################################################## 100.0%
==> Fetching dependencies for coin-or-tools/coinor/cbc: coin-or-tools/coinor/cgl
==> Fetching coin-or-tools/coinor/cgl
==> Downloading https://github.com/coin-or/Cgl/archive/refs/tags/releases/0.60.5.tar.gz
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/cf6bc58245c897210e6af101183ade9ccbe518e16e9ed7b8f7d095566b4240a2--Cgl-releases-0.60.5.tar.gz
==> Fetching coin-or-tools/coinor/cbc
==> Downloading https://github.com/coin-or/Cbc/archive/refs/tags/releases/2.10.7.tar.gz
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/bd485053dc4a6c57d8bdcb020e21222385a2824e825b13fe57295060f56dc524--Cbc-releases-2.10.7.tar.gz
==> Reinstalling coin-or-tools/coinor/cbc
==> Installing dependencies for coin-or-tools/coinor/cbc: coin-or-tools/coinor/cgl
==> Installing coin-or-tools/coinor/cbc dependency: coin-or-tools/coinor/cgl
==> ./configure --prefix=/opt/homebrew/Cellar/cgl/0.60.5_1 --datadir=/opt/homebrew/Cellar/cgl/0.60.5_1/share/cgl --includedir=/opt/homebrew/Cellar/cgl/0.60.5_1/include/cgl --with-sample-datadir=/opt/homebrew/opt/co
==> make
==> make test
Last 15 lines from /Users/user/Library/Logs/Homebrew/cgl/03.make:
make[4]: Nothing to be done for `all-am'.
make[2]: Nothing to be done for `all-am'.
cd test; /Library/Developer/CommandLineTools/usr/bin/make test
clang++ -DHAVE_CONFIG_H -I. -I`echo .` -I../src  -I`echo ./../src` -I`echo ./../src/CglFlowCover` -I`echo ./../src/CglGomory` -I`echo ./../src/CglKnapsackCover` -I`echo ./../src/CglLandP` -I`echo ./../src/CglOddHole` -I`echo ./../src/CglProbing` -I`echo ./../src/CglMixedIntegerRounding` -I`echo ./../src/CglMixedIntegerRounding2` -I`echo ./../src/CglResidualCapacity` -I`echo ./../src/CglRedSplit` -I`echo ./../src/CglRedSplit2` -I`echo ./../src/CglTwomir` -I`echo ./../src/CglClique` -I`echo ./../src/CglSimpleRounding` -I`echo ./../src/CglZeroHalf` -I/opt/homebrew/Cellar/coinutils/2.11.6/include/coinutils/coin -I/opt/homebrew/Cellar/osi/0.108.7/include/osi/coin -I/opt/homebrew/Cellar/clp/1.17.7/include/clp/coin -I/opt/homebrew/Cellar/coinutils/2.11.6/include/coinutils/coin -I/opt/homebrew/Cellar/osi/0.108.7/include/osi/coin -I/opt/homebrew/Cellar/coinutils/2.11.6/include/coinutils/coin  -DSAMPLEDIR=\"`echo /opt/homebrew/opt/coin_data_sample/share/coin_data_sample/coin/Data/Sample | sed -e 's/\\\\/\\\\\\\\/g'`\" -I/opt/homebrew/Cellar/coinutils/2.11.6/include/coinutils/coin -I/opt/homebrew/Cellar/osi/0.108.7/include/osi/coin -I/opt/homebrew/Cellar/clp/1.17.7/include/clp/coin         -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long   -DCGL_BUILD -c -o unitTest.o unitTest.cpp
/bin/sh ../../libtool --tag=CXX --mode=link clang++  -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long   -DCGL_BUILD   -o unitTest  unitTest.o ../src/libCgl.la -L/opt/homebrew/Cellar/coinutils/2.11.6/lib -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/Cellar/osi/0.108.7/lib -L/opt/homebrew/Cellar/clp/1.17.7/lib -L/opt/homebrew/opt/ampl-mp/lib -L/opt/homebrew/opt/mumps-seq/lib -L/opt/homebrew/opt/glpk@448/lib -lOsiClp -lClpSolver -lClp -lasl -ldmumps -lmumps_common -lpord -lmpiseq -lglpk -lOsi -lCoinUtils -lbz2 -lz -lopenblas -lm -L/opt/homebrew/Cellar/coinutils/2.11.6/lib -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/Cellar/osi/0.108.7/lib -lOsi -lCoinUtils -lbz2 -lz -lopenblas -lm -L/opt/homebrew/Cellar/coinutils/2.11.6/lib -L/opt/homebrew/opt/openblas/lib -lCoinUtils -lbz2 -lz -lopenblas -lm  -L/opt/homebrew/Cellar/coinutils/2.11.6/lib -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/Cellar/osi/0.108.7/lib -L/opt/homebrew/Cellar/clp/1.17.7/lib -L/opt/homebrew/opt/ampl-mp/lib -L/opt/homebrew/opt/mumps-seq/lib -L/opt/homebrew/opt/glpk@448/lib -lOsiClp -lClpSolver -lClp -lasl -ldmumps -lmumps_common -lpord -lmpiseq -lglpk -lOsi -lCoinUtils -lbz2 -lz -lopenblas -lm
mkdir .libs
clang++ -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCGL_BUILD -o .libs/unitTest unitTest.o -Wl,-bind_at_load  ../src/.libs/libCgl.dylib -L/opt/homebrew/Cellar/coinutils/2.11.6/lib -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/Cellar/osi/0.108.7/lib -L/opt/homebrew/Cellar/clp/1.17.7/lib -L/opt/homebrew/opt/ampl-mp/lib -L/opt/homebrew/opt/mumps-seq/lib -L/opt/homebrew/opt/glpk@448/lib -lOsiClp -lClpSolver -lClp -lasl -ldmumps -lmumps_common -lpord -lmpiseq -lglpk -lOsi -lCoinUtils -lbz2 -lz -lopenblas -lm
creating unitTest
./unitTest
dyld[97161]: Symbol not found: _cbc_glp_prob
  Referenced from: <E23E4672-CDA6-34C5-A589-B3E64DB6B05D> /opt/homebrew/Cellar/clp/1.17.7/lib/libClpSolver.1.14.7.dylib
  Expected in:     <9AC153ED-786A-3F88-B882-5DBF32B46D70> /opt/homebrew/Cellar/coinutils/2.11.6/lib/libCoinUtils.3.11.6.dylib
make[2]: *** [test] Abort trap: 6
make[1]: *** [test] Error 2
make: *** [test] Error 2
tkralphs commented 1 year ago

This is strange. The missing symbol is related to the third-party package GLPK, which can be linked when it is found on the system. It looks like when Clp was built, it included a header from a CoinUtils library that had been built with GLPK, but Cgl is now trying to link to a Clp library that is expecting GLPK support, but also to a different CoinUtils library that doesn't have such support. So somehow, you have (or had) multiple CoinUtils libraries lying around.

One possibility is that you are mixing and matching libraries from the recipes in core with libraries from the recipes in coin-or-tool/coinor. I would first try uninstalling everything in the Cbc stack and make sure that you also delete any libraries that were installed with the recipes in core. Then just install Cbc and let it find all the dependencies. Hopefully, that will fix things up. Is it possible that you built CoinUtils from source on your own at some point?

Anyway, hopefully, this give you enough to go on.

alessandrozocca commented 1 year ago

Thanks for the input. I follow your advice and did a clean install, but I got a different error message:

==> Tapping coin-or-tools/coinor
Cloning into '/opt/homebrew/Library/Taps/coin-or-tools/homebrew-coinor'...
remote: Enumerating objects: 435, done.
remote: Counting objects: 100% (170/170), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 435 (delta 149), reused 129 (delta 125), pack-reused 265
Receiving objects: 100% (435/435), 81.98 KiB | 1.05 MiB/s, done.
Resolving deltas: 100% (262/262), done.
Tapped 14 formulae (29 files, 134.4KB).
==> Fetching dependencies for coin-or-tools/coinor/cbc: coin-or-tools/coinor/coin_data_netlib, coin-or-tools/coinor/coin_data_sample, coin-or-tools/coinor/glpk@448, coin-or-tools/coinor/mumps-seq, coin-or-tools/coinor/clp and coin-or-tools/coinor/cgl
==> Fetching coin-or-tools/coinor/coin_data_netlib
==> Downloading https://github.com/coin-or-tools/Data-Netlib/archive/refs/tags/r
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/d6aa27f0641fc1992839372a06dec982149c06ed5b966c52932001149bea300d--Data-Netlib-releases-1.2.10.tar.gz
==> Fetching coin-or-tools/coinor/coin_data_sample
==> Downloading https://github.com/coin-or-tools/Data-Sample/archive/refs/tags/r
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/2ccc757267ad31f63b1deb84dacbbeb71335f0adeb8bae235038f98973592a87--Data-Sample-releases-1.2.12.tar.gz
==> Fetching coin-or-tools/coinor/glpk@448
==> Downloading https://ftp.gnu.org/gnu/glpk/glpk-4.48.tar.gz
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/8151724db74684568f7835e9bbd817707d99b6388ecedab7833bcc0cbd27acb6--glpk-4.48.tar.gz
==> Fetching coin-or-tools/coinor/mumps-seq
==> Downloading https://graal.ens-lyon.fr/MUMPS/MUMPS_5.5.1.tar.gz
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/debe92299b447c0f54bc6af3735a6d6513935d33418392ea03abbe3dabd2b91f--MUMPS_5.5.1.tar.gz
==> Fetching coin-or-tools/coinor/clp
==> Downloading https://github.com/coin-or/Clp/archive/refs/tags/releases/1.17.7
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/f6d97cc3ae9fcc4f59a7b0919d41dcbc87eb13d331c04e3d999ddb5ae17cedaa--Clp-releases-1.17.7.tar.gz
==> Fetching coin-or-tools/coinor/cgl
==> Downloading https://github.com/coin-or/Cgl/archive/refs/tags/releases/0.60.5
==> Downloading from https://codeload.github.com/coin-or/Cgl/tar.gz/refs/tags/re
        #-=O#-  #     #
==> Fetching coin-or-tools/coinor/cbc
==> Downloading https://github.com/coin-or/Cbc/archive/refs/tags/releases/2.10.7
==> Downloading from https://codeload.github.com/coin-or/Cbc/tar.gz/refs/tags/re
              #=O=-#     #     #
==> Installing cbc from coin-or-tools/coinor
==> Installing dependencies for coin-or-tools/coinor/cbc: coin-or-tools/coinor/coin_data_netlib, coin-or-tools/coinor/coin_data_sample, coin-or-tools/coinor/glpk@448, coin-or-tools/coinor/mumps-seq, coin-or-tools/coinor/clp and coin-or-tools/coinor/cgl
==> Installing coin-or-tools/coinor/cbc dependency: coin-or-tools/coinor/co
==> ./configure --prefix=/opt/homebrew/Cellar/coin_data_netlib/1.2.10 --datadir=/opt/homebrew/Cellar/coin_data_netlib/1.2.10/share/coin_data_netlib
==> make install
🍺  /opt/homebrew/Cellar/coin_data_netlib/1.2.10: 94 files, 4.7MB, built in 5 seconds
==> Installing coin-or-tools/coinor/cbc dependency: coin-or-tools/coinor/co
==> ./configure --prefix=/opt/homebrew/Cellar/coin_data_sample/1.2.12 --datadir=/opt/homebrew/Cellar/coin_data_sample/1.2.12/share/coin_data_sample
==> make install
🍺  /opt/homebrew/Cellar/coin_data_sample/1.2.12: 44 files, 1.5MB, built in 2 seconds
==> Installing coin-or-tools/coinor/cbc dependency: coin-or-tools/coinor/gl
==> Patching
==> ./configure --prefix=/opt/homebrew/Cellar/glpk@448/4.48_1 --with-gmp
==> make
==> make check
==> make install
🍺  /opt/homebrew/Cellar/glpk@448/4.48_1: 14 files, 2.4MB, built in 8 seconds
==> Installing coin-or-tools/coinor/cbc dependency: coin-or-tools/coinor/mu
==> make all RANLIB=echo CDEFS=-DAdd_ OPTF=-O3 -fallow-argument-mismatch LMETISDIR=/opt/homebrew/opt/metis/lib IMETIS=-I/opt/homebrew/opt/metis/include LMETIS=-L/opt/homebre
Last 15 lines from /Users/user/Library/Logs/Homebrew/mumps-seq/01.make:
      ___cmumps_ana_lr_MOD_sep_grouping_ab in libcmumps.a(cana_lr.o)
  "___mumps_ana_ord_wrappers_MOD_mumps_metis_kway_mixedto32", referenced from:
      ___cmumps_ana_lr_MOD_sep_grouping in libcmumps.a(cana_lr.o)
  "___mumps_ana_ord_wrappers_MOD_mumps_metis_kway_mixedto64", referenced from:
      ___cmumps_ana_lr_MOD_sep_grouping in libcmumps.a(cana_lr.o)
  "___mumps_ana_ord_wrappers_MOD_mumps_metis_nodend_mixedto32", referenced from:
      ___cmumps_ana_aux_m_MOD_cmumps_ana_f in libcmumps.a(cana_aux.o)
      _cmumps_ana_f_elt_ in libcmumps.a(cana_aux_ELT.o)
  "___mumps_ana_ord_wrappers_MOD_mumps_metis_nodend_mixedto64", referenced from:
      ___cmumps_ana_aux_m_MOD_cmumps_ana_f in libcmumps.a(cana_aux.o)
      _cmumps_ana_f_elt_ in libcmumps.a(cana_aux_ELT.o)
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
make[1]: *** [csimpletest] Error 1
make: *** [all] Error 2
pmaldona commented 1 year ago

Same issue, any fix for this?

tkralphs commented 1 year ago

Sorry, lost track of this, looks like an issue with Mumps. @dpo, any ideas? If nothing else, Mumps is an optional dependency, so we could leave it out.

dpo commented 1 year ago

Could you please post a link to a gist with the full logs?

mixcoha commented 1 year ago

I have this error> clang -DHAVE_CONFIG_H -I. -I. -I../../src/DylpStdLib -I./../DylpStdLib -O3 -pipe -DNDEBUG -Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long -DDYLP_BUILD -fno-strict-aliasing -c dy_dualmultipivot.c -fno-common -DPIC -o .libs/dy_dualmultipivot.o dy_consys_utils.c:830:7: error: call to undeclared function 'unavailable'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] if (finite(infinity)) setflg(consys->opts,CONSYS_FININF) ; ^ ./dy_vector.h:201:17: note: expanded from macro 'finite'

define finite DYLP_ISFINITE

            ^

../../src/DylpStdLib/config.h:40:23: note: expanded from macro 'DYLP_ISFINITE'

define DYLP_ISFINITE unavailable

                  ^

1 error generated. make[2]: [dy_consys_utils.lo] Error 1 make[2]: Waiting for unfinished jobs.... make[1]: [all-recursive] Error 1 make: [all-recursive] Error 1

tkralphs commented 1 year ago

This should be reported a separate issue, as it has nothing to do with the original issue. It's also probably not really related to the homebrew recipe per se and should be reported/discussed in the DyLP project. In fact, there is already an extensive discussion of this exact issue over there: coin-or/DyLP/issues/18.

Unless you are trying to install DyLP specifically, you probably don't need it. If you want help, please open a discussion or separate issue about this.