pcawte / AgDev

Port to Agon Light of TI-84-CE C/C++ Toolchain which uses LLVM and generates eZ80 ADL code
GNU Lesser General Public License v3.0
52 stars 12 forks source link

Definition of ':globals._printf' in conflict with already defined symbol #6

Open Chandler-Kluser opened 9 months ago

Chandler-Kluser commented 9 months ago

Issue

AgDev examples don't build due to _printf symbol confilct, other symbols are missing or duplicated.

Output

  1. Testing the tests/args example:
/home/chandler/Documentos/agon-ce-c-toolchain/tests/args $ make V=1
mkdir -p 'bin'
echo [linking] bin/args.bin
[linking] bin/args.bin
/home/chandler/CEDev/bin/fasmg -v1 '/home/chandler/CEDev/meta/ld.alm' -i 'DEBUG := 0' -i 'HAS_PRINTF := 1' -i 'HAS_LIBC := 1' -i 'HAS_LIBCXX := 1' -i 'PREFER_OS_CRT := 0' -i 'PREFER_OS_LIBC := 1' -i 'ALLOCATOR_STANDARD := 1' -i 'include "/home/chandler/CEDev/meta/linker_script"' -i 'range .bss $D052C6 : $D13FD8' -i 'provide __stack = $D1A87E' -i 'locate .header at $D1A87F' -i map -i 'source "obj/icon.src", "/home/chandler/CEDev/lib/crt/crt0.src", "obj/lto.src"' -i 'library "/home/chandler/CEDev/lib/libload/fatdrvce.lib", "/home/chandler/CEDev/lib/libload/fileioc.lib", "/home/chandler/CEDev/lib/libload/fontlibc.lib", "/home/chandler/CEDev/lib/libload/graphx.lib", "/home/chandler/CEDev/lib/libload/keypadc.lib", "/home/chandler/CEDev/lib/libload/msddrvce.lib", "/home/chandler/CEDev/lib/libload/srldrvce.lib", "/home/chandler/CEDev/lib/libload/usbdrvce.lib"'  bin/args.bin
flat assembler  version g.kaqg
/home/chandler/CEDev/meta/ld.alm [1568]:

macro ? [1295]:
    read source
:read? [14] (CALM)
assemble :temp [1]:
    include?! '../lib/libc/printf.src'
/home/chandler/CEDev/meta/../lib/libc/printf.src [8]:
    public _printf
public? [26] (CALM)
Error: definition of ':globals._printf' in conflict with already defined symbol.
make: *** [/home/chandler/CEDev/meta/makefile.mk:293: bin/args.bin] Error 2
  1. Testing the tests/vdu example:
/home/chandler/Documentos/agon-ce-c-toolchain/tests/vdu $ make V=1
mkdir -p 'obj/src'
echo [compiling] src/vdp_vdu.c
[compiling] src/vdp_vdu.c
/home/chandler/CEDev/bin/ez80-clang -MD -c -emit-llvm -nostdinc -isystem /home/chandler/CEDev/include -Isrc -fno-threadsafe-statics -Xclang -fforce-mangle-main-argc-argv -mllvm -profile-guided-section-prefix=false -DNDEBUG  -g0 -Wall -Wextra -Oz 'src/vdp_vdu.c' -o 'obj/src/vdp_vdu.c.bc'
mkdir -p 'obj/src'
echo [compiling] src/vdu.c
[compiling] src/vdu.c
/home/chandler/CEDev/bin/ez80-clang -MD -c -emit-llvm -nostdinc -isystem /home/chandler/CEDev/include -Isrc -fno-threadsafe-statics -Xclang -fforce-mangle-main-argc-argv -mllvm -profile-guided-section-prefix=false -DNDEBUG  -g0 -Wall -Wextra -Oz 'src/vdu.c' -o 'obj/src/vdu.c.bc'
echo [lto opt] obj/lto.bc
[lto opt] obj/lto.bc
/home/chandler/CEDev/bin/ez80-link '/home/chandler/Documentos/agon-ce-c-toolchain/tests/vdu/obj/src/vdp_vdu.c.bc' '/home/chandler/Documentos/agon-ce-c-toolchain/tests/vdu/obj/src/vdu.c.bc' -o '/home/chandler/Documentos/agon-ce-c-toolchain/tests/vdu/obj/lto.bc'
/home/chandler/CEDev/bin/ez80-clang -S -mllvm -profile-guided-section-prefix=false -Wall -Wextra -Oz '/home/chandler/Documentos/agon-ce-c-toolchain/tests/vdu/obj/lto.bc' -o '/home/chandler/Documentos/agon-ce-c-toolchain/tests/vdu/obj/lto.src'
mkdir -p 'obj'
echo [convimg] description
[convimg] description
/home/chandler/CEDev/bin/convimg --icon-output 'obj/icon.src' --icon-format asm --icon-description "Ag C Toolchain Demo"
mkdir -p 'bin'
echo [linking] bin/vdu.bin
[linking] bin/vdu.bin
/home/chandler/CEDev/bin/fasmg -v1 '/home/chandler/CEDev/meta/ld.alm' -i 'DEBUG := 0' -i 'HAS_PRINTF := 1' -i 'HAS_LIBC := 1' -i 'HAS_LIBCXX := 1' -i 'PREFER_OS_CRT := 0' -i 'PREFER_OS_LIBC := 1' -i 'ALLOCATOR_STANDARD := 1' -i 'include "/home/chandler/CEDev/meta/linker_script"' -i 'range .bss $060000 : $09FFFF' -i 'provide __stack = $D1A87E' -i 'locate .header at $D1A87F' -i map -i 'source "obj/icon.src", "/home/chandler/CEDev/lib/crt/crt0.src", "obj/lto.src"' -i 'library "/home/chandler/CEDev/lib/libload/fatdrvce.lib", "/home/chandler/CEDev/lib/libload/fileioc.lib", "/home/chandler/CEDev/lib/libload/fontlibc.lib", "/home/chandler/CEDev/lib/libload/graphx.lib", "/home/chandler/CEDev/lib/libload/keypadc.lib", "/home/chandler/CEDev/lib/libload/msddrvce.lib", "/home/chandler/CEDev/lib/libload/srldrvce.lib", "/home/chandler/CEDev/lib/libload/usbdrvce.lib"'  bin/vdu.bin
flat assembler  version g.kaqg
/home/chandler/CEDev/meta/ld.alm [1568]:

macro ? [1295]:
    read source
:read? [14] (CALM)
assemble :temp [1]:
    include?! '../lib/libc/fclose.c.src'
/home/chandler/CEDev/meta/../lib/libc/fclose.c.src [43]:
    extern _mos_fclose
extern? [12] (CALM)
Error: symbol ':globals._mos_fclose' is undefined or out of scope.
make: *** [/home/chandler/CEDev/meta/makefile.mk:293: bin/vdu.bin] Error 2
  1. Testing the tests/exit example:
/home/chandler/Documentos/agon-ce-c-toolchain/tests/exit $ make V=1
mkdir -p 'obj/src'
echo [compiling] src/exit.c
[compiling] src/exit.c
/home/chandler/CEDev/bin/ez80-clang -MD -c -emit-llvm -nostdinc -isystem /home/chandler/CEDev/include -Isrc -fno-threadsafe-statics -Xclang -fforce-mangle-main-argc-argv -mllvm -profile-guided-section-prefix=false -DNDEBUG  -g0 -Wall -Wextra -Oz 'src/exit.c' -o 'obj/src/exit.c.bc'
src/exit.c:21:8: error: use of undeclared identifier 'EXIT_ABORT'
        exit( EXIT_ABORT );
              ^
1 error generated.
make: *** [/home/chandler/CEDev/meta/makefile.mk:340: obj/src/exit.c.bc] Error 1

How to Reproduce

  1. Download, build and install ez80-clang, ez80-link and fasmg
  2. Make a Symbolic Link to /home/$USER/CEDev/bin folder
  3. Add the directory to $PATH environment variable
  4. Clone the CE C/C++ Toolchain
  5. Clone AgDev repository
  6. Copy the root folder contents from AgDev repository to the CE C/C++ Toolchain folder
  7. Build the CE C/C++ Toolchain
  8. Install to /home/$USER/CEDev folder
  9. Build any example from tests folder

