Estoy tratando de instalar sundials
(un solucionador de ecuaciones no lineales y diferenciales/algebraicas) utilizando su brew
fórmula en mi Macbook con chip M1. Previamente he creado una nueva instalación en /opt/homebrew/
para tener una versión nativa de Homebrew:
$ brew config
HOMEBREW_VERSION: 3.3.16
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2dc375acc2fe4e089d103171ec8fb06a87d83bb6
Last commit: 4 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: ee1c1945110d475d441a5b7e11f58b83704e9e4b
Core tap last commit: 50 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_CORE_GIT_REMOTE: https://github.com/Homebrew/homebrew-core
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.Xs1aY002mO/org.macosforge.xquartz:0
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 13.0.0 build 1300
Git: 2.32.0 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.77.0 => /usr/bin/curl
macOS: 12.2.1-arm64
CLT: 13.2.0.0.1.1638488800
Xcode: 13.2.1
Rosetta 2: false
Después de instalar sundials
He intentado ejecutar un simple C++ ( g++
es el compilador) pero tengo el siguiente error:
$ g++ user-data.cpp -o main
user-data.cpp:9:10: fatal error: 'cvode/cvode.h' file not found
#include <cvode/cvode.h> // prototypes for CVODE fcts., consts.
^~~~~~~~~~~~~~~
1 error generated.
Entonces, probé esta otra opción:
$ g++ -I/opt/homebrew/Cellar/sundials/5.8.0/include/ user-data.cpp -o main
user-data.cpp:96:8: warning: 'SUNSPGMR' is deprecated [-Wdeprecated-declarations]
LS = SUNSPGMR(y, 0, 0);
^
/opt/homebrew/Cellar/sundials/5.8.0/include/sunlinsol/sunlinsol_spgmr.h:99:1: note: 'SUNSPGMR' has been explicitly marked deprecated here
SUNDIALS_DEPRECATED_EXPORT SUNLinearSolver SUNSPGMR(N_Vector y, int pretype, int maxl);
^
/opt/homebrew/Cellar/sundials/5.8.0/include/sundials/sundials_export.h:29:54: note: expanded from macro 'SUNDIALS_DEPRECATED_EXPORT'
# define SUNDIALS_DEPRECATED_EXPORT SUNDIALS_EXPORT SUNDIALS_DEPRECATED
^
/opt/homebrew/Cellar/sundials/5.8.0/include/sundials/sundials_export.h:25:47: note: expanded from macro 'SUNDIALS_DEPRECATED'
# define SUNDIALS_DEPRECATED __attribute__ ((__deprecated__))
^
1 warning generated.
Undefined symbols for architecture arm64:
"_CVSpilsSetJacTimes", referenced from:
_main in user-data-138c42.o
"_CVSpilsSetLinearSolver", referenced from:
_main in user-data-138c42.o
"_CVode", referenced from:
_main in user-data-138c42.o
"_CVodeCreate", referenced from:
_main in user-data-138c42.o
"_CVodeFree", referenced from:
_main in user-data-138c42.o
"_CVodeInit", referenced from:
_main in user-data-138c42.o
"_CVodeSStolerances", referenced from:
_main in user-data-138c42.o
"_CVodeSetUserData", referenced from:
_main in user-data-138c42.o
"_N_VDestroy", referenced from:
_main in user-data-138c42.o
"_N_VGetArrayPointer", referenced from:
f(double, _generic_N_Vector*, _generic_N_Vector*, void*) in user-data-138c42.o
jtv(_generic_N_Vector*, _generic_N_Vector*, double, _generic_N_Vector*, _generic_N_Vector*, void*, _generic_N_Vector*) in user-data-138c42.o
"_N_VNew_Serial", referenced from:
_main in user-data-138c42.o
"_N_VPrint_Serial", referenced from:
_main in user-data-138c42.o
"_SUNLinSolFree", referenced from:
_main in user-data-138c42.o
"_SUNSPGMR", referenced from:
_main in user-data-138c42.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Por alguna razón, mis enlaces siguen siendo buscando para la versión x86_64 de los archivos. Parece que mi máquina es un desastre ahora mismo, así que agradecería mucho cualquier sugerencia sobre cómo solucionar este problema.