Recent

Author Topic: [SOLVED] "Fatal: Can't find unit used by Program" ERROR - FPC Bug  (Read 1331 times)

Key-Real

  • Sr. Member
  • ****
  • Posts: 343
As I updated to the new gitlab version today,
I have the
Code: Pascal  [Select][+][-]
  1. Free Pascal Compiler version 3.3.1 [2024/07/09] for mipsel
  2. Copyright (c) 1993-2024 by Florian Klaempfl and others
  3. Target OS: PlayStation 1 for MIPSEL
  4. Compiling test.pas
  5. test.pas(1,6) Note: tgobj: (SetFirstTempGen) set to 104
  6. test.pas(5,1) Note: tgobj: (ResetTempGen) all temps freed
  7. Fatal: Can't find unit  used by Program
  8. Fatal: Compilation aborted
  9.  

error if I wanna compile this program:
Code: Pascal  [Select][+][-]
  1. begin
  2.         asm
  3.                 move $a1, $11111111
  4.         end;
  5. end.

all this compiles whitout any issues:

Code: Pascal  [Select][+][-]
  1. /compiler/ppcrossmipsel ./rtl/ps1/system.pp -Tps1 -Fi./rtl/mipsel -Fi./rtl/inc -Fi./rtl/ps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -Cfnone
  2. ./compiler/ppcrossmipsel ./rtl/inc/fpintres.pp -Tps1 -Fu./rtl/ps1 -Fi./rtl/mipsel -Fi./rtl/inc -Fi./rtl/ps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -Cfnone
  3. ./compiler/ppcrossmipsel ./rtl/ps1/si_prc.pp -Tps1 -Fu./rtl/ps1 -Fi./rtl/mipsel -Fi./rtl/inc -Fi./rtl/ps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -Cfnone
  4. ./compiler/ppcrossmipsel ./rtl/ps1/objpas.pp -Tps1 -Fu./rtl/ps1 -Fi./rtl/mipsel -Fi./rtl/inc -Fi./rtl/ps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -Cfnone
  5.  

whats this????
« Last Edit: July 11, 2024, 03:29:25 pm by Key-Real »

Key-Real

  • Sr. Member
  • ****
  • Posts: 343
Re: "Fatal: Can't find unit used by Program" ERROR
« Reply #1 on: July 09, 2024, 10:35:38 pm »
here the repo to play with:

https://gitlab.com/Key-Real/source

build with:
Code: Pascal  [Select][+][-]
  1. make compiler_cycle CPU_TARGET=mipsel OS_TARGET=ps1 OPT="-O- -CR -glv" CROSSOPT="-O- -g-" ALLOW_WARNINGS=1

compile with
Code: Pascal  [Select][+][-]
  1. ./compiler/ppcrossmipsel test.pas -Fu./rtl/ps1 -Fu./rtl/inc -Fu./rtl/objpas -Tps1 -Cfnone -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf-

don't forget to build the RTL:
Code: Pascal  [Select][+][-]
  1.     ./compiler/ppcrossmipsel ./rtl/ps1/system.pp -Tps1 -Fi./rtl/mipsel -Fi./rtl/inc -Fi./rtl/ps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -Cfnone
  2.     ./compiler/ppcrossmipsel ./rtl/inc/fpintres.pp -Tps1 -Fu./rtl/ps1 -Fi./rtl/mipsel -Fi./rtl/inc -Fi./rtl/ps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -Cfnone
  3.     ./compiler/ppcrossmipsel ./rtl/ps1/si_prc.pp -Tps1 -Fu./rtl/ps1 -Fi./rtl/mipsel -Fi./rtl/inc -Fi./rtl/ps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -Cfnone
  4.     ./compiler/ppcrossmipsel ./rtl/ps1/objpas.pp -Tps1 -Fu./rtl/ps1 -Fi./rtl/mipsel -Fi./rtl/inc -Fi./rtl/ps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -Cfnone
  5.      
« Last Edit: July 09, 2024, 10:57:08 pm by Key-Real »

Key-Real

  • Sr. Member
  • ****
  • Posts: 343
Re: "Fatal: Can't find unit used by Program" ERROR
« Reply #2 on: July 10, 2024, 08:23:23 am »
I toke today, the whole day, free from work to continue on the port. Can't proceed :( so please give me ideas about this bug, unimportant how strange they are