System Specs

                   -`                    chandler@pc-quarto 
                  .o+`                   ------------------ 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: B450 I AORUS PRO WIFI 
               `+oooooo:                 Kernel: 6.7.1-arch1-1 
               -+oooooo+:                Uptime: 2 days, 3 hours, 22 mins 
             `/:-:++oooo+:               Packages: 1871 (pacman) 
            `/++++/+++++++:              Shell: zsh 5.9 
           `/++++++++++++++:             Resolution: 3840x2160 
          `/+++ooooooooooooo/`           DE: GNOME 45.3 
         ./ooosssso++osssssso+`          WM: Mutter 
        .oossssso-````/ossssss+`         WM Theme: Adwaita 
       -osssssso.      :ssssssso.        Theme: HighContrastInverse [GTK2/3] 
      :osssssss/        osssso+++.       Icons: Adwaita [GTK2/3] 
     /ossssssss/        +ssssooo/-       Terminal: kgx 
   `/ossssso+/:-        -:/+osssso+-     CPU: AMD Ryzen 7 3700X (16) @ 3.600GHz 
  `+sso+:-`                 `.-/+oso:    GPU: AMD ATI Radeon RX 6600/6600 XT/6600M 
 `++:.                           `-/+/   Memory: 5750MiB / 15912MiB 
 .`                                 `/
Chandler-Kluser commented 8 months ago

I would appreciate if someone could give better build instructions, because I am not able to compile the AgDev overlayed in TI84+ C/C++ Toolchain with this new release

Thanks in advance!! :smile:

astralaster commented 8 months ago

Yes, I'm working on that. My idea is to add a CI release pipeline which combines everything automatically as a ZIP file. This should massively reduce user errors.

astralaster commented 8 months ago

Now you can download and try the release zip: https://github.com/pcawte/AgDev/releases/tag/v1.1.1

Chandler-Kluser commented 8 months ago

Thanks, I will build it from source and check :smile:

Chandler-Kluser commented 8 months ago

built the toolchain at commit 20fd3c8f3e82be6e6226f51633aa7b578faca232 and I get the same issue

HeathenUK commented 8 months ago

Use the actual release.

On Sat, 10 Feb 2024, 12:09 Chandler Klüser, @.***> wrote:

built the toolchain at commit 20fd3c8 https://github.com/pcawte/AgDev/commit/20fd3c8f3e82be6e6226f51633aa7b578faca232 and I get the same issue

— Reply to this email directly, view it on GitHub https://github.com/pcawte/AgDev/issues/6#issuecomment-1936991287, or unsubscribe https://github.com/notifications/unsubscribe-auth/APTNFMG4F5XBYQOE4Y2ZCZLYS5PRPAVCNFSM6AAAAABCQNEROCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWHE4TCMRYG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Chandler-Kluser commented 8 months ago

I want to build it from source, there should be no difference between them

HeathenUK commented 8 months ago

Yes there should, the release workflow doesn't just contain the AgDev addons, it correctly integrates them into CeDev and therefore removes a common cause of user error.

On Sat, 10 Feb 2024, 12:13 Chandler Klüser, @.***> wrote:

I want to build it from source, there should be no difference between them

— Reply to this email directly, view it on GitHub https://github.com/pcawte/AgDev/issues/6#issuecomment-1936991980, or unsubscribe https://github.com/notifications/unsubscribe-auth/APTNFMAHD4LPLX7D3ZVA6ODYS5P43AVCNFSM6AAAAABCQNEROCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWHE4TCOJYGA . You are receiving this because you commented.Message ID: @.***>

Chandler-Kluser commented 8 months ago

Is there any possibility for me to reproduce these steps and update the documentation?

HeathenUK commented 8 months ago

Are the examples building now in the AgDev-enabled CeDev sandbox?

On Sat, 10 Feb 2024, 12:29 Chandler Klüser, @.***> wrote:

Is there any possibility for me to reproduce these steps and update the documentation?

— Reply to this email directly, view it on GitHub https://github.com/pcawte/AgDev/issues/6#issuecomment-1936995455, or unsubscribe https://github.com/notifications/unsubscribe-auth/APTNFMDLTJQQIT2LMOAMUYLYS5RZ7AVCNFSM6AAAAABCQNEROCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWHE4TKNBVGU . You are receiving this because you commented.Message ID: @.***>

Chandler-Kluser commented 8 months ago

Not at home, I will check and keep you up to date very soon

Chandler-Kluser commented 8 months ago

No.. :sweat_smile:

