Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importing _ctypes failed: undefined symbol: ffi_call_win32 #66824

Closed
siming85 mannequin opened this issue Oct 14, 2014 · 16 comments
Closed

importing _ctypes failed: undefined symbol: ffi_call_win32 #66824

siming85 mannequin opened this issue Oct 14, 2014 · 16 comments
Labels
build The build process and cross-build release-blocker

Comments

@siming85
Copy link
Mannequin

siming85 mannequin commented Oct 14, 2014

BPO 22634
Nosy @malemburg, @birkenfeld, @doko42, @pitrou, @larryhastings, @siming85, @applio
Superseder
  • bpo-23042: ctypes module doesn't build on FreeBSD, RHEL (x86) - Undefined symbol "ffi_call_win32"
  • Files
  • configure.log: configure log on RHEL6.4
  • make.log: make log on RHEL 6.4
  • rpm.log: rhel 6.4 rpm information
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2015-03-19.22:23:30.404>
    created_at = <Date 2014-10-14.19:59:45.796>
    labels = ['build', 'release-blocker']
    title = 'importing _ctypes failed: undefined symbol: ffi_call_win32'
    updated_at = <Date 2015-03-19.22:23:30.403>
    user = 'https://github.com/siming85'

    bugs.python.org fields:

    activity = <Date 2015-03-19.22:23:30.403>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-03-19.22:23:30.404>
    closer = 'berker.peksag'
    components = ['Build']
    creation = <Date 2014-10-14.19:59:45.796>
    creator = 'siming85'
    dependencies = []
    files = ['36938', '36939', '36940']
    hgrepos = []
    issue_num = 22634
    keywords = ['3.4regression']
    message_count = 16.0
    messages = ['229342', '229343', '229346', '229428', '229446', '229448', '229449', '229451', '229453', '235536', '235537', '238508', '238509', '238523', '238532', '238533']
    nosy_count = 8.0
    nosy_names = ['lemburg', 'georg.brandl', 'doko', 'pitrou', 'larry', 'Arfrever', 'siming85', 'davin']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '23042'
    type = 'compile error'
    url = 'https://bugs.python.org/issue22634'
    versions = ['Python 3.4', 'Python 3.5']

    @siming85
    Copy link
    Mannequin Author

    siming85 mannequin commented Oct 14, 2014

    Compiling Python 3.4.2 32-bit using GCC under RHEL6.4 and RHEL5.5 yields to crash:

    *** WARNING: renaming "_ctypes" since importing it failed: build/lib.linux-x86_64-3.4/_ctypes.cpython-34m.so: undefined symbol: ffi_call_win32

    Why is it referring to a win32 api when i'm compiling under Linux?

    This failure causes pip installation to also fail due to missing ctypes module.

    FYI - 3.4.1 under exact same env. builds fine.

    @siming85 siming85 mannequin added build The build process and cross-build labels Oct 14, 2014
    @vstinner
    Copy link
    Member

    Similar issue on old FreeBSD versions: issuee bpo-22521.

    @birkenfeld
    Copy link
    Member

    This appears to be caused by the update to libffi version 3.1 in 3.4.2.

    @doko42
    Copy link
    Member

    doko42 commented Oct 15, 2014

    could somebody attach a build log from such a system? and the libffi config.log?

    @siming85
    Copy link
    Mannequin Author

    siming85 mannequin commented Oct 15, 2014

    attached python 3.4.2 configure log on RHEL6.4

    @siming85
    Copy link
    Mannequin Author

    siming85 mannequin commented Oct 15, 2014

    make log from RHEL 6.4 for python 3.4.2.

    Also got this on the STDERR:

    $ make > ../make.log
    build/temp.linux-x86_64-3.4/opt/python-3.4.2/Python-3.4.2/Modules/_ctypes/libffi/src/x86/ffi.o: In function `ffi_prep_closure_loc':
    /opt/python-3.4.2/Python-3.4.2/Modules/_ctypes/libffi/src/x86/ffi.c:679: undefined reference to `ffi_closure_FASTCALL'
    /usr/bin/ld: build/temp.linux-x86_64-3.4/opt/python-3.4.2/Python-3.4.2/Modules/_ctypes/libffi/src/x86/ffi.o: relocation R_386_GOTOFF against undefined hidden symbol `ffi_closure_FASTCALL' can not be used when making a shared object
    /usr/bin/ld: final link failed: Bad value
    collect2: ld returned 1 exit status

    @siming85
    Copy link
    Mannequin Author

    siming85 mannequin commented Oct 15, 2014

    configure arguments:

    BASECFLAGS=-m32 LDFLAGS=-m32 CFLAGS=-m32 ./configure --prefix=/opt/python-3.4.2/ > ../configure.log

    attached system rpm information. no additional binaries/PATHs/LD_LIB_PATHs

    @doko42
    Copy link
    Member

    doko42 commented Oct 15, 2014

    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu

    and using -m32 explicitly.

    so you'll get what you deserve ;-)

    @siming85
    Copy link
    Mannequin Author

    siming85 mannequin commented Oct 15, 2014

    [siyuan@siyuan-lnx:siyuan-ott]$ lsb_release -a
    LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
    Distributor ID: RedHatEnterpriseWorkstation
    Description: Red Hat Enterprise Linux Workstation release 6.4 (Santiago)
    Release: 6.4
    Codename: Santiago
    [siyuan@siyuan-lnx:siyuan-ott]$ uname -a
    Linux siyuan-lnx 2.6.32-358.0.1.el6.x86_64 #1 SMP Wed Feb 20 11:05:23 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

    :( there's nothing special..

    @larryhastings
    Copy link
    Contributor

    What does "-m32" mean?

    @pitrou
    Copy link
    Member

    pitrou commented Feb 8, 2015

    "-m32" means "compile a 32-bit build though I'm on a 64-bit platform". I'm not sure why Matthias says this is "getting what you deserve", since everytime I've tried, "-m32" worked properly for building Python.

    @applio
    Copy link
    Member

    applio commented Mar 19, 2015

    Comparing this to bpo-23042, this same behavior appears on i386 releases of FreeBSD 8.3 and 10.1 (the i386-RELEASE means it's 32-bit as opposed to 64-bit build). Given that this issue is being triggered here with -m32 (triggers building of 32-bit binaries) and yet we don't appear to be having this issue on 64-bit builds, that could be a useful clue.

    @malemburg
    Copy link
    Member

    This is likely also related to bpo-23042.

    The precompiler #ifdefs were mixed up, causing Win32 code to be compiled in on other platforms as well.

    @applio
    Copy link
    Member

    applio commented Mar 19, 2015

    There is now a proposed patch on bpo-23042 which, having gone through those changes, may well address this issue too.

    Testing that patch on multiple platforms (including the RHEL variants relevant here) would be much appreciated.

    Thanks goes to @lemburg for doing the investigative work and providing the diffs that occurred to the Modules/_ctypes/libffi/src/x86/ffi.c file in the past -- that work made the patch possible to sort out.

    @siming85
    Copy link
    Mannequin Author

    siming85 mannequin commented Mar 19, 2015

    @davin @lemburg
    just tested with the provided patch in http://bugs.python.org/issue23042, the partch works.

    dupe the bug?

    @applio
    Copy link
    Member

    applio commented Mar 19, 2015

    @siyuan: Duping it -- thanks for trying that patch out so quickly!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build release-blocker
    Projects
    None yet
    Development

    No branches or pull requests

    8 participants