Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#56205 closed defect (worksforme)

Unable to execute port: sqlite error: near "BY"

Reported by: sam452 (sam walton) Owned by:
Priority: Normal Milestone:
Component: base Version: 2.4.2
Keywords: Cc:
Port:

Description

I'm a new MacPorts user, having tried to compile from source dependencies on my ancient 10.5 install. I've installed some successfully, like openssl, so I have the gcc tools needed. Because GitHub has upgraded their TLS stack, I'm unable to upgrade git and compile it from source. MacPorts-2.4.2 I've set ./configure --prefix=$HOME --with-openssl=/usr/local/bin/openssl and got through a successful install. So after successfully running sudo ~/bin/port -v selfupdate I attempted this: sudo ~/bin/port -v install git The error returned: Error: Unable to execute port: sqlite error: near "BY": syntax error (1) while executing query: SELECT id FROM registry.ports INDEXED BY port_name WHERE state='installed' AND name='xz' I've searched the trac system and Google to see anything close to this error. I've attempted other port installs but still get the same error. Reading this forum I've attempted sudo ~/bin/port clean Can't map the URL 'file://.' to a port description file Looking around, I find I should try this: sudo ~/bin/port -f uninstall ncursesw Warning: no such port: ncursesw, skipping uninstall which is understandable since this is a new install. So, what should I do next? thx, sam

Change History (10)

comment:1 Changed 6 years ago by raimue (Rainer Müller)

This is an error when trying to query the SQLite3 database at ${prefix}/var/macports/registry/registry.db.

With which SQLite3 library did you link MacPorts? This looks like a mismatch of header and library. The build assumed you have SQLite3 >= 3.6.4 based on the header, but apparently at runtime the library does not support this syntax.

Do you maybe have a sqlite3 in /usr/local/ that could interfere?

comment:2 Changed 6 years ago by raimue (Rainer Müller)

Component: portsbase
Milestone: MacPorts 2.4.3

comment:3 Changed 6 years ago by sam452 (sam walton)

I do have sqlite3 in /usr/local/ Should I rebuild MacPorts on this machine? Or can I associate sqlite3 another way? thx, sam

comment:4 Changed 6 years ago by raimue (Rainer Müller)

Resolution: worksforme
Status: newclosed

You will need to reinstall MacPorts.

If you want to use sqlite3 from the system, you can try configure with --with-sqlite3prefix=/usr. But this might give the same result as the build will again find sqlite3.h in /usr/local/include due to the order of include paths.

If you want to, you should also be able to just use this newer SQLite3 installation with --with-sqlite3prefix=/usr/local.

comment:5 Changed 6 years ago by sam452 (sam walton)

Yes, what you say makes sense. So from my user account I’ve located Sqlite3 and have gone through the install steps again with this setup after removing the bin and support files.

./configure --prefix=$HOME/macports --with-openssl=/usr/local/bin/openssl --with-sqlite3prefix=/usr/local/Cellar/sqlite/3.7.10/

From the .configure output I find this:

checking for target platform... darwin 9
checking for curl-config... /usr/bin/curl-config
checking sqlite3ext.h usability... yes
checking sqlite3ext.h presence... yes
checking for sqlite3ext.h... yes
checking for SQLite >= 3003011... yes

All seem ok and no obvious errors through the configure, make, sudo make install process. And successfully run the selfupdate

Yet again when I

sudo ~/macports/bin/port -v install git

returns:

Portfile changed since last build; discarding previous state.
Error: Unable to execute port: sqlite error: near "BY": syntax error (1) while executing query: SELECT id FROM registry.ports INDEXED BY port_name WHERE state='installed' AND name='xz'

This sqlite3 install works. What should I do next to get this working?, sam

comment:6 Changed 6 years ago by raimue (Rainer Müller)

Check with which library MacPorts was linked. If this still says /usr/lib/libsqlite3.dylib, something went wrong. For example, on my system with macOS 10.12 Sierra:

$ otool -L /opt/local/libexec/macports/lib/registry2.0/registry.dylib
/opt/local/libexec/macports/lib/registry2.0/registry.dylib:
	@loader_path/../registry2.0/registry.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 254.8.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)

Another solution would of course be to remove the custom sqlite3 from /usr/local as that leaves only the system version to be linked.

comment:7 Changed 6 years ago by sam452 (sam walton)

OK, here's my output of otool -L macports/libexec/macports/lib/registry2.0/registry.dylib macports/libexec/macports/lib/registry2.0/registry.dylib:

@loader_path/../registry2.0/registry.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.7)

So I've zipped up that copy of sqlite3 in the /usr/local noted above, Pointed to my sqlite install in /usr/include/ This is my latest configure

./configure --prefix=$HOME/macports --with-openssl=/usr/local/bin/openssl --with-sqlite3prefix=/usr/include/

But still nothing changes. I cannot install any port. I'm unsure what to try next.

comment:8 Changed 6 years ago by sam452 (sam walton)

The results of my otool are below: otool -L macports/libexec/macports/lib/registry2.0/registry.dylib

macports/libexec/macports/lib/registry2.0/registry.dylib:
	@loader_path/../registry2.0/registry.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.7)

The difference is that your libsqlite3 is different from mine: libsqlite3.0.dylib. I do seem to have both. Should I remove the one for 3.0? thx, sam

comment:9 Changed 6 years ago by raimue (Rainer Müller)

If it is still not working after you removed sqlite3 from /usr/local, it is still picking up the wrong headers from somewhere else or you did not actually rebuild from source. I am not sure if just running configure invalidates all previous build artifacts. Did you run make clean between the builds?

No idea how the libraries were shipped on 10.5, but one of the /usr/lib/libsqlite3*.dylib files is usually just a symlink to the other. It is advised not to modify system files in general.

comment:10 Changed 6 years ago by sam452 (sam walton)

Yes, running make clean seemed to clear up and I'm finally installing stuff. Thanks for our patience in helping me work this out!, sam

Note: See TracTickets for help on using tickets.