macOS-arm64 - problem linking libraries

CodeLite installation/troubleshooting forum
hans
CodeLite Curious
Posts: 4
Joined: Sat Feb 27, 2021 3:21 pm
Genuine User: Yes
IDE Question: C++
Contact:

macOS-arm64 - problem linking libraries

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: macOS-arm64 - problem linking libraries

Post by eranif »

Can you paste the complete build log output? (see my signature)
Make sure you have read the HOW TO POST thread
hans
CodeLite Curious
Posts: 4
Joined: Sat Feb 27, 2021 3:21 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: macOS-arm64 - problem linking libraries

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: macOS-arm64 - problem linking libraries

Post 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
Make sure you have read the HOW TO POST thread
hans
CodeLite Curious
Posts: 4
Joined: Sat Feb 27, 2021 3:21 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: macOS-arm64 - problem linking libraries

Post 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.
hans
CodeLite Curious
Posts: 4
Joined: Sat Feb 27, 2021 3:21 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: macOS-arm64 - problem linking libraries

Post 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.

Post Reply