Page MenuHome

GMP/macOS: silence "PIE disabled" linker warning.

Authored by Ankit Meel (ankitm) on Sep 7 2020, 11:23 AM.



The change builds GMP with --with-pic flag on non-arm architecture.

The warning:
ld: warning: PIE disabled. Absolute addressing
(perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in
___gmpn_divexact_1 from lib/darwin/gmp/lib/libgmp.a(dive_1.o). To fix
this warning, don't compile with -mdynamic-no-pic or link with

Diff Detail

rB Blender
gmplinking (branched from master)
Build Status
Buildable 10119
Build 10119: arc lint + arc unit

Event Timeline

Ankit Meel (ankitm) requested review of this revision.Sep 7 2020, 11:23 AM
Ankit Meel (ankitm) created this revision.

I'm not sure that simply hiding this warning or disabling PIE is correct. I would think that PIE is needed for GMP/Booleans to work correctly when compiling Blender as a Python module?

The better fix then would be to edit build_files/build_environment/cmake/gmp.cmake to compiled with position independent code (--with-pic flag perhaps?) and commit the updated GMP library.

Ankit Meel (ankitm) planned changes to this revision.Sep 7 2020, 6:42 PM

Thank you for reviewing the patches!
I didn't think this one through & did what the warning told me.
I'll give it a try tomorrow and will abandon this if I cannot get the library working.

  • Revert original method of linking with -no_pie.
  • Build GMP with --with-pic.
Ankit Meel (ankitm) edited the summary of this revision. (Show Details)Sep 10 2020, 4:21 PM
Ankit Meel (ankitm) added a comment.EditedSep 10 2020, 4:24 PM

The headers are the same since CC or CFLAGS are at default. The built libraries which don't create the said warnings:

Minor suggestion to add the following to the ExternalProject_Add since the library suggests running tests.

TEST_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/gmp/src/external_gmp/ && make check

Also, I kept it only in APPLE block as I didn't see those warnings on Linux buildbot.

@Sebastián Barschkis (sebbas), can you handle this?

We don't need to run the GMP tests, we don't do that for any other library either.

On macOS Intel I can confirm this resolves the linker warning.
On macOS arm I did not see the warning. I personally would therefore exclude the option from that platform.

Ankit Meel (ankitm) edited the summary of this revision. (Show Details)
  • Build with pic on non-arm architecture.
Ankit Meel (ankitm) edited the summary of this revision. (Show Details)Sep 15 2020, 9:57 PM
This revision is now accepted and ready to land.Sep 15 2020, 10:19 PM