zertovitch / gwindows

GWindows: GUI framework for MS Windows
https://sf.net/projects/gnavi/
21 stars 5 forks source link

Small changes to allow the current master to compile on AdaCore GNAT/GCC 6.3.1 (2017-GPL-WIndows x86 32-bit). #37

Closed nthcomputing closed 2 months ago

nthcomputing commented 2 months ago

Hi, I'm running an up-to-date Windows 11 VM but purposely developing Windows x86 32-bit code because I need to interact with an existing 32-bit project that cannot be migrated to 64-bit. As of July 2, 2024 the current master branch requires a few small code and compiler option corrections to work with AdaCore's last released community Windows 32bit-only compiler - one error might be a bug (unconstrained array using out-only parameter needs bounds?), the rest seem correct under existing Ada rules where GNAT has gotten a lot better at detecting accessibility issues in the last 8 years or so. The vast majority are accessibility warnings. However I'm pretty sure you know what you're doing so the code I'm recommending just either gets around the problem or suppresses the problem messages to allow compilation to continue by using unchecked_access instead of access. The very last one, that's likely a bug can only be gotten around by removing the "warnings are errors, -gnatwe" option in the GNATCOM.GPR file.

Patch file included. GNAVI.patch_mingw32_GCC6_3_1_ADACORE_2017.patch

gnatocx-irunningobjecttable_interface.adb:135:39: non-local pointer cannot point to local object gnatocx-imoniker_interface.adb:327:60: non-local pointer cannot point to local object gnatcom-create-iconnectionpointcontainer.adb:87:07: warning: foreign caller must pass bounds explicitly

There are a few more files with the same non-local pointer error but I don't have them saved. The patch file addresses them by simply changing the access attribute.

I'm running this on an up-to-date Windows 11 VM but with Adacore's gnat-gpl-2017-x86-windows-bin.exe community edition compiler (GCC 6.3.1), thought I suspect these non-local pointer errors would occur with any modern GCC compiler today.

The only reason I'm using this compiler is I was normally an MSYS2 user which has all the recent stuff (Alire uses it too). However the MSYS2 people have done a lot of damage removing the 32 bit library support as of about two years ago (search "32-bit" on https://www.msys2.org/news/). Even though the modern 64-bit GCC/GNAT compilers can in fact produce 32-bit object code (-m32), MSYS2 LD can't seem to link it, no 32-bit libs! I fought for week on this before I just gave up and hunted down a 32-bit only, all in one, Adacore environment because I'm only dealing with 32-bit exclusively for an older project and that must stay in 32-bit and this was the easiest way to get going.

Thanks for the great library and doc file! I look forward to really trying this out!

zertovitch commented 2 months ago

Thanks for the patch. Fortunately I am used to GNAT GPL 2017 for the same reason (it's the latest 32-bit one). I start with less on-topic things of your patch: the missing dirs are now created without supplemental option in gnatmake - see commit https://github.com/zertovitch/gwindows/commit/78a7b6778c0f59e8435ad1330410722244c5b9e5 . For gnatcom.gpr, I prefer not to touch it. For gnatocx-irunningobjecttable_interface.adb, I would keep the hr variable but use 'Unchecked_Access. Is it OK for you?

zertovitch commented 2 months ago

The rest of the issues should be fine now (see commit https://github.com/zertovitch/gwindows/commit/77348842eb41f6d638724be97f73b6464fe48b13 ).

nthcomputing commented 2 months ago

It's totally up to you on what you like to use or reorganize , thanks for taking my minor changes! I did find a few more issues today, I'll add them to this thread (since they are similar) in the next few days! I've now got everything to compile!

nthcomputing commented 2 months ago

okay, 3 basic additional issues were discovered in a couple areas:

  1. ganvi-icg.adb: ` function GWindows_Casing (S : String) return String is --(if S = "id" then "ID" elsif S = "progid" then "ProgID" else GNAT.Case_Util.To_Mixed (S)); -- illegal due to procedure To_Mixed, not being a function! copy : string := S;

    begin
             if S = "id" then
        GNAT.Case_Util.To_Upper(Copy);
      elsif S = "progid" then
        Copy := "ProgID";
      else
        GNAT.Case_Util.To_Mixed(Copy);
      end if;
    
      return Copy;

    end GWindows_Casing;`

  2. gnavi/gnavi_ide/src/makefile gnavi_ide: gnavi_ide.coff control_creators.ads icg

The above just changes the order of files on requirements so that "gnat_ide.coff" needs to be first. If not then when you go to build the other targets, the resource file is missing because it wasn't built before hand as a requirement. SO now it's built first before all other targets. On windows I'm using Make 4.4.1, compiled from source.

  1. Qwenerator/src/make.cmd: 66. if "%1"=="-res" windres GWenerator.rc GWenerator.coff if "%1"=="-res" shift if not exist GWenerator.coff windres GWenerator.rc GWenerator.coff

The whole ".rbj" things makes no sense to the linker, needs to something real, change it and now it links and works.

That should be it!

zertovitch commented 2 months ago

Point 1 is done in commit https://github.com/zertovitch/gwindows/commit/d346a18568b0fe4220721685fab4e88aab91028e . Point 2 is done in commit https://github.com/zertovitch/gwindows/commit/64b8cf34568b532e44bf2e5cd44b6222ce8cde7f . Note that the GNAVI topic is a recent resurrection effort of something abandoned 20 years ago. Don't expect it to be usable in the near future... Point 3: the 32-bit linker complains because it finds a 64 bit object file. Just recreate it with "make -res". The extension is not important.