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

Error installing CoinUtils on Mac M1 #151

Closed
DrShaneBurke opened this issue Mar 5, 2021 · 7 comments
Closed

Error installing CoinUtils on Mac M1 #151

DrShaneBurke opened this issue Mar 5, 2021 · 7 comments

Comments

@DrShaneBurke
Copy link

DrShaneBurke commented Mar 5, 2021

When installing coin-or-tools/coinor/cbc via homebrew within PyCharm (community version 2020.3) running Python 3.9 on a 2020 MacBook Air with an M1 Apple Silicon chip running macOS Big Sur (version 11.2.2), I get the assertion error included below while running make test on CoinPackedVector. This has been reported on the homebrew-coinor GitHub previously (coin-or-tools/homebrew-coinor#62), however the problem really seems to be with CoinUtils, so re-posting here. Hope someone could help with this. Really interested in using this for healthcare applications.

==> make
==> make test
Last 15 lines from /Users/shaneburke/Library/Logs/Homebrew/coinutils/03.make:
need to fill in rows
before pass 45 with seed of 464143
before pass 46 with seed of 858620
need to fill in rows
before pass 47 with seed of 938599
before pass 48 with seed of 643306
before pass 49 with seed of 596504
Time for 50 CoinModel passes is 0.004713 seconds

Testing CoinError
Testing CoinShallowPackedVector
Testing CoinPackedVector
Assertion failed: (r.isEquivalent(rV)), function CoinPackedVectorUnitTest, file CoinPackedVectorTest.cpp, line 707.
make[1]: *** [test] Abort trap: 6
make: *** [test] Error 2

Do not report this issue to Homebrew/brew or Homebrew/core!

These open issues may also help:
Error installing coinutils on Mac M1 https://github.com/coin-or-tools/homebrew-coinor/issues/62
@tkralphs
Copy link
Member

tkralphs commented Mar 5, 2021

I would be happy to try to help someone debug this, but there's not a lot I can do without access to an M1-based machine. As mentioned in my previous comments, I doubt this will cause any problems in practice, so you can always disable the test. I'm not sure if you can do this from the command line, but if nothing else, you can do brew edit coin-or-tools/coinor/coinutils (I think, I don't have access to my OSX box to test right now) and just comment out or delete the line that's doing the test in the recipe. Then you should be able to install and it's likely everything will work after that.

@DrShaneBurke
Copy link
Author

Thank you for the reply @tkralphs. I commented out the line mentioned in your previous comments. CoinUtils successfully installed, however, I encountered a new error during install of CLP. I don't quite understand what this is trying to tell me, but I think it may be a compilation error due to too many errors. The function __builtin_ia32_emms() seems to be the culprit which based on reading other posts, may be resulting in incompatibility with non-intel machines.

Before including the current error output, here are the exact steps I took to resolve the initial error I reported for anyone that comes across it:

In the PyCharm terminal run: brew tap coin-or-tools/coinor

  1. In the Finder, navigate to Go > Go to Folder....
  2. Enter /opt/homebrew/Library/Taps/coin-or-tools/homebrew-coinor/ in the prompt
  3. Open the file coinutils.rb in this folder within a plain text editor of your choice
  4. Comment out line 49: so that:
    system "make", "test" > BECOMES > # system "make", "test"
  5. Save this file

Go back to the PyCharm terminal and run: brew install coin-or-tools/coinor/cbc

Unfortunately, now I get the following error when installing CLP :(

In file included from ClpPackedMatrix.cpp:6755:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/immintrin.h:14:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
    __builtin_ia32_emms();
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/math.h:647:12: note: '__builtin_isless' declared here
    return isless(__lcpp_x, __lcpp_y);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:545:22: note: expanded from macro 'isless'
#define isless(x, y) __builtin_isless((x),(y))
                     ^
In file included from ClpPackedMatrix.cpp:6755:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/immintrin.h:14:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
    __builtin_ia32_emms();
                        ^
/bin/sh ../libtool --tag=CXX --mode=compile clang++ -DHAVE_CONFIG_H -I. -I`echo .`  -I/opt/homebrew/Cellar/coinutils/2.11.3/include/coinutils/coin  -DCOIN_HAS_CLP     -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long   -DCLP_BUILD -c -o ClpPdcoBase.lo ClpPdcoBase.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:310:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:331:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:352:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:352:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^                    ~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:373:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:373:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^                    ~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:394:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:394:19: error: first argument of MTE builtin function must be a pointer ('__v2si' (vector of 2 'int' values) invalid)
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^                    ~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
/bin/sh ../libtool --tag=CXX --mode=compile clang++ -DHAVE_CONFIG_H -I. -I`echo .`  -I/opt/homebrew/Cellar/coinutils/2.11.3/include/coinutils/coin  -DCOIN_HAS_CLP     -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long   -DCLP_BUILD -c -o ClpLsqr.lo ClpLsqr.cpp
 clang++ -DHAVE_CONFIG_H -I. -I. -I/opt/homebrew/Cellar/coinutils/2.11.3/include/coinutils/coin -DCOIN_HAS_CLP -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD -c ClpPredictorCorrector.cpp  -fno-common -DPIC -o .libs/ClpPredictorCorrector.o
20 errors generated.
make[2]: *** [ClpPackedMatrix.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
 clang++ -DHAVE_CONFIG_H -I. -I. -I/opt/homebrew/Cellar/coinutils/2.11.3/include/coinutils/coin -DCOIN_HAS_CLP -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD -c ClpPdco.cpp  -fno-common -DPIC -o .libs/ClpPdco.o
 clang++ -DHAVE_CONFIG_H -I. -I. -I/opt/homebrew/Cellar/coinutils/2.11.3/include/coinutils/coin -DCOIN_HAS_CLP -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD -c ClpPdcoBase.cpp  -fno-common -DPIC -o .libs/ClpPdcoBase.o
 clang++ -DHAVE_CONFIG_H -I. -I. -I/opt/homebrew/Cellar/coinutils/2.11.3/include/coinutils/coin -DCOIN_HAS_CLP -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD -c ClpLsqr.cpp  -fno-common -DPIC -o .libs/ClpLsqr.o
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1 

@tkralphs
Copy link
Member

tkralphs commented Mar 5, 2021

This would seem to be the same problem as reported here: coin-or/Clp#126. It has been fixed and there is a new release, but I guess the homebrew recipe is still using a slightly outdated release and needs to be updated. Unfortunately, I don't have access to my OS X box until Monday. You can fix it yourself if you want to venture back into editing the recipe by hand. Just change 1.17.3 to 1.17.6 in clp.rb. When you do that, it will complain that the SHAs don't match, but you can copy the new SHA (which it will report to you) into the recipe file and when you run again, it should go through. Or just enjoy your weekend and I will make the update on Monday :).

@DrShaneBurke
Copy link
Author

Thank you again for your quick response @tkralphs . This worked perfectly after changing the recipe for clp to the most up to date version. Sorry I didn't notice that issue earlier before writing here. Thanks again for this excellent tool. Look forward to sharing our insights using this framework in the health care setting with the broader community!

@tkralphs
Copy link
Member

tkralphs commented Mar 5, 2021

No problem, glad it worked out! While you're at it, it wouldn't hurt to update Cbc and the other dependencies (Cgl, Osi, CoinUtils) to their latest releases just as you did with Clp. If you're feeling really adventurous, you can submit a Pull Request to update the recipes :). If that is a bridge too far, no worries, I will get to it on Monday.

DrShaneBurke added a commit to DrShaneBurke/homebrew-coinor that referenced this issue Mar 6, 2021
1. Updated homepage, url, and head to refer to GitHub rather than coin-or.org
2. Updated version reference to most recent (2.10.5)
3. Updated sha256 for appropriate version (pending)

Changes related to the issue discussed at coin-or/CoinUtils#151
DrShaneBurke added a commit to DrShaneBurke/homebrew-coinor that referenced this issue Mar 6, 2021
1. Updated homepage, url, and head to refer to GitHub rather than coin-or.org
2. Updated version reference to most recent (2.10.5)
3. Updated sha256 for appropriate version (pending)

Changes related to the issue discussed at coin-or/CoinUtils#151
DrShaneBurke added a commit to DrShaneBurke/homebrew-coinor that referenced this issue Mar 6, 2021
1. Updated homepage, url, and head to refer to GitHub rather than coin-or.org
2. Updated version reference to most recent (1.17.6)
3. Updated sha256 for appropriate version (pending)

Changes related to the issue discussed at coin-or/CoinUtils#151
DrShaneBurke added a commit to DrShaneBurke/homebrew-coinor that referenced this issue Mar 6, 2021
1. Updated homepage, url, and head to refer to GitHub rather than coin-or.org
2. Updated version reference to most recent (0.60.3)
3. Updated sha256 for appropriate version (pending)

Changes related to the issue discussed at coin-or/CoinUtils#151
DrShaneBurke added a commit to DrShaneBurke/homebrew-coinor that referenced this issue Mar 6, 2021
1. Updated homepage, url, and head to refer to GitHub rather than coin-or.org
2. Updated version reference to most recent (2.11.4)
3. Updated sha256 for appropriate version (pending)

Changes related to the issue discussed at coin-or/CoinUtils#151
DrShaneBurke added a commit to DrShaneBurke/homebrew-coinor that referenced this issue Mar 6, 2021
1. Updated homepage, url, and head to refer to GitHub rather than coin-or.org
2. Updated version references to most recent (as of 3/6/2021)
3. Updated sha256 checksums for appropriate versions
4. Commented out "make" "test" as described at coin-or/CoinUtils#151 (comment) to bypass assertion error

Changes were related to the issue discussed at coin-or/CoinUtils#151

Successfully compiled without error when "brew tap coin-or-tools/coinor" then "brew install coin-or-tools/coinor/cbc" was run within PyCharm terminal (community version 2020.3) running Python 3.9 (installed via homebrew version 3.0.4-50) on a 2020 MacBook Air with an M1 Apple Silicon chip running macOS Big Sur (version 11.2.2) and XCode version 12.4
@DrShaneBurke
Copy link
Author

DrShaneBurke commented Mar 6, 2021

No problem, glad it worked out! While you're at it, it wouldn't hurt to update Cbc and the other dependencies (Cgl, Osi, CoinUtils) to their latest releases just as you did with Clp. If you're feeling really adventurous, you can submit a Pull Request to update the recipes :). If that is a bridge too far, no worries, I will get to it on Monday.

Thank you again for your patience as I am new to the compilation process. I'm also new to Git, but hopefully I didn't mess things up too much. See my pull request with these updates at coin-or-tools/homebrew-coinor#63. It's the least I could do for all your help. Do you recommend any good resources for learning more about constraint and linear programming optimization? Please fell free to reach out if you ever have an interest in collaborating on projects within healthcare, I find this a fascinating field.

@tkralphs
Copy link
Member

tkralphs commented Mar 6, 2021

I would absolutely be interested in collaborating on projects in the healthcare space. Let's connect off-line and we could discuss that plus resources for learning more about optimization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants