Opened 3 years ago

Last modified 2 years ago

#22768 new defect

Some Python modules fail to compile on Cygwin if the system headers are installed

Reported by: embray Owned by:
Priority: minor Milestone: sage-wishlist
Component: porting: Cygwin Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Not yet reported upstream; Will do shortly. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by embray)

If the sqlite3 development fails are installed system-wide (e.g. sqlite3.h is found in /usr/include) then the build can fail like:

gcc -shared -Wl,--enable-auto-image-base -L/home/embray/src/sagemath/sage-cygwin/local/lib -Wl,-rpath,/home/embray/src/sagemath/sage-cygwin/local/lib -L/home/embray/src/sagemath/sage-cygwin/local/lib -Wl,-rpath,/home/embray/src/sagemath/sage-cygwin/local/lib build/temp.cygwin-2.8.0-x86_64-2.7-pydebug/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/cache.o build/temp.cygwin-2.8.0-x86_64-2.7-pydebug/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/connection.o build/temp.cygwin-2.8.0-x86_64-2.7-pydebug/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/cursor.o build/temp.cygwin-2.8.0-x86_64-2.7-pydebug/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/microprotocols.o build/temp.cygwin-2.8.0-x86_64-2.7-pydebug/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/module.o build/temp.cygwin-2.8.0-x86_64-2.7-pydebug/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/prepare_protocol.o build/temp.cygwin-2.8.0-x86_64-2.7-pydebug/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/row.o build/temp.cygwin-2.8.0-x86_64-2.7-pydebug/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/statement.o build/temp.cygwin-2.8.0-x86_64-2.7-pydebug/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/util.o -L/usr/lib -L/home/embray/src/sagemath/sage-cygwin/local/lib -L/usr/local/lib -L. -L. -lsqlite3 -lpython2.7 -o build/lib.cygwin-2.8.0-x86_64-2.7-pydebug/_sqlite3.dll
build/temp.cygwin-2.8.0-x86_64-2.7-pydebug/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/cache.o: In function `pysqlite_new_node':
/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/cache.c:38: undefined reference to `__imp__Py_RefTotal'
/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/cache.c:38:(.text+0x3d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp__Py_RefTotal'
/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/cache.c:38: undefined reference to `__imp__Py_RefTotal'
/home/embray/src/sagemath/sage-cygwin/local/var/tmp/sage/build/python2-2.7.13.p0/src/Modules/_sqlite/cache.c:38:(.text+0x4b): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp__Py_RefTotal'

followed by several hundred lines of similar symbol resolution failures.

The issue seems to be that if /usr/include/sqlite.h is found, it is inserting -L/usr/lib earlier than -L. in the link flags, and the result is that /usr/lib/libpythonX.Y is linked against, rather than the libpythonX.Y that was just built.

The same happens with ncurses specifically on Python 3 (but not Python 2, it seems). An intermediate workaround is to simply not install the -devel packages for sqlite3 or libncurses in a Cygwin that Sage will be built in.

I've only reproduced this issue on Cygwin, but I don't see anything Cygwin specific about it immediately.

A related issue is the fact that the build is considered successful. We should figure out how to make it fail if an "optional" extension module that we need fails to build; see #22776

Change History (4)

comment:1 Changed 3 years ago by embray

  • Description modified (diff)

comment:2 Changed 3 years ago by embray

  • Description modified (diff)
  • Priority changed from major to minor
  • Report Upstream changed from N/A to Not yet reported upstream; Will do shortly.
  • Summary changed from sqlite3 module fails to build for Python 2.7.13 on Cygwin to sqlite3 module fails to build if sqlite3 headers are installed on system

comment:3 Changed 3 years ago by embray

  • Milestone changed from sage-8.0 to sage-wishlist

This would be good to fix but I don't think it needs to be in the current release mileston.

comment:4 Changed 2 years ago by embray

  • Description modified (diff)
  • Summary changed from sqlite3 module fails to build if sqlite3 headers are installed on system to Some Python modules fail to compile on Cygwin if the system headers are installed
Note: See TracTickets for help on using tickets.