❌ About FreshRSS

Reading view

There are new articles available, click to refresh the page.

Record size from a lib differs from one executable to another


I'm facing a problem that leaves me extremely perplexed (I can hardly believe what I'm seeing). I have a library that defines a record. This record will be used to instantiate a shared memory between different executables.

The first executable calls a function in this library which will create the shared memory. The other executables will communicate through it. Except that it doesn't work. After hours of debugging, I noticed that the size of my structure (aspect 'Size) is different between the first executable and the others: it's 4 times smaller!

Everything was recompiled and tested multiple times to make sure this was the case. In every executables, 'Size and 'Object_Size are the same. Printing the size of the record in the package initialization returns the correct value, the one used by every executables except the first one.

I think this will leave you really perplex too. Have you ever encounter a similar issue?

I believe there is a way to ask the gnat compiler (or gprbuild) for a file that gives the size given for each types, right? Which flag is it?

Thanks for your help.

submitted by /u/louis_etn
[link] [comments]

Gprbuild can’t find tool chain for Ada

Hi, On my Fedora 37 64-bit (Linux 6.3.8-100.fc3) I have two gnat installed, one for the host in /usr/bin and one for ARM targets in /opt/gnat/arm-elf/bin.

I removed /opt/gnat/bin from my PATH to avoid any complication. So now I have /usr/bon in my path, when I run which gnat, it does point to /usr/bin/gnat.

gnat -v gives me: GNAT 12.3.1 20230508 (Red Hat 12.3.1-1)

When I run gprbuild on my project (either with the terminal or through Gnat studio) I get: gprconfig: Can’t find a native tool chain for language ‘ada’ No compiler for language Ada

So I try to run gprconfig: gprconfig has found the following compilers on your PATH. Only those matching the target and the selected compilers are displayed. 1. GCC-ASM for Asm in /usr/bin version 12.3.1 2. GCC-ASM for Asm2 in /usr/bin version 12.3.1 3. GCC-ASM for Asm_Cpp in /usr/bin version 12.3.1 4. LD for Bin_Img in /usr/bin version 2.38-27.fc37 5. GCC for C un /usr/bin version 12.3.1

alr toolchain gives me: gprbuild 22.0.0 Available Detected at /usr/local/bin/gprbuild gnat_external 12.3.1 Available Detected at /usr/bin

Although Alire detects it (so it would probably work with it), I don’t want to use it, I don’t like it.

How can gprbuild see my gnat?

Thanks for your help!

submitted by /u/louis_etn
[link] [comments]

Custom widget

Hi, I’m trying to create a simple custom widget with Gtkada: a double slider range widget (one cursor for the lower bound and one for the upper bound).

I found some references online, but it’s sparse and confusing, either they use some deprecated base widget or they all implement a custom widget in a different way.

Is there somewhere a simple and up to date exemple of a custom widget written from scratch?


submitted by /u/louis_etn
[link] [comments]

Return constant access to a indefinite vector


I have an indefinite vector (Ada.Containers.Indefinite_Vector) with a 'Class as element. I have a tagged record that holds an instance of this vector which can hold a lot of elements.

I would like to avoid a copy of this vector at any cost, so I'm trying to create a getter to this instance (a function returning a vector makes a copy of it... right?) Ideally, I would like it to be a not null access constant type.

This is the simplest example I could make:

with Ada.Containers.Indefinite_Vectors; procedure Hello is type Foo_Type is tagged null record; package Foo_Vectors is new Ada.Containers.Indefinite_Vectors (Natural, Foo_Type'Class, "="); type Foo_Vector_Access_Type is access all Foo_Vectors.Vector; type Bar_Type is tagged record Foos : aliased Foo_Vectors.Vector; end record; function Get_Foos (Bar : Bar_Type) return Foo_Vector_Access_Type is begin return Bar.Foos'Access; end Get_Foos; begin null; end Hello; 

I get "access-to-variable designates constant". I have no ideas what it means...

How can I achieve what I need?

Thanks for your answers.

submitted by /u/louis_etn
[link] [comments]

How to get the ARM toolchain up and running?

I'm trying to compile any example from the project Ada_Drivers_Library, but it seems that I can't get the toolchain correctly installed:

Ada_Drivers_Library/examples/STM32F429_Discovery $ gprbuild -P blinky_f429disco.gpr gprconfig: can't find a toolchain for the following configuration: gprconfig: language 'ada', target 'arm-eabi', runtime 'embedded-stm32f429disco' stm32f429_discovery_full.gpr:61:25: warning: libraries are not supported on this platform common.gpr:1:09: no compiler for language "Ada", cannot compile "last_chance_handler.adb" gprbuild: *** compilation phase failed 

I downloaded the gnat-arm, as required by the README:

$ arm-eabi-gnat --version GNAT 12.2.0 Copyright (C) 1996-2022, Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

What did I missed? I have the same error in gnatstudio.

Thanks for your help.

submitted by /u/louis_etn
[link] [comments]