Page 1 of 1

macOS-arm64 - problem linking libraries

Posted: Sat Feb 27, 2021 3:36 pm
by hans
Hi,

I am using CodeLite on macOS 11.2.1 with an M1 chip. I have a C++ project that links to libraries (openmpi and hypre). The compilation works fine, but when trying to link to the libraries, I get the following error message:
ld: warning: ignoring file /usr/local/hypre/lib/libHYPRE.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /usr/local/openmpi/lib/libmpi.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
I am pretty sure that I am actually building for macOS-arm64, compiling the project outside CodeLite using a make file works fine. I was wondering whether this issue could be possibly fixed from CodeLite's side? Appreciating the help!
Hans

Re: macOS-arm64 - problem linking libraries

Posted: Sun Feb 28, 2021 3:37 pm
by eranif
Can you paste the complete build log output? (see my signature)

Re: macOS-arm64 - problem linking libraries

Posted: Mon Mar 01, 2021 1:22 am
by hans
Hi, thanks for the follow up! Since the complete build log output is too long for the forum, it can be found under this dropbox link: https://www.dropbox.com/s/jdpbgc8epcqy0 ... t.txt?dl=0.

In case it helps, the project I try to compile and its source code can be found here: https://github.com/REEF3D/REEF3D

Re: macOS-arm64 - problem linking libraries

Posted: Sun Mar 14, 2021 8:57 am
by eranif
The linker clearly gives you a hint on what is broken:

Code: Select all

ld: warning: ignoring file /usr/local/openmpi/lib/libmpi.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Your libmpi.dylib is x86_64 while your code is compiled for arm64
Note that this is not a C++ forum, so you should take these kind of questions to the proper forum

Re: macOS-arm64 - problem linking libraries

Posted: Mon Mar 15, 2021 1:44 am
by hans
Thanks for taking the time to have a look! Yes, I did see the linker output. The thing is, libmpi.dylib is not x86_64. It was natively compiled for macOS-arm64. Compiling the same project with a makefile, linking to the same libmpi.dylib library (and all other libraries), works fine. That is why I guess, the error is related to CodeLite or the way it is trying to link the libraries.

Re: macOS-arm64 - problem linking libraries

Posted: Thu Aug 25, 2022 3:04 pm
by hans

Just wanted to give feedback and happy to report: Using the Codelite 16.2 version installed from brew finally fixes this persistent issue on Mac with arm64.