Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#7617 defect closed duplicate (duplicate)

Skip building extension modules when no C compiler is available

Reported by: Tobias Oberstein Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

Problem

Twisted should be installable from source even when the system does not have a C compiler and Python headers.

Currently, when above is not satisfied, a Twisted source installation fails. Working around requires users to manually patch Twisted setup.py files.

Proposed Solution

A necessary, though not sufficient condition for building any C-based extension module for Twisted is:

  • availability of a working C compiler
  • availability of Python.h

Note that above is a necessary condition. Depending on the extension module, it's not sufficient. E.g. the portmap extension module requires ONC RPC headers and libraries in addition.

The proposed patch skips building any extension module if above necessary conditions are not met.

The proposed patch is orthogonal to more fine grained checking of prerequisites for specific extension modules (sufficient conditions). It is also orthogonal to porting extensions from CPyExt to CFFI.

Attachments (1)

skip_exts_building.patch (586 bytes) - added by Tobias Oberstein 3 years ago.

Download all attachments as: .zip

Change History (8)

Changed 3 years ago by Tobias Oberstein

Attachment: skip_exts_building.patch added

comment:1 Changed 3 years ago by Tobias Oberstein

I have tested this patch on a MIPS/Linux platform lacking a C compiler ("Arduino Yun") where it successfully allows to install Twisted from sources.

I have also tested this patch on a x86-64/Linux platform that does have a C compiler and Python development header+libraries (Ubuntu 14.04 LTS) where it successfully allows to install Twisted from sources - and builds the extension modules.

comment:2 Changed 3 years ago by Tobias Oberstein

There might be a problem: after porting a CPyExt module to CFFI, and when CFFI is already available on the system, a C compiler might no longer needed.

The CFFI docs say: "A C compiler is required to use CFFI during development, but not to run correctly-installed programs that use CFFI"

comment:3 Changed 3 years ago by Tobias Oberstein

FWIW, Crossbar.io on a stocke Ubuntu 12.04 LTS (which doesn't have Python dev package) fails to install because of this: https://github.com/crossbario/crossbar/issues/207

comment:4 Changed 3 years ago by zooko

I think this is a duplicate of #3586.

comment:5 Changed 3 years ago by Glyph

Resolution: duplicate
Status: newclosed

I agree, it's a dup.

comment:6 Changed 3 years ago by Tobias Oberstein

It's a dup, but what about the patch?

https://twistedmatrix.com/trac/attachment/ticket/7617/skip_exts_building.patch

This patch work for me with the latest Twisted.

comment:7 Changed 3 years ago by Glyph

oberstet, what about it? should this have been in review?

Note: See TracTickets for help on using tickets.