• Problem with gpr file after updating GNAT

    From Jerry@21:1/5 to All on Mon Dec 5 00:47:43 2022
    I recently upgraded my macOS GNAT from 2015 to Simon's latest offering ("if it ain't broke...") on new Apple hardware. At the same time I used Apple's Migration Assistant to transfer files. From Visual Studio Code, I use a short shell script to run
    gprbuild. This has worked flawlessly for quite a while. Now things are broken and I can't figure out what is wrong even after reviewing the gprbuild docs.

    GPRBUILD 23.0.0 (20221109) (aarch64-apple-darwin21)

    Here is the shell line invoking gprbuild
    gprbuild -p /Users/me/Documents/Programs/Ada/Code/My_Projects/TextMate_Sampling/build.gpr

    Here is the gpr file named build.gpr after deleting a bunch of comments (sorry for the length);
    with "MPFR_Library"; -- Multiple precision floating point ops and functions with "GMP_Library"; -- Multiple precision integer ops and functions
    with "Octave_Library"; -- Octave built-in functions (not the loadable functions from Octave)
    with "GSL_Library"; -- GNU Scientific Library, installed as part of Mac Ports.

    project Build is
    for Source_Dirs use
    ("/Users/me/Documents/Programs/Ada/Code/My_Projects/TextMate_Sampling/source/",
    "/Users/me/Documents/Programs/Ada/Code/",
    "/Users/me/Documents/Programs/Ada/Code/My_Projects/TextMate_Sampling/source/Tests",
    "/Users/me/Documents/Programs/Ada/Code/My_Projects/TextMate_Sampling/source/Other_Code",
    "/Users/me/Documents/Programs/Ada/Code/My_Code/Specialized/Sampling",
    "/Users/me/Documents/Programs/Ada/Code/My_Code/Specialized/Radar",
    "/Users/me/Documents/Programs/Ada/Code/My_Code/Specialized/Sampling/Post-processing",
    "/Users/me/Documents/Programs/Ada/Code/My_Code/My_Tools",
    "/Users/me/Documents/Programs/Ada/Code/My_Code/One-Offs",
    "/Users/me/Documents/Programs/Ada/Code/My_Code/Examples_and_Snippets_and_Notes",
    "/Users/me/Documents/Programs/Ada/Code/Bindings/PLplot/plplot_git/plplot/bindings/ada",
    "/Users/me/Documents/Programs/Ada/Code/Bindings/PLplot/plplot_git/plplot/examples/ada",
    "/Users/me/Documents/Programs/Ada/Code/Bindings/PLplot/PLplot_testing/",
    "/Users/me/Documents/Programs/Ada/Code/Bindings/GMP_and_MPFR/SVN/adabindinggmpmpfr-read-only",
    "/Users/me/Documents/Programs/Ada/Code/Bindings/Octave/",
    "/Users/me/Documents/Programs/Ada/Code/Bindings/GSL/");

    for Object_Dir use "build-normal";
    for Exec_Dir use "product-normal";
    for Main use ("Uniform_Aperture_Sum.adb"); -- <<< SET MAIN HERE

    package Builder is
    for Default_Switches ("Ada") use ("-O0", "-gnat12", "-g", "-gnatE", "-gnateE");
    for Executable ("Uniform_Aperture_Sum.adb") use "run"; -- <<< AND HERE
    end Builder;

    package Compiler is
    end Compiler;

    package Binder is
    for Default_Switches ("Ada") use ("-E");
    end Binder;

    package Linker is
    for Default_Switches ("Ada") use ("-Wl,-no_pie");
    end Linker;

    package Pretty_Printer is
    for Default_Switches ("ada") use ("--max-line-length=100", "--indentation=4",
    "--indent-continuation=2", "--decimal-grouping=3", "--based-grouping=4", "--alignment",
    "--RM-style-spacing", "--preserve-blank-lines", "--comments-fill", "--comments-special",
    "--no-separate-return", "--split-line-before-op");
    end Pretty_Printer;

    end Build;


    Here is the path to the main program. The path is in the sources list in build.gpr.
    /Users/me/Documents/Programs/Ada/Code/My_Code/Specialized/Radar/Uniform_Aperture_Sum.adb

    And here is the complaint from GNAT when I try to build:
    build.gpr:61:19: "Uniform_Aperture_Sum.adb" is not a source of project "build" gprbuild: problems with main sources

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Egil H H@21:1/5 to Jerry on Mon Dec 5 04:30:06 2022
    On Monday, December 5, 2022 at 9:47:44 AM UTC+1, Jerry wrote:
    I recently upgraded my macOS GNAT from 2015 to Simon's latest offering ("if it ain't broke...") on new Apple hardware. At the same time I used Apple's Migration Assistant to transfer files. From Visual Studio Code, I use a short shell script to run
    gprbuild. This has worked flawlessly for quite a while. Now things are broken and I can't figure out what is wrong even after reviewing the gprbuild docs.

    <snip>

    for Object_Dir use "build-normal";
    for Exec_Dir use "product-normal";
    for Main use ("Uniform_Aperture_Sum.adb"); -- <<< SET MAIN HERE

    I don't know much about macOS, so I don't know for sure, but maybe you need a

    package Naming is
    for Casing use "MixedCase";
    end Naming;

    --
    ~egilhh

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Wright@21:1/5 to Jerry on Mon Dec 5 17:16:10 2022
    Jerry <list_email@icloud.com> writes:

    And here is the complaint from GNAT when I try to build:
    build.gpr:61:19: "Uniform_Aperture_Sum.adb" is not a source of project "build"
    gprbuild: problems with main sources

    I didn't get that, but I did get it if the two filenames were cased
    differently (and Egil's 'package Naming' suggestion didn't fix
    it). Different casing doesn't cause problems with an x86_64 gprbuild.

    The reason is very probably to be found here in the GCC sources: https://github.com/gcc-mirror/gcc/blob/master/gcc/ada/adaint.c#L599

    __gnat_get_file_names_case_sensitive (void)
    {
    if (file_names_case_sensitive_cache == -1)
    {
    const char *sensitive = getenv ("GNAT_FILE_NAME_CASE_SENSITIVE");

    if (sensitive != NULL
    && (sensitive[0] == '0' || sensitive[0] == '1')
    && sensitive[1] == '\0')
    file_names_case_sensitive_cache = sensitive[0] - '0';
    else
    {
    /* By default, we suppose filesystems aren't case sensitive on
    Windows and Darwin (but they are on arm-darwin). */
    #if defined (WINNT) || defined (__DJGPP__) \
    || (defined (__APPLE__) && !(defined (__arm__) || defined (__arm64__)))
    file_names_case_sensitive_cache = 0;
    #else
    file_names_case_sensitive_cache = 1;
    #endif
    }
    }
    return file_names_case_sensitive_cache;
    }

    which is Wrong; file names are case-insensitive on Darwin, x86_64 or
    aarch64 (aka arm64).

    On the other hand, it's gprbuild that's complaining.

    Anyway, try "export GNAT_FILE_NAME_CASE_SENSITIVE=0".

    Or, of course, you could use lower-case filenames for all Ada source.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jerry@21:1/5 to All on Tue Dec 6 02:56:06 2022
    Both Simon's suggestion
    export GNAT_FILE_NAME_CASE_SENSITIVE=0

    and Egil's suggestion
    package Naming is
    for Casing use "MixedCase";
    end Naming;

    solve the problem.

    Thanks. Not sure what the underlying problems are.

    Jerry

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)