Bug 156076 - [patch] databases/py-sqlite3: Undefined symbol "sqlite3_load_extension"
Summary: [patch] databases/py-sqlite3: Undefined symbol "sqlite3_load_extension"
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-python (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-31 04:20 UTC by Pan Tsu
Modified: 2012-07-26 06:50 UTC (History)
0 users

See Also:


Attachments
a.diff (1.90 KB, patch)
2011-03-31 04:20 UTC, Pan Tsu
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pan Tsu 2011-03-31 04:20:09 UTC
Don't define HAVE_LOAD_EXTENSION when sqlite3 is compiled with EXTENSION
option turned off.

see also ports/149842, ports/155971, neither cites exact error message

Fix: No need to go overkill and iterate sqlite3_compileoption_get() to
populate macros, testing existence of the symbol is enough.

  $ grep -r '#if.*[[:blank:]]SQLITE_' $(make -V WRKSRC) | fgrep -iv version
  WRKSRC/_sqlite/connection.c:#ifndef SQLITE_OMIT_LOAD_EXTENSION
How-To-Repeat: 1. install databases/sqlite3 without EXTENSION support
2. install databases/py-sqlite3
3. try to import py-sqlite3

  $ python -c 'import sqlite3'
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/usr/local/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
      from dbapi2 import *
    File "/usr/local/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
      from _sqlite3 import *
  ImportError: /usr/local/lib/python2.7/site-packages/_sqlite3.so: Undefined symbol "sqlite3_load_extension"
Comment 1 Eugene Grosbein 2011-10-18 13:37:06 UTC
Hi!

Vote for this PR, without this change I could not build firefox 7.0.1 from ports,
build failed with same error. Proposed change fixed the problem.

Eugene Grosbein
Comment 2 geoffroy desvernay 2011-10-21 12:29:11 UTC
Same here (with different ports): this patch works for me(tm)
The only other workaround is to rebuild databases/sqlite3 with EXTENSION on.
ports/149842 changed default on databases/sqlite3, but doesn't fix the
problem if sqlite3 is already installed...
My 2cts...
-- 
*geoffroy desvernay*
C.R.I - Administration systèmes et réseaux
Ecole Centrale de Marseille
Comment 3 Bryan Drewery 2012-04-29 04:32:39 UTC
The patch works great for me as well.

Bryan Drewery
Comment 4 dfilter service freebsd_committer 2012-07-26 06:44:24 UTC
Author: mva
Date: Thu Jul 26 05:44:07 2012
New Revision: 301540
URL: http://svn.freebsd.org/changeset/ports/301540

Log:
  - Don't define HAVE_LOAD_EXTENSION when sqlite3 is compiled with EXTENSION
    option turned off
  
  PR:		ports/156076
  Submitted by:	Pan Tsu <inyaoo@gmail.com>

Modified:
  head/databases/py-sqlite3/Makefile   (contents, props changed)
  head/databases/py-sqlite3/files/setup.py   (contents, props changed)
  head/databases/py-sqlite3/files/setup3.py   (contents, props changed)

Modified: head/databases/py-sqlite3/Makefile
==============================================================================
--- head/databases/py-sqlite3/Makefile	Thu Jul 26 05:40:22 2012	(r301539)
+++ head/databases/py-sqlite3/Makefile	Thu Jul 26 05:44:07 2012	(r301540)
@@ -7,7 +7,7 @@
 
 PORTNAME=	sqlite3
 PORTVERSION=	${PYTHON_PORTVERSION}
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	databases python
 MASTER_SITES=	${PYTHON_MASTER_SITES}
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}

Modified: head/databases/py-sqlite3/files/setup.py
==============================================================================
--- head/databases/py-sqlite3/files/setup.py	Thu Jul 26 05:40:22 2012	(r301539)
+++ head/databases/py-sqlite3/files/setup.py	Thu Jul 26 05:44:07 2012	(r301540)
@@ -32,6 +32,12 @@ sqlite_srcs = [
 '_sqlite/statement.c',
 '_sqlite/util.c']
 
+try:
+    import ctypes
+    ctypes.CDLL('libsqlite3.so').sqlite3_load_extension
+except AttributeError:
+    macros.append(('SQLITE_OMIT_LOAD_EXTENSION', '1'))
+
 setup(name = "_sqlite3",
       description = "SQLite 3 extension to Python",
       

Modified: head/databases/py-sqlite3/files/setup3.py
==============================================================================
--- head/databases/py-sqlite3/files/setup3.py	Thu Jul 26 05:40:22 2012	(r301539)
+++ head/databases/py-sqlite3/files/setup3.py	Thu Jul 26 05:44:07 2012	(r301540)
@@ -31,6 +31,12 @@ sqlite_srcs = [
 '_sqlite/statement.c',
 '_sqlite/util.c']
 
+try:
+    import ctypes
+    ctypes.CDLL('libsqlite3.so').sqlite3_load_extension
+except AttributeError:
+    macros.append(('SQLITE_OMIT_LOAD_EXTENSION', '1'))
+
 setup(name = "_sqlite3",
       description = "SQLite 3 extension to Python",
       
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 5 Marcus von Appen freebsd_committer freebsd_triage 2012-07-26 06:44:40 UTC
State Changed
From-To: open->closed

Committed. Thanks!