-
Notifications
You must be signed in to change notification settings - Fork 8
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
Build error for lfortran #3
Comments
Not sure where this might be coming from. Here is a Spack build that works for me on M1: The above error looks like some C++ runtime library issue? |
Building with GCC gives similar errors
|
For LFortran 0.14.0 there is an error on MacOS/Arm64, which got LFortran rejected from homebrew-core (see Homebrew/homebrew-core#92088). Seems like this is fixed with 0.15.0, so maybe an update of the formula would be the best fix. |
Modifying the recipe to load 0.15.0 with url "https://lfortran.github.io/tarballs/release/lfortran-0.15.0.tar.gz"
sha256 "8712c1b0c886f08937ff4c277ff3fa5c05e4dead1bafe55e3bd789be96470127" still gives an error for me
|
I use M1 as my main development machine for LFortran, so everything should work. I've never seen this error. Can you post the full log: the output of cmake and the full ninja build? I am happy to fix it upstream (if this is some bug in LFortran) and make a new release. |
Here's the full stderr and stdout of
|
Ok, so it seems you are missing a C++ standard library in the Homebrew's own clang. Here is an example of the invocation: : && /opt/homebrew/Library/Homebrew/shims/mac/super/clang++ -O3 -funroll-loops -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names src/lfortran/tests/CMakeFiles/x.dir/x.cpp.o -o src/lfortran/tests/x src/lfortran/liblfortran_lib.a src/runtime/legacy/liblfortran_runtime_static.a /opt/homebrew/opt/llvm@11/lib/libLLVMMCJIT.a /opt/homebrew/opt/llvm@11/lib/libLLVMOrcJIT.a /opt/homebrew/opt/llvm@11/lib/libLLVMExecutionEngine.a /opt/homebrew/opt/llvm@11/lib/libLLVMRuntimeDyld.a /opt/homebrew/opt/llvm@11/lib/libLLVMJITLink.a /opt/homebrew/opt/llvm@11/lib/libLLVMOrcError.a /opt/homebrew/opt/llvm@11/lib/libLLVMPasses.a /opt/homebrew/opt/llvm@11/lib/libLLVMCoroutines.a /opt/homebrew/opt/llvm@11/lib/libLLVMipo.a /opt/homebrew/opt/llvm@11/lib/libLLVMInstrumentation.a /opt/homebrew/opt/llvm@11/lib/libLLVMVectorize.a /opt/homebrew/opt/llvm@11/lib/libLLVMFrontendOpenMP.a /opt/homebrew/opt/llvm@11/lib/libLLVMIRReader.a /opt/homebrew/opt/llvm@11/lib/libLLVMLinker.a /opt/homebrew/opt/llvm@11/lib/libLLVMAsmParser.a /opt/homebrew/opt/llvm@11/lib/libLLVMAArch64AsmParser.a /opt/homebrew/opt/llvm@11/lib/libLLVMAArch64CodeGen.a /opt/homebrew/opt/llvm@11/lib/libLLVMAsmPrinter.a /opt/homebrew/opt/llvm@11/lib/libLLVMDebugInfoDWARF.a /opt/homebrew/opt/llvm@11/lib/libLLVMCFGuard.a /opt/homebrew/opt/llvm@11/lib/libLLVMGlobalISel.a /opt/homebrew/opt/llvm@11/lib/libLLVMSelectionDAG.a /opt/homebrew/opt/llvm@11/lib/libLLVMCodeGen.a /opt/homebrew/opt/llvm@11/lib/libLLVMTarget.a /opt/homebrew/opt/llvm@11/lib/libLLVMBitWriter.a /opt/homebrew/opt/llvm@11/lib/libLLVMScalarOpts.a /opt/homebrew/opt/llvm@11/lib/libLLVMAggressiveInstCombine.a /opt/homebrew/opt/llvm@11/lib/libLLVMInstCombine.a /opt/homebrew/opt/llvm@11/lib/libLLVMTransformUtils.a /opt/homebrew/opt/llvm@11/lib/libLLVMAnalysis.a /opt/homebrew/opt/llvm@11/lib/libLLVMObject.a /opt/homebrew/opt/llvm@11/lib/libLLVMBitReader.a /opt/homebrew/opt/llvm@11/lib/libLLVMMCParser.a /opt/homebrew/opt/llvm@11/lib/libLLVMTextAPI.a /opt/homebrew/opt/llvm@11/lib/libLLVMProfileData.a /opt/hom@@@
Undefined symbols for architecture arm64:^M
"std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:^M
LFortran::get_line(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int) in liblfortran_lib.a(parser.cpp.o)^M
ld: symbol(s) not found for architecture arm64^M
clang: error: linker command failed with exit code 1 (use -v to see invocation)^M The line looks good to me. For comparison, here is such a line on my M1:
They look pretty much the same. On your computer, can you try to compile this simple program: #include <iostream>
#include <string>
int main() {
std::string x;
x = "123";
std::cout << x << std::endl;
return 0;
} with /opt/homebrew/Library/Homebrew/shims/mac/super/clang++ a.cpp
./a.out And see if it works? |
I get this with the homebrew clang (base) kjelljorner@dhcp-45 c++ % /opt/homebrew/Library/Homebrew/shims/mac/super/clang++ a.cpp
clang++: The build tool has reset ENV; --env=std required. and this with Apple clang (base) kjelljorner@dhcp-45 c++ % c++ a.cpp
(base) kjelljorner@dhcp-45 c++ % ls
a.cpp a.out
(base) kjelljorner@dhcp-45 c++ % ./a.out
123 |
It looks like Homebrew has a modified |
Might be related to this issue: Homebrew/homebrew-core#96915. |
Is there a way to install homebrew without sudo? If it is, then I can install and help debug it. I just don't want to install anything that requires sudo for operation. So I use Conda and Spack frequently, both of which (now) work and do not require sudo. |
I haven't tried this myself, but it seems possible: https://www.scivision.dev/macos-homebrew-non-sudo/ |
Resolved with #11 |
Seems like we cannot build bottles for Monterey due to the linking issue. |
When trying to install lfortran on Mac M1 Monterey I get this error message. Also, seems like lfortran 0.15 is now available so the recipe could be updated as well.
The text was updated successfully, but these errors were encountered: