Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible Newer Version of GNAT not compiling this project. #74

Open
coffeebe4code opened this issue Jun 13, 2021 · 11 comments
Open

Possible Newer Version of GNAT not compiling this project. #74

coffeebe4code opened this issue Jun 13, 2021 · 11 comments

Comments

@coffeebe4code
Copy link

coffeebe4code commented Jun 13, 2021

Originally reported here. My suspicion is that the latest version of ada has a new feature which does not allow this anonymous type usage anymore.

[Ada]          sdl-video-palettes.adb
sdl-video-palettes.adb:146:41: error: expected type "Palette_Constant_Access" defined at sdl-video-palettes.ads:124
sdl-video-palettes.adb:146:41: error: found type access to "Palette'CLASS" defined at line 69
sdl-video-palettes.adb:163:41: error: expected type "Palette_Constant_Access" defined at sdl-video-palettes.ads:124
sdl-video-palettes.adb:163:41: error: found type access to "Palette'CLASS" defined at line 69
@Lucretia
Copy link
Collaborator

Paste the output of gcc -v

@coffeebe4code
Copy link
Author

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/christopher/opt/GNAT/2021/bin/../libexec/gcc/x86_64-pc-linux-gnu/10.3.1/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: ../src/configure --enable-languages=ada,c,c++ --enable-checking=release --enable-dual-exceptions --enable-offload-targets=nvptx-none --enable-_cxa_atexit --enable-threads=posix --with-bugurl=URL:mailto:[email protected] --disable-nls --without-libiconv-prefix --disable-libstdcxx-pch --disable-libada --disable-multilib --enable-libstdcxx --with-mpfr=/it/sbx/a2c2/x86_64-linux/mpfr-3.1.5/install --with-gmp=/it/sbx/a2c2/x86_64-linux/gmp-6.1.2/install --with-mpc=/it/sbx/a2c2/x86_64-linux/mpc-1.0.3/install --with-build-time-tools=/it/sbx/a2c2/x86_64-linux/gcc-c/build/buildtools/bin --prefix=/it/sbx/a2c2/x86_64-linux/gcc-c/pkg --build=x86_64-pc-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.3.1 20210520 (for GNAT Community 2021 20210519) (GCC) 

@Lucretia

@coffeebe4code
Copy link
Author

any idea? Still unable to generate sdlada, and there is no binary distributed anywhere.

@Lucretia
Copy link
Collaborator

Lucretia commented Jul 7, 2021

No, because it should work, it's assigning a constant access variable to another in the creation of a new iterator from an iterator of the same type. You could try gcc 11 to see if it's a bug in gcc 10, I currently only have gcc 9.3.0 built. Or try replacing:

   overriding
   function First (Object : Iterator) return Cursor is
   begin
      --  Put_Line ("First -> Index = " & Natural'Image (Object.Index));

      return Cursor'(Container => Object.Container,
                     Index     => Object.Index,
                     Current   => Object.Container.Data.Colours);
   end First;

With:

   overriding
   function First (Object : Iterator) return Cursor is
   begin
      --  Put_Line ("First -> Index = " & Natural'Image (Object.Index));

      return C : Cursor do
         C.Container := Object.Container;
         C.Index     := Object.Index;
         C.Current   := Object.Container.Data.Colours;
      end return;
   end First;

And see if that works.

@Lucretia
Copy link
Collaborator

Did this work?

@xyproto
Copy link

xyproto commented Aug 13, 2021

I get the same error.

gcc (GCC) 11.1.0 on Arch Linux on 64-bit x86, using latest master (997d2ae).

gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=linux -Ptools.gpr
Setup
[mkdir]        object directory for project Tools
Compile
[Ada]          gen_keyboard.adb
[Ada]          scancodes.ads
[Ada]          utils.adb
Bind
[gprbind]      gen_keyboard.bexch
[Ada]          gen_keyboard.ali
Link
[link]         gen_keyboard.adb
./gen/release/tools/gen_keyboard > gen/src/sdl-events-keyboards.ads
gprbuild -p -gnat2012 -XSDL_MODE=release -XSDL_PLATFORM=linux \
-Psdlada.gpr
Setup
[mkdir]        object directory for project SDLAda
Compile
[C]            version_ttf.c
[C]            version_images.c
[C]            version.c
[Ada]          sdl-ttfs.adb
[Ada]          sdl-ttfs-versions.adb
[Ada]          sdl-ttfs-makers.adb
[Ada]          sdl-images.adb
[Ada]          sdl-images-versions.adb
[Ada]          sdl-images-io.adb
[Ada]          sdl.adb
[Ada]          sdl-video.adb
[Ada]          sdl-video-windows.adb
[Ada]          sdl-video-windows-manager.adb
[Ada]          sdl-video-windows-makers.adb
[Ada]          sdl-video-textures.adb
[Ada]          sdl-video-textures-makers.adb
[Ada]          sdl-video-surfaces.adb
sdl-video-surfaces.ads:212:57: warning: aggregate not fully initialized
[Ada]          sdl-video-surfaces-makers.adb
[Ada]          sdl-video-renderers.adb
[Ada]          sdl-video-renderers-makers.adb
[Ada]          sdl-video-rectangles.adb
[Ada]          sdl-video-pixels.ads
[Ada]          sdl-video-pixel_formats.adb
[Ada]          sdl-video-palettes.adb
sdl-video-palettes.adb:146:41: expected type "Palette_Constant_Access" defined at sdl-video-palettes.ads:124
sdl-video-palettes.adb:146:41: found type access to "Palette'CLASS" defined at line 69
sdl-video-palettes.adb:163:41: expected type "Palette_Constant_Access" defined at sdl-video-palettes.ads:124
sdl-video-palettes.adb:163:41: found type access to "Palette'CLASS" defined at line 69
gprbuild: *** compilation phase failed
make: *** [makefile:48: lib/libadasdl.a] Error 4

@xyproto
Copy link

xyproto commented Aug 13, 2021

The patch proposed above does not work here. After applying the changes, I still get:

sdl-video-palettes.adb:146:31: expected type "Palette_Constant_Access" defined at sdl-video-palettes.ads:124
sdl-video-palettes.adb:146:31: found type access to "Palette'CLASS" defined at line 69
sdl-video-palettes.adb:164:41: expected type "Palette_Constant_Access" defined at sdl-video-palettes.ads:124
sdl-video-palettes.adb:164:41: found type access to "Palette'CLASS" defined at line 69

(My goal is to get the Ada example in sdl2-examples to work again).

@Lucretia
Copy link
Collaborator

This is the same as #62

@anisimkov
Copy link
Contributor

I get the same error.

gcc (GCC) 11.1.0 on Arch Linux on 64-bit x86, using latest master (997d2ae).

The patch #62 is working (and the same #75), I tried it on GNAT Community 2021.

@simonjwright
Copy link
Contributor

Using 997d2ae, the sdl2-examples demo works on macOS Big Sur with FSF GCC 11.1.0 and GNAT CE 2021 (out-of-the-box, bar macOS framework linking stuff as in the example)

@l4e21
Copy link

l4e21 commented Dec 30, 2021

I am also having this issue (gcc (GCC) 11.1.0, Manjaro)
Have attempted #62 and receive sdl-video-pixel_formats.ads:642:04: representation item must appear after type is fully defined
No dice with that one.

However #75 worked just fine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants