Re: Still confused about PIE/PIC and default build flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



V Sun, Jun 12, 2022 at 06:07:01PM -0500, Richard Shaw napsal(a):
> So I run into this occasionally and it's still not clear to me. In this
> specific case I'm trying to build nanomq[1] and I get the following error:
> 
> /usr/bin/ld: CMakeFiles/nano_test.dir/test.c.o: relocation R_X86_64_32
> against `.rodata' can not be used when making a PIE object; recompile with
> -fPIE
> /usr/bin/ld: CMakeFiles/nano_test.dir/test_hash.c.o: relocation R_X86_64_32
> against `.rodata' can not be used when making a PIE object; recompile with
> -fPIE
> [ 36%] Building C object
> nng/CMakeFiles/nng.dir/src/sp/protocol/reqrep0/rep.c.o
> /usr/bin/ld: CMakeFiles/nano_test.dir/test_dbtree.c.o: relocation
> R_X86_64_32 against symbol `topic0' can not be used when making a PIE
> object; recompile with -fPIE
> 
> Any hints are appreciated.
> 
It looks like you did not pass -fPIE or -fPIC to a compiler, yet you passed
-fPIE to a linker.

Look at CFLAGS and LDFLAGS envariables passed to cmake program.

Run the build in a verbose mode (make VERBOSE=1) to see the actual invocation
of the compiler when compiling rep.c.o and the linker when using that file to
link an executable.

If you try to package the software into Fedora's RPM package, then the PIE
and PIC options are set with GCC "argument script" using options
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 for the compiler and
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld for the linker. You need to
check that they are indeed presented from CMake configuration to invokation of
compiler and linker.

-- Petr

Attachment: signature.asc
Description: PGP signature

_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux