โŒ About FreshRSS

Normal view

There are new articles available, click to refresh the page.
Before yesterdayNewest questions tagged ada - Stack Overflow

gdb on MacOS Ventura fails with python library not loaded

I have a build of gdb for an Ada toolchain, and it appears there is a reference to a Python dynamic library that does not exist on my system (Intel Mac, Ventura 13.4.1 (c)).

$ which gdb
/opt/gcc-13.1.0/bin/gdb

$ gdb
dyld[19305]: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.9/Python
  Referenced from: <3FCB836C-8BBC-39C7-894C-6F9582FEAE7F> /opt/gcc-13.1.0/bin/gdb
  Reason: tried: '/Library/Frameworks/Python.framework/Versions/3.9/Python' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.9/Python' (no such file), '/Library/Frameworks/Python.framework/Versions/3.9/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/3.9/Python' (no such file, not in dyld cache)
Abort trap: 6

$ dyld_info /opt/gcc-13.1.0/bin/gdb
/opt/gcc-13.1.0/bin/gdb [x86_64]:
    -platform:
        platform     minOS      sdk
           macOS     12.0      10.17  
    -segments:
        load-offset   segment section        sect-size  seg-size perm
        0x00000000    __TEXT                              7728KB r.x
        0x00001090             __text           5025114
        0x004CBDF0             __text_startup    23672
        0x004D1A68             __text_cold      125143
        0x004F0340             __stubs            9060
        0x004F26A4             __stub_helper      6276
        0x004F3F28             __cstring        899918
        0x005CFA80             __const          155833
        0x005F5B40             __info_plist        466
        0x005F5D18             __eh_frame       1663704
        0x0078C000    __DATA_CONST                        1088KB rw.
        0x0078C000             __got              5824
        0x0078D6C0             __mod_init_func     800
        0x0078D9E0             __const          1099176
        0x0089C000    __DATA                               304KB rw.
        0x0089C000             __la_symbol_ptr   12080
        0x0089EF30             __gcc_except_tab 118952
        0x008BBFE0             __data            76000
        0x008CE8C0             __bss             91000
        0x008E4C40             __common           9104
    -dependents:
        attributes     load path
                       /usr/lib/libiconv.2.dylib
                       /usr/lib/libncurses.5.4.dylib
                       /Library/Frameworks/Python.framework/Versions/3.9/Python
                       /usr/lib/libexpat.1.dylib
                       /opt/gcc-13.1.0/lib/libmpfr.6.dylib
                       /opt/gcc-13.1.0/lib/libgmp.10.dylib
                       /opt/gcc-13.1.0/lib/libstdc++.6.dylib
                       /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
                       /usr/lib/libSystem.B.dylib

$ ls /Library/Frameworks/Python.framework
ls: /Library/Frameworks/Python.framework: No such file or directory

$ which python3
/usr/bin/python3

$ which python3.9
/usr/local/bin/python3.9

I have installed Python via brew. Where should I look for the required library (so I can set DYLD_LIBRARY_PATH), or how can I install the proper one?

A cell phone company is continually building and leasing communication towers. Each tower has one-way, direct communcation links to other tower [closed]

A cell phone company is continually building and leasing communication towers. Each tower has one-way, direct communcation links to other towers. The task is find if there is a communication link from one tower to another, possibly through other towers.

The input to the program is essentially a list of pairs of tower names. Each pair will appear on a single line and will contain distinct names. Some pairs represent one-way communcation links between towers, and other pairs represent queries. Links and queries may be interspersed.

All the communication links of the system are added one link at a time and no links are removed. Here is an example of a link:

Tower_A Tower_B. A link is terminated by a period.

A query asks if a communcation link is possible from one tower to another by any combination of one-way links. If another link is added to the system later in the input, then the answer to the same query may be different. In the output, a plus sign (+) represents an affirmative answer; a minus sign (-) says there is no such link.

Links are distinguished from queries by ending in a question mark and not a period.

Tower_A Tower_B? The program should read from the standard input and and write to the standard output. For each query in the input there should be exactly one line of output. If the query is true (there is a communication channel through the network), the output line should begin with a plus sign (+); otherwise with a minus sign (-). The rest of the output line repeats the towers in the query.

For the following input:

