Relative Search Path

General discussions about working with the Astrobe IDE and programming the Raspberry Pi RP2040 and the Pi Pico board.
Post Reply
gray
Posts: 163
Joined: Tue Feb 12, 2019 2:59 am
Location: Mauritius

Relative Search Path

Post by gray » Fri May 23, 2025 1:08 am

With v10 we can use relative search path baness:
Relative path names ( ..\..\Lib\General for example) can be used in the search paths. The paths are evaluated before compilation / linking starts and are relative to the folder which contains the initial source file.
Test set-up:

Code: Select all

C:\Astrobe\Test3
  + P1.mod
  + lib0
    + Main.mod
    + M0.mod
  + lib1
    + M1.mod

Code: Select all

MODULE P1;
  IMPORT M0, M1;
END P1.

MODULE Main;
END Main.

MODULE M0;
  IMPORT M1;
END M0.

MODULE M1;
END M1.
Search path:

Code: Select all

lib0
lib1
Building P.mod:

Code: Select all

Astrobe for RP2350 Builder v10.0.1
Builder Phase 1: Checking P.mod and imported modules...

Checking Module Main
  Imports:
  Folder: C:\Astrobe\Test3\lib0
  Status: Missing Main.arm file
Checking Module M1
  Imports:
  Folder: C:\Astrobe\Test3\lib1
  Status: Missing M1.arm file
Checking Module M0
  Imports:
    M1
  Folder: C:\Astrobe\Test3\lib0
  Status: Missing M0.arm file
Checking Module P
  Imports:
    Main
    M0
    M1
  Folder: C:\Astrobe\Test3
  Status: Missing P.arm file
------------------

Builder Phase 2: Compiling missing / outdated modules...

  compiling Main
new symbol file;  code generated = 8 bytes, data = 0 bytes, entries = 0, lines = 2, msecs = 2
------------------
  compiling M1
new symbol file;  code generated = 8 bytes, data = 0 bytes, entries = 0, lines = 5, msecs = 2
------------------
  compiling M0

  Line  Col
     2   13 Error: import not available
The output of Phase 1 shows that the all modules are found, ie. that the relative directory names are resolved correctly into absolute paths, relative to P1.mod. M1.mod gets compiled, but is not found for M0.mod.

With

Code: Select all

lib0
lib1
../lib1
the build works, but that should not be necessary, since we have absolute path names during compilation and linking.

However, if I build with the above search path to get a successful compilation, then delete '../lib1', the linker works successfully, ie. finds all compiled modules with the original search path. It's only part of the compilation that fails.

I have also tried

Code: Select all

./lib0
./lib1
to no avail.

Some more contorted "explorative" definitions:

Does not work:

Code: Select all

lib0
lib1
../Test3/lib1
This works:

Code: Select all

lib0
lib1
../../Test3/lib1
What do I miss? Thanks.

cfbsoftware
Site Admin
Posts: 541
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Relative Search Path

Post by cfbsoftware » Fri May 23, 2025 4:57 am

A build results in zero or more separate compilations, each with their own, possibly different, set of relative search paths. If all of the compilations succeed, it is followed followed by a link with its own set of relative search paths.

During the compilation phase, relative paths are relative to the folder which contains the module being compiled.

During the linking phase, relative paths are relative to the folder which contains the module (which imports Main) being linked.

Post Reply