Thaddy

  • Hero Member
  • *****
  • Posts: 15220
  • Censorship about opinions does not belong here.
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #3 on: July 10, 2024, 09:02:57 am »
A BASM configuration bug?
My great hero has found the key to the highway. Rest in peace John Mayall.
Playing: "Broken Wings" in your honour. As well as taking out some mouth organs.

Key-Real

  • Sr. Member
  • ****
  • Posts: 343
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #4 on: July 10, 2024, 09:07:41 am »
whats BASM?

Thaddy

  • Hero Member
  • *****
  • Posts: 15220
  • Censorship about opinions does not belong here.
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #5 on: July 10, 2024, 11:11:53 am »
The internal assembler syntax files. It seems you did not do that part correctly for mipsel.
You have to explicitly implement that part of the compiler. It is actually a compiler on its own, but the compiler sources are such that basm, also known as internal assembler, is not that difficult to implement.
that is: for the people that want to write their own compilers...
« Last Edit: July 10, 2024, 11:16:45 am by Thaddy »
My great hero has found the key to the highway. Rest in peace John Mayall.
Playing: "Broken Wings" in your honour. As well as taking out some mouth organs.

Key-Real

  • Sr. Member
  • ****
  • Posts: 343
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #6 on: July 10, 2024, 11:22:02 am »
I done no changes in
./compiler/mips
at this stage

Thaddy

  • Hero Member
  • *****
  • Posts: 15220
  • Censorship about opinions does not belong here.
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #7 on: July 10, 2024, 03:59:50 pm »
But follow that lead: it must be somewhere there.
My great hero has found the key to the highway. Rest in peace John Mayall.
Playing: "Broken Wings" in your honour. As well as taking out some mouth organs.

ccrause

  • Hero Member
  • *****
  • Posts: 921
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #8 on: July 10, 2024, 04:03:26 pm »
The internal assembler syntax files. It seems you did not do that part correctly for mipsel.
You have to explicitly implement that part of the compiler. It is actually a compiler on its own, but the compiler sources are such that basm, also known as internal assembler, is not that difficult to implement.
that is: for the people that want to write their own compilers...

There is an internal assembler parser for mips, so unlikely to be the cause of the error.

@Key-Real: Does the test program compile successfully if you delete the asm block, or have an empty asm block?

Key-Real

  • Sr. Member
  • ****
  • Posts: 343
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #9 on: July 10, 2024, 05:30:27 pm »
I can do whatever (delete the block, have ann empty block, put more code...) I wanna, still the same result.

Unfortunly something was changed in the mips code since I forked last time(about two months ago). :(

 I could compile and run on real hardware and had everything working.

Well the bug came only on programs not at units

Key-Real

  • Sr. Member
  • ****
  • Posts: 343
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #10 on: July 10, 2024, 06:33:38 pm »
I copyied the racpugas.pas from the old fork to the new one,
the behavier is still the same

Key-Real

  • Sr. Member
  • ****
  • Posts: 343
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #11 on: July 10, 2024, 06:38:58 pm »
I complitley replaced the whole ./compiler/mips folder with the old (working) folder.
The bug is still there

ccrause

  • Hero Member
  • *****
  • Posts: 921
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #12 on: July 10, 2024, 09:16:11 pm »
So the compiler error then has nothing to do with the inline assembler.

Looking at the original error, it seems to be the regular error message, just without a unit name.  Just taking a wild guess, a unit dependency is added on the compiler side, but no name is assigned? Or maybe starts with a null character?

The error is triggered either in pmodules.pas or fppu.pas.  My suggestion is to debug the compiler, set  breakpoints on the lines linked to earlier, then look at the stack trace to figure out why an empty unit name crops up.

Alternatively, add -va when compiling your test program, this will show a lot more information. There is a small possibility that someone can figure out what leads to your error.

Key-Real

  • Sr. Member
  • ****
  • Posts: 343
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #13 on: July 11, 2024, 01:21:50 pm »
I can compile MIPSEL for LINUX and it works, except the linking, but he passes the stage with my Issue.

Can this info help?

Key-Real

  • Sr. Member
  • ****
  • Posts: 343
Re: "Fatal: Can't find unit used by Program" ERROR - FPC Bug
« Reply #14 on: July 11, 2024, 01:54:58 pm »
AHA!

in ./compiler/systems.pas
in systems_internal_sysinit I removed system_mipsel_ps1
now it compiles but ofcourse doesn't link

Does this info helps?

 

TinyPortal © 2005-2018