Codelite for mixed C++/Fortran on a Mac

CodeLite installation/troubleshooting forum
perini1
CodeLite Curious
Posts: 5
Joined: Sun Feb 14, 2021 12:12 pm
Genuine User: Yes
IDE Question: C++
Contact:

Codelite for mixed C++/Fortran on a Mac

Post by perini1 »

Hi Codelite developer(s),

I'm trying to find a good setup for mixed C++/Fortran on a Mac M1 and unfortunately there are no easy options.

I love how well Codelite works on Mac, and its rich set of features; so if doable, one solution would be that I help out adding more fortran features to Codelite.

From some tests, Fortran support seems limited to "old-style" fortran basically by allowing single files to be compiled with no file inter-dependencies,
while modern Fortran makes heavy usage of classes and modules very much like C++.

Other open-source IDEs like Codeblocks offer such functionality via plugins, but do not work on a Mac; so if I have to choose, I'd rather support Codelite which supports Macs natively.
So I was wondering:
1) how much effort would this take. I think the first thing to do would be to add Fortran among GCC's default languages, and most importantly a Fortran parser and dependency tree builder for the Fortran files, would that take days, weeks, months?

2) In that case, where should I get started from (what classes)?

Thank you in advance,
Federico

User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite for mixed C++/Fortran on a Mac

Post by eranif »

If I had to define new workspace, I would simply go with the File System Workspace which allows you to provide your own
build commands.

In order to achieve "full" support:

  1. Add support for fortran colouring support into CodeLite and probably add "Theme Importer" class
  2. Define Fortran as special file type in FileExtManager
  3. Code completion can easly be added by downloading Fortran LSP from here: https://microsoft.github.io/language-se ... s/servers/ and configure it (should be easy)
  4. Debugger -> I am guessing that GDB is good enough for this
  5. Add Context class for fortran

The easiest way is to follow the Rust support in CodeLite (which is excellent IMO)
It shouldn't take more than couple of days to add support

Make sure you have read the HOW TO POST thread
perini1
CodeLite Curious
Posts: 5
Joined: Sun Feb 14, 2021 12:12 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite for mixed C++/Fortran on a Mac

Post by perini1 »

Ok so now I'm trying to compile Codelite from the git repository,
it fails due to some of the pre-compiled third-party libraries (libssh, lib crypto) being for x86_64 instead of arm64.
Can I find those on GitHub as well?

User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite for mixed C++/Fortran on a Mac

Post by eranif »

which os?

Make sure you have read the HOW TO POST thread
perini1
CodeLite Curious
Posts: 5
Joined: Sun Feb 14, 2021 12:12 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite for mixed C++/Fortran on a Mac

Post by perini1 »

macOS Monterey 12.1 on an Apple M1 max -

This is the error I get:

Code: Select all

[  9%] Linking CXX shared library ../lib/liblibcodelite.dylib
ld: warning: ignoring file ../../sdk/libssh/lib/osx/libssh.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file ../../sdk/libssh/lib/osx/libcrypto.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

then I get a bunch of undefined symbols in the clSFTP class.

I found the possible answer here:
https://stackoverflow.com/questions/657 ... acos-arm64

AFAICT cmake is pulling the c++ stdlib from the system (clang) but somehow, those two libraries were built with the gcc-based one.

Federico

User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite for mixed C++/Fortran on a Mac

Post by eranif »

I would recommend to disable SFTP to make progress. Some of the libraries do not match your arch (M1 processor?)
To build without SSH support pass this to the cmake command line:

Code: Select all

cmake -DENABLE_SFTP=1 ...
Make sure you have read the HOW TO POST thread
Post Reply