/home/chandler/CEDev/examples $ make
make -C hello_world/ 
make[1]: Entrando no diretório '/home/chandler/CEDev/examples/hello_world'

[compiling] src/main.c
[lto opt] obj/lto.bc
/home/chandler/CEDev/examples/hello_world/obj/lto.bc:1:2: error: expected top-level entity
        section .text,"ax",@progbits
        ^
1 error generated.
make[1]: *** [/home/chandler/CEDev/meta/makefile.mk:331: obj/lto.src] Error 1
make[1]: Saindo do diretório '/home/chandler/CEDev/examples/hello_world'

make: *** [makefile:10: hello_world/makefile] Error 2

I have already commented in this issue, but still getting the same problem.

Maybe I am doing something wrong, but as I far as I know I have done all the build instructions steps.

HeathenUK commented 8 months ago

Aren't AgDev examples in AgExamples?

On Sat, 10 Feb 2024, 14:22 Chandler Klüser, @.***> wrote:

No.. 😅

/home/chandler/CEDev/examples $ make make -C hello_world/ make[1]: Entrando no diretório '/home/chandler/CEDev/examples/hello_world'

[compiling] src/main.c [lto opt] obj/lto.bc /home/chandler/CEDev/examples/hello_world/obj/lto.bc:1:2: error: expected top-level entity section .@. ^ 1 error generated. make[1]: [/home/chandler/CEDev/meta/makefile.mk:331: obj/lto.src] Error 1 make[1]: Saindo do diretório '/home/chandler/CEDev/examples/hello_world'

make: *** [makefile:10: hello_world/makefile] Error 2

I have already commented in this issue https://github.com/CE-Programming/toolchain/issues/463#issuecomment-1933390165, but still getting the same problem.

Maybe I am doing something wrong, but as I far as I know I have done all the build instructions steps.

— Reply to this email directly, view it on GitHub https://github.com/pcawte/AgDev/issues/6#issuecomment-1937019181, or unsubscribe https://github.com/notifications/unsubscribe-auth/APTNFMAQEUMB2DXKYWRSRE3YS57DBAVCNFSM6AAAAABCQNEROCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXGAYTSMJYGE . You are receiving this because you commented.Message ID: @.***>

Chandler-Kluser commented 8 months ago

I have already tested them, with the same issue too.

I understood this time I had to compile the TI 84 C/C++ examples without any AgDev overlay

HeathenUK commented 8 months ago

I assume this is after you've run the CEDev sandbox?

On Sat, 10 Feb 2024, 14:28 Chandler Klüser, @.***> wrote:

I have already tested them, with the same issue too.

I understood this time I had to compile the TI 84 C/C++ examples without any AgDev overlay

— Reply to this email directly, view it on GitHub https://github.com/pcawte/AgDev/issues/6#issuecomment-1937020347, or unsubscribe https://github.com/notifications/unsubscribe-auth/APTNFMD3IWFA24PXGV3BAQDYS57XJAVCNFSM6AAAAABCQNEROCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXGAZDAMZUG4 . You are receiving this because you commented.Message ID: @.***>

Chandler-Kluser commented 8 months ago

CEDev sandbox

I have built the toolchain with ez80-clang, ez80-link and fmasg and added all of them into my $PATH environment variable, is there something else?

HeathenUK commented 8 months ago

What precisely are you adding to your path?

On Sat, 10 Feb 2024, 14:59 Chandler Klüser, @.***> wrote:

CEDev sandbox

I have built the toolchain with ez80-clang, ez80-link and fmasg and added all of them into my $PATH environment variable, is there something else?

— Reply to this email directly, view it on GitHub https://github.com/pcawte/AgDev/issues/6#issuecomment-1937026186, or unsubscribe https://github.com/notifications/unsubscribe-auth/APTNFMC3475N64PWIRR4KLLYS6DNNAVCNFSM6AAAAABCQNEROCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXGAZDMMJYGY . You are receiving this because you commented.Message ID: @.***>

Chandler-Kluser commented 8 months ago

image

HeathenUK commented 8 months ago

So you have CEDev/bin itself in PATH? Not just links to those binaries?

On Sat, 10 Feb 2024, 15:31 Chandler Klüser, @.***> wrote:

