ebertolazzi / mexIPOPT

MATLAB interface for IPOPT
108 stars 25 forks source link

Missing library on M1 #21

Closed 497e0bdf29873 closed 1 year ago

497e0bdf29873 commented 1 year ago

When trying to use the toolbox on an M1 Mac (under Rosetta), the interface just dies with

Invalid MEX-file '/Users/.../Library/Application Support/MathWorks/MATLAB
Add-Ons/Toolboxes/IPOPT-toolbox/bin/osx/ipopt_osx.mexmaci64': dlopen(/Users/.../Library/Application Support/MathWorks/MATLAB
Add-Ons/Toolboxes/IPOPT-toolbox/bin/osx/ipopt_osx.mexmaci64, 0x0006): Library not loaded: /usr/local/opt/ampl-mp/lib/libasl.3.dylib
  Referenced from: <51786EB4-570D-3571-900E-D6010E56D3CD> /Users/.../Library/Application Support/MathWorks/MATLAB
  Add-Ons/Toolboxes/IPOPT-toolbox/bin/osx/libipoptamplinterface.3.dylib
  Reason: tried: '/usr/local/opt/ampl-mp/lib/libasl.3.dylib' (no such file),
  '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/ampl-mp/lib/libasl.3.dylib' (no such file),
  '/usr/local/opt/ampl-mp/lib/libasl.3.dylib' (no such file), '/usr/local/lib/libasl.3.dylib' (no such file),

  '/usr/lib/libasl.3.dylib' (no such file, not in dyld cache)

It seems that libasl.3.dylib should be provided in the toolbox, but it is not being provided. Moreover, per otool, there seems to be hard-coded link to a version in /usr/local/ in libipoptamplinterface.3.dylib.

Or is there a way to install an x86 version of the library using homebrew?

ebertolazzi commented 1 year ago

The problem is the fact that linked library have fixed search path and are connected to homebrew. To overcome this problem the script copy_dylib.rb and filter_dylib.rb copy the required library in bin/osx and change the seach path in the dylib. In this case I missed some library. Its difficult to test if all the library are linked correctly because I require a different mac with different configuration. I have redone the toolbox with the password corrected with the same tag 1.1.6. Try It.

497e0bdf29873 commented 1 year ago

This works. Thanks!