Author Topic: Code::Blocks ported to CYGWIN  (Read 2670 times)

Offline Carlo Bramini

  • Single posting newcomer
  • *
  • Posts: 2
Code::Blocks ported to CYGWIN
« on: July 18, 2022, 09:42:22 am »
Hello,
I ported Code::Blocks to CYGWIN.
It required few simple changes to make it working.
I attached my patch created from the latest sources on the repository at the time of writing.

src/include/prep.h
Added platform_cygwin to the list of available platforms.

src/plugins/xpmanifest/windowsxplooknfeel.h
Description of the issue here:
https://sourceforge.net/p/codeblocks/tickets/1191/

src/sdk/Makefile.am
Description of the issue here:
https://sourceforge.net/p/codeblocks/tickets/1190/

src/sdk/configmanager.cpp
when platform::cygwin is true, the name of the file is cygcompiler.dll

src/sdk/pluginmanager.cpp
The DLLs created by CYGWIN start with the cyg prefix in their name.
The change adds RemoveLibraryPrefix() function to implement this and simplify the whole code.
Then, it also adds platform::cygwin to ScanForPlugins() for returning the right extension *.dll for plugins, otherwise it will use *.so which is wrong.

After applying the changes, you can see the result into the attached image.

I hope that you will find this report useful.
Sincerely,

Carlo Bramini.

Offline Carlo Bramini

  • Single posting newcomer
  • *
  • Posts: 2
Re: Code::Blocks ported to CYGWIN
« Reply #1 on: July 18, 2022, 12:59:11 pm »
Here there is an additional change that I have not included into the patch attached in the previous comment.
When building Code::Blocks, this message is continuously printed on the console for every source:

warning: -fPIC ignored for target (all code is position independent)

There is this piece of code into configure.ac:

case `uname` in
    Solaris)
        if test "$GCC" = yes; then
            PIC_CFLAGS="-fPIC"
        else
            PIC_CFLAGS="-KPIC"
        fi
    ;;
    *)
        PIC_CFLAGS="-fPIC"
    ;;
esac


In my opinion, checking just uname is not the best idea although it may work.
So I would like to suggest to replace it with comething like this:

case $host in
*cygwin* | *mingw*)
    PIC_CFLAGS=""
    ;;

*sunos*|*solaris*)
    if test "$GCC" = yes; then
        PIC_CFLAGS="-fPIC"
    else
        PIC_CFLAGS="-KPIC"
    fi
    ;;

*)
    PIC_CFLAGS="-fPIC"
    ;;
esac


This has the advantage to work also with a cross compiler if you have installed one.
I had not included it because it is just a warning messages and it does not prevent the code to be built, but since it is quite annoying I think that it won't be a bad idea to make that change.
I also attached a patch with this change if you will find it useful.

Sincerely.