Tower_A Tower_B. Tower_B Tower_C . Tower_A Tower_C? # A query Tower_B Tower_D. Tower_A Tower_D ? # Another query Tower_F Tower_E. Tower_D Tower_B ? # A third query xxxx yyyy? # Unknown tower names Tower_D Tower_B . Tower_D Tower_B ? # Now there is a link the output should be

  • Tower_A -> Tower_C
  • Tower_A -> Tower_D
  • Tower_D -> Tower_B
  • xxxx -> yyyy
  • Tower_D -> Tower_B The names of the towers will contain only the characters [a-zA-Z_0-9], in particular they will have no spaces in them. Names will have at least 1 character and no more than 50 characters. Furthermore the capitialization of the names is significant. That is, WestMelbourneTower is not to be considered the same tower as wESTMeLbOuRnEtOwEr. Characters, if any, after the period (.) or question mark (?) on a line are to be ignored. No line will will contain more than 150 characters.

Please carefully observe spacing. There may, or may not, be a space before the period, the question mark, and the comment in the input. There will be one or more spaces between the tower names in the input. There must be a space after the plus and minus sign in the output. There must be a space before and after the arrow (->) in the output.

You are required to create your own graph package graph.ads graph.adb and name it Graph. The package can be generic or non-generic. The graph is to be a list of adajency lists. You are required to use the generic, doubly-linked list package from the standard library. These requirements are generally reasonable ones for the task anyway. There are more sophisticated approaches and less sophisticated approaches, but these requirements ensure the educational objectives of the assignment are met.

Does GNAT Studio offer a "mode" to act as a fully self-sufficient IDE for Python development?

When I look at wikipedia, it says about GNAT Studio:

GPS supports a variety of programming languages other than Ada, including C, JavaScript, Pascal and Python.

But when I look at the AdaCore site, I can't seem to find the necessary guidance to adapt GNAT Studio into a development environment.

To answer the question, yes I am aware of IDLE and have used it. I have no further comment to say about that.

gnatcoll-db includes dborm.py, need to understand routines in python

I was using gnatcoll-db, but the limitations made me to rewrite dborm.py in Ada. There are two routines in dborm.py (in python) that I don't understand, specifically compute_table_aliases and fields_count_array.

Any help will be welcome. Of course, the modifications can be shared between all of us.

Edited to complete information:

My project fork is here. I don't want to copy here the complete routines from dborm.py as I don't know exactly the license terms of ACS. dborm.py can be downloaded from https://github.com/AdaCore/gnatcoll-db/tree/master/gnatcoll_db2ada.

The routines that I want to translate to Ada are:

  • compute_table_aliases, lines 2407 to 2448. Really I don't understand the algorithm.
  • fields_count_array and fields_count, lines 2372 to 2397. For these routines I have a translation to Ada but when testing, the result is OK except in a few cases.

Here is my translation to Ada:

Max_Depth : constant := 3; type Counts_Array is array (0 .. Max_Depth) of Integer;

  function Fields_Count_Array (T         : Table_Description;
                               Follow_LJ : Boolean;
                               DepthMax  : Integer;
                               FKStop    : Field := No_Field)
                            return Counts_Array is
     FK_Stop : Boolean; -- to be reset before each call to fields_count_
     Depth   : Integer := 0;
     Temp    : Counts_Array;

     function Fields_Count (T         : Table_Description;
                            Depth     : Integer;
                            Follow_LJ : Boolean;
                            FKStop    : Field := No_Field) return Integer;
     function Fields_Count (T         : Table_Description;
                            Depth     : Integer;
                            Follow_LJ : Boolean;
                            FKStop    : Field := No_Field)
                         return Integer is
        Result : Integer;
        procedure Process_FK (FK : in out Field);
        procedure Process_FK (FK : in out Field) is
        begin
           if FK = FKStop then
              FK_Stop := True;
              return;
           end if;
           if FK_Stop then
              return;
           end if;
           if Follow_LJ or (not FK.Can_Be_Null) then
              Result := Result +
                Fields_Count (Pointed_Table (FK), Depth - 1, Follow_LJ);
           end if;
        end Process_FK;
     begin
        Result := Num_Fields (T);
        if Depth > 0 then
           For_Each_FK (T, Process_FK'Access);
        end if;
        return Result;
     end Fields_Count;

  begin
     while Depth <= DepthMax loop
        FK_Stop := False;
        Temp (Depth) := Fields_Count (T, Depth, Follow_LJ, FKStop);
        Depth := Depth + 1;
     end loop;
     return Temp;
  end Fields_Count_Array;

Note that all type definitions come from gnatcoll-sql.

I understand that this is difficult to follow, perphaps may be better if I send a report on the modifications and the complete new Ada package replacing dborm.py. How?

โŒ
โŒ