Bug 1537489 - Undefined references when compiling ctypes
Summary: Undefined references when compiling ctypes
Alias: None
Product: Fedora
Classification: Fedora
Component: python3
Version: 28
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Charalampos Stratakis
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2018-01-23 10:51 UTC by Charalampos Stratakis
Modified: 2018-02-26 16:52 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-02-26 16:52:25 UTC
Type: Bug

Attachments (Terms of Use)
Build log. (1.33 MB, text/plain)
2018-01-23 10:51 UTC, Charalampos Stratakis
no flags Details

System ID Private Priority Status Summary Last Updated
Python 32647 0 None None None 2018-01-24 10:28:01 UTC

Description Charalampos Stratakis 2018-01-23 10:51:57 UTC
Created attachment 1384793 [details]
Build log.

Currently on rawhide a strict symbol check is enforced [0] meaning that undefined references will make the build fail as shown at the build log.

This can be disabled by utilizing the %undefine _strict_symbol_defs_build macro or by passing the `-z undefs` flag to ld, however we should find out why those symbols are undefined.

[0] https://src.fedoraproject.org/rpms/redhat-rpm-config/c/078af192613e1beec34824a94dc5f6feeeea1568?branch=master

Comment 1 Björn 'besser82' Esser 2018-01-23 14:31:53 UTC
Well, they are undefined because for some reason the _ctypes module is not explicitly linked against -ldl.

As I cannot reproduce this with the recent master branch from cpython (and my refactored libxcrypt patch applied), I think this has been fixed there already or is caused for some obscure reason to me from one of the other patches applied in Fedora.

Anyways, I've added a patch to explicitly link the _ctypes module against -ldl in the mean time and it builds fine with that and _strict_symbol_defs_build defined as usual.

Comment 2 Björn 'besser82' Esser 2018-01-23 14:39:58 UTC
Scratch build:  https://koji.fedoraproject.org/koji/taskinfo?taskID=24396265

Comment 3 Björn 'besser82' Esser 2018-01-23 14:47:43 UTC
(In reply to Björn 'besser82' Esser from comment #1)
> As I cannot reproduce this with the recent master branch from cpython (and
> my refactored libxcrypt patch applied)

I can reproduce after upgrading `redhat-rpm-config` *and* re-exporting the new `LDFLAGS`.  Even more modules are failing there, because of changing to linking with strict symbols defs.

Comment 4 Florian Weimer 2018-01-23 14:58:22 UTC
Does Python still capture the compiler/linker flags used when the package was built?  That's bad.

In any case, yes, ctypes needs to be linked with -ldl.  Considering that Python modules are expected to be linked against the Python run-time DSO, I think it would be prudent to enforce -z defs for Python modules.  In general, this is absolutely required to generate the proper RPM dependencies for Python modules, and lack of relevant DT_NEEDED entries can also cause problems with dynamic linking due to incorrect relocation order.

Comment 5 Charalampos Stratakis 2018-01-23 15:40:42 UTC
Will follow up with upstream on this.

Comment 6 Fedora End Of Life 2018-02-20 15:33:57 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle.
Changing version to '28'.

Comment 7 Charalampos Stratakis 2018-02-26 16:52:25 UTC
Tested the upstream fix by enabling the strict symbol check through a macro [0] since the flag has been reversed now.

[0] %define _strict_symbol_defs_build 1

ctypes compiled successfully with no issues so I pushed the fix for master and F28.


Note You need to log in before you can comment on or make changes to this bug.