Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Chandler-Kluser opened this issue Jan 30, 2024 · 30 comments

Comments

@Chandler-Kluser
Copy link

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
Copy link
Author

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!! 😄

@astralaster
Copy link
Collaborator

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
Copy link
Collaborator

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

@Chandler-Kluser
Copy link
Author

Thanks, I will build it from source and check 😄

@Chandler-Kluser
Copy link
Author

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

@HeathenUK
Copy link
Contributor

HeathenUK commented Feb 10, 2024 via email

@Chandler-Kluser
Copy link
Author

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

@HeathenUK
Copy link
Contributor

HeathenUK commented Feb 10, 2024 via email

@Chandler-Kluser
Copy link
Author

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

@HeathenUK
Copy link
Contributor

HeathenUK commented Feb 10, 2024 via email

@Chandler-Kluser
Copy link
Author

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

@Chandler-Kluser
Copy link
Author

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 .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
Copy link
Contributor

HeathenUK commented Feb 10, 2024 via email

@Chandler-Kluser
Copy link
Author

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
Copy link
Contributor

HeathenUK commented Feb 10, 2024 via email

@Chandler-Kluser
Copy link
Author

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
Copy link
Contributor

HeathenUK commented Feb 10, 2024 via email

@Chandler-Kluser
Copy link
Author

image

@HeathenUK
Copy link
Contributor

HeathenUK commented Feb 10, 2024 via email

@Chandler-Kluser
Copy link
Author

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
Copy link
Collaborator

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
Copy link
Author

@astralaster
Copy link
Collaborator

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
Copy link

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
Copy link
Author

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

@Chandler-Kluser
Copy link
Author

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
Copy link
Contributor

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

@Chandler-Kluser
Copy link
Author

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
Copy link
Contributor

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

@Chandler-Kluser
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants