Page 1 of 1

Codelite for mixed C++/Fortran on a Mac

Posted: Sun Feb 06, 2022 6:50 pm
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


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

Posted: Sun Feb 06, 2022 8:11 pm
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


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

Posted: Sun Feb 06, 2022 10:01 pm
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?


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

Posted: Wed Feb 09, 2022 10:07 pm
by eranif

which os?


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

Posted: Sun Mar 06, 2022 6:07 pm
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


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

Posted: Fri Mar 11, 2022 12:55 pm
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 ...