Skip to content

Alr with fails: zlib/trees.o: relocation R_X86_64_PC32 against symbol `_length_code' #356

@TamaMcGlinn

Description

@TamaMcGlinn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions