Closed ivellapillil closed 1 year ago
Found the issue: https://github.com/microsoft/vscode/issues/116763
Basically I had migrated from old laptop to new one using Apple Time Machine. The old VS code was i86 and when typing arch
in the Terminal also returned i86
. Reinstalling VSCode to Apple Silicon solved the issue. Now it compiles without any error.
Description
I got the latest version of crystal (1.7.1) from brew. I have a Mac M1 laptop. Building my project using the standard terminal works without any issues. However, interestingly, if I build from Visual Studio Code (also using terminal within the VSC), I get
ld: warning: ignoring file /opt/homebrew/lib/libevent.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64
To Reproduce
shards init
puts "hello"
shards build
Expected behavior
The code is compiled successfully.
Current behaviour
ld: warning: ignoring file /opt/homebrew/lib/libevent.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64
What works
If I compile in Mac's native Terminal, using the crystal compiler, it works without any issue.
Machine: MacOS M1 Laptop Crystal 1.7.1 (2023-01-17)
LLVM: 14.0.6 Default target: aarch64-apple-darwin22.2.0