image.png (view on web) https://github.com/pcawte/AgDev/assets/29960960/c6e6fab9-29c2-42d9-96a4-f973e53d6395

— Reply to this email directly, view it on GitHub https://github.com/pcawte/AgDev/issues/6#issuecomment-1937044678, or unsubscribe https://github.com/notifications/unsubscribe-auth/APTNFMAT44QT3VUW6F4HCH3YS6HGVAVCNFSM6AAAAABCQNEROCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXGA2DINRXHA . You are receiving this because you commented.Message ID: @.***>

Chandler-Kluser commented 8 months ago

So you have CEDev/bin itself in PATH? Not just links to those binaries? On Sat, 10 Feb 2024, 15:31 Chandler Klüser, @.> wrote: image.png (view on web) https://github.com/pcawte/AgDev/assets/29960960/c6e6fab9-29c2-42d9-96a4-f973e53d6395 — Reply to this email directly, view it on GitHub <#6 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APTNFMAT44QT3VUW6F4HCH3YS6HGVAVCNFSM6AAAAABCQNEROCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXGA2DINRXHA . You are receiving this because you commented.Message ID: @.>

yes

astralaster commented 8 months ago

You should not build anything from source. The release zip already contains all binaries. Just extract it and add the binaries to your path and then make the examples.

Chandler-Kluser commented 8 months ago

why I should not build from source?

astralaster commented 8 months ago

Because I have not tested what you are building. I plan to build the whole thing from source, too. But the current state is that the toolchain is made of prebuilt binaries and this is tested and works.

mateoconlechuga commented 8 months ago

You shouldn't build from source because you are doing it wrong, and developers are sick of having to figure out what you screwed up. That's why you should use a release.

Chandler-Kluser commented 8 months ago

Don't be mad because of an issue report. I have never asked for you to figure out anything, BTW

Chandler-Kluser commented 8 months ago

Because I have not tested what you are building. I plan to build the whole thing from source, too. But the current state is that the toolchain is made of prebuilt binaries and this is tested and works.

I will check what is wrong with the toolchain build instrucions and not rely in these prebuilt binaries that can be compiled only in some machines and report as a patch in this repository

BlastBrothers commented 3 months ago

Given that we can build AgDev from source I'm not sure this is relevant anymore.

Chandler-Kluser commented 3 months ago

actually, I have built ez80-clang from source again:

image

and the problem persists.

I found very nice AgDev repository has a compile.sh script but actually it just downloads a release for me it does not make sense it to be called this way.

./run_tests.sh 
+ rm -rf test
+ mkdir test
+ cd test
+ git clone https://github.com/astralaster/Agon-Raytracer.git --depth 1
Cloning into 'Agon-Raytracer'...
remote: Enumerating objects: 33, done.
remote: Counting objects: 100% (33/33), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 33 (delta 0), reused 25 (delta 0), pack-reused 0
Receiving objects: 100% (33/33), 92.39 KiB | 1.28 MiB/s, done.
+ cd Agon-Raytracer
+ make
[compiling] src/main.cpp
In file included from src/main.cpp:1:
src/agon.h:4:10: fatal error: 'agon/vdp_vdu.h' file not found
#include <agon/vdp_vdu.h>
         ^~~~~~~~~~~~~~~~
1 error generated.
make: *** [/home/chandler/CEDev/meta/makefile.mk:345: obj/src/main.cpp.bc] Error 1

image

Adding AgDev (at commit 20fd3c8f3e82be6e6226f51633aa7b578faca232) includes leaves again to lto.bc issue:

$ make
[lto opt] obj/lto.bc
clang-15: warning: argument unused during compilation: '-I /home/chandler/Documentos/AgDev/include' [-Wunused-command-line-argument]
/home/chandler/SSD2/repositories/AgDev/test/Agon-Raytracer/obj/lto.bc:1:2: error: expected top-level entity
        section .text,"ax",@progbits
        ^
1 error generated.
make: *** [/home/chandler/CEDev/meta/makefile.mk:331: obj/lto.src] Error 1

image

BlastBrothers commented 2 months ago

That repo is out of date. Use the compile.sh from AgDev itself.

Chandler-Kluser commented 2 months ago

I found very nice AgDev repository has a compile.sh script but actually it just downloads a release for me it does not make sense it to be called this way.

That repo is out of date. Use the compile.sh from AgDev itself.

I did