This same error occurs when you try to alr build a project that actually uses aws, but the repro steps are easier than that; just create a new project with Alire and add aws as a dependency and you get this error:
aws_21.0.0_57fddf8f/.build/x86_64-linux-gnu/release/relocatable/obj/zlib/trees.o: relocation R_X86_64_PC32 against symbol `_length_code' can not be used when making a shared object; recompile with -fPIC
Reproduction steps:
- Create a new project
alr init --bin hello_aws; cd hello_aws
- Add aws
alr with aws
You get this error:
/home/tama/.config/alire/cache/dependencies/gnat_native_11.2.4_2f37a10b/bin/../lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /home/tama/code/ada/hello_aws/alire/cache/dependencies/aws_21.0.0_57fddf8f/.build/x86_64-linux-gnu/release/relocatable/obj/zlib/trees.o: warning: relocation against `_length_code' in read-only section `.text'
/home/tama/.config/alire/cache/dependencies/gnat_native_11.2.4_2f37a10b/bin/../lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /home/tama/code/ada/hello_aws/alire/cache/dependencies/aws_21.0.0_57fddf8f/.build/x86_64-linux-gnu/release/relocatable/obj/zlib/trees.o: relocation R_X86_64_PC32 against symbol `_length_code' can not be used when making a shared object; recompile with -fPIC
/home/tama/.config/alire/cache/dependencies/gnat_native_11.2.4_2f37a10b/bin/../lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
gprlib: /home/tama/.config/alire/cache/dependencies/gnat_native_11.2.4_2f37a10b/bin/gcc execution error
gprbuild: could not build library for project zlib
make: *** [Makefile:184: build-native] Error 4
error: A post-fetch action failed, re-run with -vv -d for details
Googling gives lots of results of solutions to this problem in other C libraries, and the solution is to add -fPIC to dependencies from the bottom up. I'm not sure how to do that for AWS.
This same error occurs when you try to
alr builda project that actually uses aws, but the repro steps are easier than that; just create a new project with Alire and add aws as a dependency and you get this error:aws_21.0.0_57fddf8f/.build/x86_64-linux-gnu/release/relocatable/obj/zlib/trees.o: relocation R_X86_64_PC32 against symbol `_length_code' can not be used when making a shared object; recompile with -fPIC
Reproduction steps:
alr init --bin hello_aws; cd hello_awsalr with awsYou get this error:
Googling gives lots of results of solutions to this problem in other C libraries, and the solution is to add -fPIC to dependencies from the bottom up. I'm not sure how to do that for AWS.