This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python 2.7 compilation fails on AMD64 Ubuntu Shared 2.7 buildbot with: relocation R_X86_64_PC32 against symbol ... can not be used ...
Type: Stage: resolved
Components: Build Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: db3l, pablogsal, vstinner
Priority: normal Keywords:

Created on 2019-04-25 13:32 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg340840 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-25 13:32
https://buildbot.python.org/all/#/builders/139/builds/251

Example:

building 'time' extension
gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -g -O0 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Include -I/srv/buildbot/buildarea/2.7.bolen-ubuntu/build -c /srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Modules/timemodule.c -o build/temp.linux-x86_64-2.7-pydebug/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Modules/timemodule.o
gcc -pthread -shared build/temp.linux-x86_64-2.7-pydebug/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Modules/timemodule.o -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -L. -lm -lpython2.7 -o build/lib.linux-x86_64-2.7-pydebug/time.so
/usr/local/lib/libpython2.7.a(posixmodule.o): In function `posix_tmpnam':
/srv/buildbot/Python-2.7.16/./Modules/posixmodule.c:7648: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
/usr/local/lib/libpython2.7.a(posixmodule.o): In function `posix_tempnam':
/srv/buildbot/Python-2.7.16/./Modules/posixmodule.c:7595: warning: the use of `tempnam' is dangerous, better use `mkstemp'
/usr/bin/ld: /usr/local/lib/libpython2.7.a(ceval.o): relocation R_X86_64_PC32 against symbol `PyFunction_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

It seems to be a regression caused by my change, commit f4edd39017a211d4544570a1e2ac2110ef8e51b4, PR 12875 for bpo-28552.
msg340850 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-25 17:03
@David Bolen: Would you mind to have a look at this issue on your buildbot?

I'm not sure that the regression is caused by my commit, since the command lines are the same in the previous build 250:

building 'time' extension
gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -g -O0 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Include -I/srv/buildbot/buildarea/2.7.bolen-ubuntu/build -c /srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Modules/timemodule.c -o build/temp.linux-x86_64-2.7-pydebug/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Modules/timemodule.o
gcc -pthread -shared build/temp.linux-x86_64-2.7-pydebug/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Modules/timemodule.o -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -L. -lm -lpython2.7 -o build/lib.linux-x86_64-2.7-pydebug/time.so
msg340858 - (view) Author: David Bolen (db3l) * Date: 2019-04-25 20:10
Yes, it appears most likely to be the worker environment.  I did upgrade the kernel in between builds 250 (good) and 251 (bad), but reverting that still fails, even with the same commit as in build 250.

My current suspicion is that a test I did recently with a static 2.7.16 build is influencing the buildbot build process (which might explain why the error seems to involve an -fPIC mismatch in a library).  Not sure how yet though.
msg340863 - (view) Author: David Bolen (db3l) * Date: 2019-04-25 21:17
Ok, I've resolved this, and the linker errors did actually point at the root issue.  They show trying to link extensions against /usr/local/lib/libpython2.7.a which was my test static build of 2.7.16.

Arguably this seems an issue in the buildbot build process in that it doesn't sandbox extension building to force linking to the python library being built rather than a random system library, but I can't see spending any time on that.  I've purged the 2.7.16 files from the /usr/local tree and things seem to be back to normal

I've started a new run for the failing build.
msg340867 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-25 23:04
https://buildbot.python.org/all/#/builders/139/builds/252 is back to green. I close the issue. Thanks David!
History
Date User Action Args
2022-04-11 14:59:14adminsetgithub: 80899
2019-04-25 23:04:24vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg340867

stage: resolved
2019-04-25 21:17:57db3lsetmessages: + msg340863
2019-04-25 20:10:34db3lsetmessages: + msg340858
2019-04-25 17:03:44vstinnersetnosy: + db3l, pablogsal
messages: + msg340850
2019-04-25 13:32:03vstinnercreate