cea-hpc / modules

Environment Modules: provides dynamic modification of a user's environment
http://modules.sourceforge.net/
GNU General Public License v2.0
695 stars 109 forks source link

source /usr/local/opt/modules/init/zsh : incompatible architecture #468

Closed lainafreyer closed 2 years ago

lainafreyer commented 2 years ago

After running $ brew install modules, I receive the message:

To activate modules, add the following at the end of your .zshrc: source /usr/local/opt/modules/init/zsh

When I run ~ % source /usr/local/opt/modules/init/zsh I receive the following message :

ERROR: dlopen(/usr/local/Cellar/modules/5.1.1/lib/libtclenvmodules.dylib, 0x000A): tried: '/usr/local/Cellar/modules/5.1.1/lib/libtclenvmodules.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))) while executing "load [file normalize [getConf tcl_ext_lib]] Envmodules" Please report this issue at https://github.com/cea-hpc/modules/issues

xdelaruelle commented 2 years ago

What is the output of brew config and brew doctor?

lainafreyer commented 2 years ago

Thank you for your help. The output is:

lainafreyer@Lainas-MBP ~ % brew config HOMEBREW_VERSION: 3.5.9 ORIGIN: https://github.com/Homebrew/brew HEAD: 3748bed378401ed75abdf32bcb3d2674d854a6f9 Last commit: 8 days ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: 471c2505aa7f468af819cda3b63fe13cf6ceafdc Core tap last commit: 2 hours ago Core tap branch: master HOMEBREW_PREFIX: /usr/local HOMEBREW_REPOSITORY: /usr/local/Homebrew HOMEBREW_CELLAR: /usr/local/Cellar HOMEBREW_CASK_OPTS: [] HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.kdOeW0PJ35/org.xquartz:0 HOMEBREW_MAKE_JOBS: 8 Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby CPU: octa-core 64-bit arm_firestorm_icestorm Clang: 13.1.6 build 1316 Git: 2.32.1 => /Library/Developer/CommandLineTools/usr/bin/git Curl: 7.79.1 => /usr/bin/curl macOS: 12.5-arm64 CLT: 13.4.0.0.1.1651278267 Xcode: N/A Rosetta 2: false lainafreyer@Lainas-MBP ~ % 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: 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/libtcl8.6.dylib /usr/local/lib/libtk8.6.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/fakemysql.h /usr/local/include/fakepq.h /usr/local/include/fakesql.h /usr/local/include/itcl.h /usr/local/include/itcl2TclOO.h /usr/local/include/itclDecls.h /usr/local/include/itclInt.h /usr/local/include/itclIntDecls.h /usr/local/include/itclMigrate2TclCore.h /usr/local/include/itclTclIntStubsFcn.h /usr/local/include/mysqlStubs.h /usr/local/include/odbcStubs.h /usr/local/include/pqStubs.h /usr/local/include/tcl.h /usr/local/include/tclDecls.h /usr/local/include/tclOO.h /usr/local/include/tclOODecls.h /usr/local/include/tclPlatDecls.h /usr/local/include/tclThread.h /usr/local/include/tclTomMath.h /usr/local/include/tclTomMathDecls.h /usr/local/include/tdbc.h /usr/local/include/tdbcDecls.h /usr/local/include/tdbcInt.h /usr/local/include/tk.h /usr/local/include/tkDecls.h /usr/local/include/tkPlatDecls.h

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/tcl.pc /usr/local/lib/pkgconfig/tk.pc

Warning: Unbrewed static libraries 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 static libraries: /usr/local/lib/libtclstub8.6.a /usr/local/lib/libtkstub8.6.a

Warning: Your Homebrew's prefix is not /opt/homebrew. Some of Homebrew's bottles (binary packages) can only be used with the default prefix (/opt/homebrew). You will encounter build failures with some formulae. Please create pull requests instead of asking for help on Homebrew's GitHub, Twitter or any other official channels. You are responsible for resolving any issues you experience while you are running this unsupported configuration.

Warning: Broken symlinks were found. Remove them with brew cleanup: /usr/local/bin/opt/R/arm64/gfortran/SDK /usr/local/opt/R/arm64/gfortran/SDK

xdelaruelle commented 2 years ago

From what I understand, you run MacOS 12.5 (Monterey) on a arm64 machine.

It seems that x86_64 version of libraries are installed instead of arm64 version.

Looking at similar issue on StackOverflow, I would suggest to check all the libraries to determine what are those not corresponding to your architecture.

$ find /usr/local/Cellar/ -name *.dylib -exec lipo -info '{}' \; | grep -v arm64

I am not familiar with MacOS and Homebrew, but I would suggest to uninstall all the software whose libraries are not made for arm64. Then try to reinstall them to see if afterward they install the proper version for arm64.

Another point, from the output of brew doctor: it seems that Tcl was not installed as Homebrew expect. Maybe reinstalling Tcl properly with Homebrew could also solve the issue.

lainafreyer commented 2 years ago

I removed the unbrewed files indicated by brew doctor and reinstalled homebrew and Tcl. I can now install and activate modules.

Thank you!