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

undefined reference to `parse_args__option_maps__constant_reference_typeDF' #3

Open
tkurtbond opened this issue Nov 29, 2024 · 2 comments

Comments

@tkurtbond
Copy link

I'm getting a link error when building a program, tpa (for test parse_args) that uses parse_args. The program is cut down from the generic_example program in the parse_args distribution, and I've set it up as an alire crate, done alr with parse_args, and have done alr build to build it. The repository with the program is https://github.com/tkurtbond/tpa and the program is only 31 lines long.

In summary, when linking the program I get an error from ld that in my tpa_options.o file in the function tpa_options__compass_option__inner__value__B218s___finalizer__3.3 that there is an undefined reference to parse_args__option_maps__constant_reference_typeDF.

Here is the error text I get when building:

Note: Building tpa=0.1.0-dev/tpa.gpr...
Link
   [link]         tpa.adb
/home/tkb/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/bin/../lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /home/tkb/Repos/tpa/obj/development/tpa_options.o: in function `tpa_options__compass_option__inner__value__B218s___finalizer__3.3':
tpa_options.ads:(.text.tpa_options__compass_option__inner__value__B218s___finalizer__3.3+0x40): undefined reference to `parse_args__option_maps__constant_reference_typeDF'
/home/tkb/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/bin/../lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /home/tkb/Repos/tpa/obj/development/tpa_options.o: in function `tpa_options__compass_option__inner__value__B229s___finalizer__3.4':
tpa_options.ads:(.text.tpa_options__compass_option__inner__value__B229s___finalizer__3.4+0x40): undefined reference to `parse_args__option_maps__constant_reference_typeDF'
collect2: error: ld returned 1 exit status
gprbuild: link of tpa.adb failed
gprbuild: failed command was: /home/tkb/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/bin/gcc tpa.o b__tpa.o /home/tkb/Repos/tpa/obj/development/tpa_options.o /home/tkb/.local/share/alire/builds/parse_args_0.9.0_635f9e4f/1f6a17103c97916161bc6b273ce2fc17a6eba5985cb146cdc481b7d714375da2/lib/libparse_args.a -L/home/tkb/Repos/tpa/obj/development/ -L/home/tkb/Repos/tpa/obj/development/ -L/home/tkb/.local/share/alire/builds/parse_args_0.9.0_635f9e4f/1f6a17103c97916161bc6b273ce2fc17a6eba5985cb146cdc481b7d714375da2/lib/ -L/home/tkb/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0/adalib/ -static-libgcc /home/tkb/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0/adalib/libgnarl.a /home/tkb/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0/adalib/libgnat.a -lrt -lpthread -ldl -Wl,-rpath-link,/home/tkb/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0//adalib -Wl,-z,origin,-rpath,$ORIGIN/..//obj/development:$ORIGIN/../../..//.local/share/alire/builds/parse_args_0.9.0_635f9e4f/1f6a17103c97916161bc6b273ce2fc17a6eba5985cb146cdc481b7d714375da2/lib:$ORIGIN/../../..//.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0/adalib -o /home/tkb/Repos/tpa/bin//tpa
ERROR: Command ["gprbuild", "-s", "-j0", "-p", "-P", "/home/tkb/Repos/tpa/tpa.gpr"] exited with code 4
ERROR: Compilation failed.
@tkurtbond
Copy link
Author

If I comment out all the references to Compass_Options, it compiles fine.

@jhumphry
Copy link
Owner

Your test program compiles and runs if I don't use Alire and just directly compile it with the native compiler. The parse_arg package and examples also all compile and run with direct use of the latest GPRBuild 25.0w and GNAT 14.2.1 (not very surprising as the sources use the No_Implementation_Extensions profile so they should be forward-compatible).

This suggests that there is something going wrong with the Alire build process, either with the way I have packaged parse_args, or something specific to your configuration. I am not very knowledgeable about Alire and how it interacts with the underlying Ada build system, but I will try to look into it when I have some time.

$ gnatmake -L../../parse_args/lib/ -I../../parse_args/src/ tpa
gcc -c -I../../parse_args/src/ tpa.adb
gcc -c -I./ -I../../parse_args/src/ -I- /home/james/projects/ada/parse_args/src/parse_args.adb
gcc -c -I../../parse_args/src/ tpa_options.ads
gcc -c -I./ -I../../parse_args/src/ -I- /home/james/projects/ada/parse_args/src/parse_args-concrete.adb
gcc -c -I./ -I../../parse_args/src/ -I- /home/james/projects/ada/parse_args/src/parse_args-generic_discrete_options.ads
gcc -c -I./ -I../../parse_args/src/ -I- /home/james/projects/ada/parse_args/src/parse_args-generic_options.adb
gnatbind -I../../parse_args/src/ -x tpa.ali
gnatlink tpa.ali -L../../parse_args/lib/
$ ./tpa -c SOUTH
Compass point specified: SOUTH
$ gnat -v
GNAT 14.2.1 20240910

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

2 participants