SQLite3 - External module not found

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

SQLite3 - External module not found

Julien Delplanque
Hello everyone,

I have problems to get SQLite3 package working. I tried the solution
provided in another thread of the mailing list that was to create a
symbolic link from libsqlite3.so to a file located in the pharo3.0/bin
directory and named 'libsqlite3.so' as well but I still get the error:
External module not found.

My OS is Archlinux (Linux version 3.18.6-1-ARCH (builduser@tobias) (gcc
version 4.9.2 20141224 (prerelease) (GCC) ) #1 SMP PREEMPT Sat Feb 7
08:44:05 CET 2015) and I'm using pharo3.

The code that fail:

c := SQLiteConnection fileNamed: ':memory:'.
c open.

Maybe I'm missing something with the libsqlite3.so file?

Thanks in advance,

Julien

Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

vonbecmann
the symbolic link works in my pc. did you restart the image after
creating the link? or maybe the link is in the wrong place?


On Sat, Feb 28, 2015 at 2:22 PM, Julien Delplanque <[hidden email]> wrote:

> Hello everyone,
>
> I have problems to get SQLite3 package working. I tried the solution
> provided in another thread of the mailing list that was to create a
> symbolic link from libsqlite3.so to a file located in the pharo3.0/bin
> directory and named 'libsqlite3.so' as well but I still get the error:
> External module not found.
>
> My OS is Archlinux (Linux version 3.18.6-1-ARCH (builduser@tobias) (gcc
> version 4.9.2 20141224 (prerelease) (GCC) ) #1 SMP PREEMPT Sat Feb 7
> 08:44:05 CET 2015) and I'm using pharo3.
>
> The code that fail:
>
> c := SQLiteConnection fileNamed: ':memory:'.
> c open.
>
> Maybe I'm missing something with the libsqlite3.so file?
>
> Thanks in advance,
>
> Julien
>



--
Bernardo E.C.

Sent from a cheap desktop computer in South America.

Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

Julien Delplanque
First, thanks to take time to answer me.

On 28/02/15 22:50, Bernardo Ezequiel Contreras wrote:
> the symbolic link works in my pc. did you restart the image after
> creating the link? or maybe the link is in the wrong place?

Ok, I'll be a little more precise:

The libsqlite3.so file is located in /usr/lib/
My pharo vm is located in ~/lib-perso/pharo3.0/

What I did is:
ln -s /usr/lib/sqlite3.so ~/lib-perso/pharo3.0/bin/sqlite3.so

Then I restarted the VM as you said but the error still appear when I
tried the code I c/c in the first mail.

Then I realized that  /usr/lib/sqlite3.so is a symbolic link that point
on /usr/lib/libsqlite3.so.0.8.6 so to be sure it wasn't just that, I
tried the following commands:

rm ~/lib-perso/pharo3.0/bin/sqlite3.so
ln -s /usr/lib/libsqlite3.so.0.8.6 ~/lib-perso/pharo3.0/bin/sqlite3.so

The error still appear, I'm really confused.

Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

philippeback

I have it working on CentOS.

So it is possible to have it working on Linux.

Is your lib 32 bits?

Also beware of the finalize in the sqlite library in Pharo as it has a bug.

I've had to remove the finalize method and handle connections properly on my own with ensure:

NBSqlite also exists.

Phil

Le 28 févr. 2015 23:12, "Julien Delplanque" <[hidden email]> a écrit :
First, thanks to take time to answer me.

On 28/02/15 22:50, Bernardo Ezequiel Contreras wrote:
> the symbolic link works in my pc. did you restart the image after
> creating the link? or maybe the link is in the wrong place?

Ok, I'll be a little more precise:

The libsqlite3.so file is located in /usr/lib/
My pharo vm is located in ~/lib-perso/pharo3.0/

What I did is:
ln -s /usr/lib/sqlite3.so ~/lib-perso/pharo3.0/bin/sqlite3.so

Then I restarted the VM as you said but the error still appear when I
tried the code I c/c in the first mail.

Then I realized that  /usr/lib/sqlite3.so is a symbolic link that point
on /usr/lib/libsqlite3.so.0.8.6 so to be sure it wasn't just that, I
tried the following commands:

rm ~/lib-perso/pharo3.0/bin/sqlite3.so
ln -s /usr/lib/libsqlite3.so.0.8.6 ~/lib-perso/pharo3.0/bin/sqlite3.so

The error still appear, I'm really confused.


Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

vonbecmann
Julien,
 the symbolic link should be libsqlite3.so not sqlite3.so.

for example
ln -s /usr/lib/i386-linux-gnu/libsqlite3.so.0 libsqlite3.so




On Sat, Feb 28, 2015 at 7:47 PM, [hidden email] <[hidden email]> wrote:

> I have it working on CentOS.
>
> So it is possible to have it working on Linux.
>
> Is your lib 32 bits?
>
> Also beware of the finalize in the sqlite library in Pharo as it has a bug.
>
> I've had to remove the finalize method and handle connections properly on my
> own with ensure:
>
> NBSqlite also exists.
>
> Phil
>
> Le 28 févr. 2015 23:12, "Julien Delplanque" <[hidden email]> a écrit :
>
>> First, thanks to take time to answer me.
>>
>> On 28/02/15 22:50, Bernardo Ezequiel Contreras wrote:
>> > the symbolic link works in my pc. did you restart the image after
>> > creating the link? or maybe the link is in the wrong place?
>>
>> Ok, I'll be a little more precise:
>>
>> The libsqlite3.so file is located in /usr/lib/
>> My pharo vm is located in ~/lib-perso/pharo3.0/
>>
>> What I did is:
>> ln -s /usr/lib/sqlite3.so ~/lib-perso/pharo3.0/bin/sqlite3.so
>>
>> Then I restarted the VM as you said but the error still appear when I
>> tried the code I c/c in the first mail.
>>
>> Then I realized that  /usr/lib/sqlite3.so is a symbolic link that point
>> on /usr/lib/libsqlite3.so.0.8.6 so to be sure it wasn't just that, I
>> tried the following commands:
>>
>> rm ~/lib-perso/pharo3.0/bin/sqlite3.so
>> ln -s /usr/lib/libsqlite3.so.0.8.6 ~/lib-perso/pharo3.0/bin/sqlite3.so
>>
>> The error still appear, I'm really confused.
>>
>>
>



--
Bernardo E.C.

Sent from a cheap desktop computer in South America.

Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

Ben Coman
is there a tool that will tell you if a particular library file is 32 or 64 bit?

On Sun, Mar 1, 2015 at 7:44 AM, Bernardo Ezequiel Contreras <[hidden email]> wrote:
Julien,
 the symbolic link should be libsqlite3.so not sqlite3.so.

for example
ln -s /usr/lib/i386-linux-gnu/libsqlite3.so.0 libsqlite3.so




On Sat, Feb 28, 2015 at 7:47 PM, [hidden email] <[hidden email]> wrote:
> I have it working on CentOS.
>
> So it is possible to have it working on Linux.
>
> Is your lib 32 bits?
>
> Also beware of the finalize in the sqlite library in Pharo as it has a bug.
>
> I've had to remove the finalize method and handle connections properly on my
> own with ensure:
>
> NBSqlite also exists.
>
> Phil
>
> Le 28 févr. 2015 23:12, "Julien Delplanque" <[hidden email]> a écrit :
>
>> First, thanks to take time to answer me.
>>
>> On 28/02/15 22:50, Bernardo Ezequiel Contreras wrote:
>> > the symbolic link works in my pc. did you restart the image after
>> > creating the link? or maybe the link is in the wrong place?
>>
>> Ok, I'll be a little more precise:
>>
>> The libsqlite3.so file is located in /usr/lib/
>> My pharo vm is located in ~/lib-perso/pharo3.0/
>>
>> What I did is:
>> ln -s /usr/lib/sqlite3.so ~/lib-perso/pharo3.0/bin/sqlite3.so
>>
>> Then I restarted the VM as you said but the error still appear when I
>> tried the code I c/c in the first mail.
>>
>> Then I realized that  /usr/lib/sqlite3.so is a symbolic link that point
>> on /usr/lib/libsqlite3.so.0.8.6 so to be sure it wasn't just that, I
>> tried the following commands:
>>
>> rm ~/lib-perso/pharo3.0/bin/sqlite3.so
>> ln -s /usr/lib/libsqlite3.so.0.8.6 ~/lib-perso/pharo3.0/bin/sqlite3.so
>>
>> The error still appear, I'm really confused.
>>
>>
>



--
Bernardo E.C.

Sent from a cheap desktop computer in South America.


Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

vonbecmann
maybe

https://sourceware.org/binutils/docs/binutils/readelf.html

for example
readelf -h libsqlite3.so


On Sat, Feb 28, 2015 at 9:16 PM, Ben Coman <[hidden email]> wrote:
is there a tool that will tell you if a particular library file is 32 or 64 bit?

On Sun, Mar 1, 2015 at 7:44 AM, Bernardo Ezequiel Contreras <[hidden email]> wrote:
Julien,
 the symbolic link should be libsqlite3.so not sqlite3.so.

for example
ln -s /usr/lib/i386-linux-gnu/libsqlite3.so.0 libsqlite3.so




On Sat, Feb 28, 2015 at 7:47 PM, [hidden email] <[hidden email]> wrote:
> I have it working on CentOS.
>
> So it is possible to have it working on Linux.
>
> Is your lib 32 bits?
>
> Also beware of the finalize in the sqlite library in Pharo as it has a bug.
>
> I've had to remove the finalize method and handle connections properly on my
> own with ensure:
>
> NBSqlite also exists.
>
> Phil
>
> Le 28 févr. 2015 23:12, "Julien Delplanque" <[hidden email]> a écrit :
>
>> First, thanks to take time to answer me.
>>
>> On 28/02/15 22:50, Bernardo Ezequiel Contreras wrote:
>> > the symbolic link works in my pc. did you restart the image after
>> > creating the link? or maybe the link is in the wrong place?
>>
>> Ok, I'll be a little more precise:
>>
>> The libsqlite3.so file is located in /usr/lib/
>> My pharo vm is located in ~/lib-perso/pharo3.0/
>>
>> What I did is:
>> ln -s /usr/lib/sqlite3.so ~/lib-perso/pharo3.0/bin/sqlite3.so
>>
>> Then I restarted the VM as you said but the error still appear when I
>> tried the code I c/c in the first mail.
>>
>> Then I realized that  /usr/lib/sqlite3.so is a symbolic link that point
>> on /usr/lib/libsqlite3.so.0.8.6 so to be sure it wasn't just that, I
>> tried the following commands:
>>
>> rm ~/lib-perso/pharo3.0/bin/sqlite3.so
>> ln -s /usr/lib/libsqlite3.so.0.8.6 ~/lib-perso/pharo3.0/bin/sqlite3.so
>>
>> The error still appear, I'm really confused.
>>
>>
>



--
Bernardo E.C.

Sent from a cheap desktop computer in South America.





--
Bernardo E.C.

Sent from a cheap desktop computer in South America.
Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

Julien Delplanque
Ok, first of all I made a mistake in my description, the file in the
pharo vm's "bin" directory was well named libsqlite3.so.

The problem seems to be that /usr/lib/libsqlite3.so.0.8.6 is a 64bits
version.

Using readelf, I get (in french sorry):

$ readelf -h /usr/lib/libsqlite3.so.0.8.6              
En-tête ELF:
  Magique:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
  Classe:                            ELF64
  Données:                          complément à 2, système à octets de
poids faible d'abord (little endian)
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  Version ABI:                       0
  Type:                              DYN (fichier objet partagé)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Adresse du point d'entrée:         0xba00
  Début des en-têtes de programme :  64 (octets dans le fichier)
  Début des en-têtes de section :    816368 (octets dans le fichier)
  Fanions:                           0x0
  Taille de cet en-tête:             64 (octets)
  Taille de l'en-tête du programme:  56 (octets)
  Nombre d'en-tête du programme:     7
  Taille des en-têtes de section:    64 (octets)
  Nombre d'en-têtes de section:      27
  Table d'indexes des chaînes d'en-tête de section: 26

I couldn't find a 32 bit version of the package in Arch repositories
(maybe I don't search well?).

So I searched on google and found a 32bit version. I just c/c it in the
pharo vm's bin directory and.... it worked!

The the problem was the version of the lib (64 vs 32bit).

Once again, thanks a lot :)

Julien



Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

Julien Delplanque
In reply to this post by vonbecmann
Also, it would be great to give more details about the installation on
Smalltalkhub (http://smalltalkhub.com/#!/~PharoExtras/NBSQLite3) and
there is absolutely no details in
http://smalltalkhub.com/#!/~TorstenBergmann/SQLite.

I think it would be great to give precisions about the version of the
lib etc

Maybe also give the exact commands to have it fully working on each
platforms?

Who do I have to contact if I want to help by writing a little bit more
about installation details?

I mean no offense, I just want to help next people that will have
troubles with that :p

Julien

Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

vonbecmann
here's Torsten Bergmann's email [hidden email]
and blogspot http://astares.blogspot.com.ar/

get it in contact with him, and you may write some helpful documentation :)

Thanks.

On Sun, Mar 1, 2015 at 5:30 AM, Julien Delplanque <[hidden email]> wrote:
Also, it would be great to give more details about the installation on
Smalltalkhub (http://smalltalkhub.com/#!/~PharoExtras/NBSQLite3) and
there is absolutely no details in
http://smalltalkhub.com/#!/~TorstenBergmann/SQLite.

I think it would be great to give precisions about the version of the
lib etc

Maybe also give the exact commands to have it fully working on each
platforms?

Who do I have to contact if I want to help by writing a little bit more
about installation details?

I mean no offense, I just want to help next people that will have
troubles with that :p

Julien




--
Bernardo E.C.

Sent from a cheap desktop computer in South America.
Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

philippeback
In reply to this post by Julien Delplanque
You are welcome.

I tried to load the tests for the SQLite3 configuration but there was
an issue there.

I fixed the configuration in the Metarepo for 3.0

Now

(ConfigurationOfSQLite3 project version: #stable) load: 'Tests'

works.

I am using

sudo yum install sqlite.i686

to load sqlite3 in my CentOS linux.

Then I've copied the lib from /usr/lib into the pharo-vm/ folder and made a:

ln -s libsqlite3.so.0.8.6 libsqlite3

The 'sqlite3' name is in SqliteLibrary>>moduleName


Phil


On Sun, Mar 1, 2015 at 9:04 AM, Julien Delplanque <[hidden email]> wrote:

> Ok, first of all I made a mistake in my description, the file in the
> pharo vm's "bin" directory was well named libsqlite3.so.
>
> The problem seems to be that /usr/lib/libsqlite3.so.0.8.6 is a 64bits
> version.
>
> Using readelf, I get (in french sorry):
>
> $ readelf -h /usr/lib/libsqlite3.so.0.8.6
> En-tête ELF:
>   Magique:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
>   Classe:                            ELF64
>   Données:                          complément à 2, système à octets de
> poids faible d'abord (little endian)
>   Version:                           1 (current)
>   OS/ABI:                            UNIX - System V
>   Version ABI:                       0
>   Type:                              DYN (fichier objet partagé)
>   Machine:                           Advanced Micro Devices X86-64
>   Version:                           0x1
>   Adresse du point d'entrée:         0xba00
>   Début des en-têtes de programme :  64 (octets dans le fichier)
>   Début des en-têtes de section :    816368 (octets dans le fichier)
>   Fanions:                           0x0
>   Taille de cet en-tête:             64 (octets)
>   Taille de l'en-tête du programme:  56 (octets)
>   Nombre d'en-tête du programme:     7
>   Taille des en-têtes de section:    64 (octets)
>   Nombre d'en-têtes de section:      27
>   Table d'indexes des chaînes d'en-tête de section: 26
>
> I couldn't find a 32 bit version of the package in Arch repositories
> (maybe I don't search well?).
>
> So I searched on google and found a 32bit version. I just c/c it in the
> pharo vm's bin directory and.... it worked!
>
> The the problem was the version of the lib (64 vs 32bit).
>
> Once again, thanks a lot :)
>
> Julien
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: SQLite3 - External module not found

philippeback
In reply to this post by vonbecmann
I've got a project using SQLite3 that I wanted to work on again.

FWIW, I got smashed by a bug in the current SQLite3 code.

The SQLiteconnection>>finalize method is wrong, as the self close in
there has the following code:

finalize
  self close.

close

self unregister.
self isOpen ifTrue: [SqliteLibrary default close: reference].
reference := nil.

#unregister is

unregister
self class registry remove: self ifAbsent: []

But, thing is that if close is called in finalize,  is looking for
reference, but reference is invalid because the object is not valid
anymore.

So, it appears to work and at one point (after, say, a number of
execution of statements), the gc will kick in and try to finalize and
the vm will bomb because te reference passed to SqliteLibrary default
close: will just be something weird.

A fix is to:

* first get rid of the finalize method (One can just rename it to
finalize_dont in order to not lose it just in case
* modify open
open
reference := SqliteLibrary default open: fileName.
self flag: #TODO. "This is fucked up"
"self register."

* modify close
close
self flag: #TODO. "This is fucked up. Fix it."
"self unregister."
self isOpen ifTrue: [SqliteLibrary default close: reference].
reference := nil.

To get a connection:

sqliteDb

^ db ifNil: [
db := SQLiteConnection fileNamed: (FileSystem disk workingDirectory /
'datasources' / 'data.db') fullName.
]


Do a query:

| result |
result := self sqliteDb execute: 'SELECT * FROM question LIMIT ?'
args: {aRowCount}.
^result.

or

self sqliteDb execute: 'SELECT * FROM writtenquestion LIMIT ?' args:
{aRowCount} do: aBlock.


HTH
Phil














On Sun, Mar 1, 2015 at 2:10 PM, Bernardo Ezequiel Contreras
<[hidden email]> wrote:

> here's Torsten Bergmann's email [hidden email]
> and blogspot http://astares.blogspot.com.ar/
>
> get it in contact with him, and you may write some helpful documentation :)
>
> Thanks.
>
> On Sun, Mar 1, 2015 at 5:30 AM, Julien Delplanque <[hidden email]> wrote:
>>
>> Also, it would be great to give more details about the installation on
>> Smalltalkhub (http://smalltalkhub.com/#!/~PharoExtras/NBSQLite3) and
>> there is absolutely no details in
>> http://smalltalkhub.com/#!/~TorstenBergmann/SQLite.
>>
>> I think it would be great to give precisions about the version of the
>> lib etc
>>
>> Maybe also give the exact commands to have it fully working on each
>> platforms?
>>
>> Who do I have to contact if I want to help by writing a little bit more
>> about installation details?
>>
>> I mean no offense, I just want to help next people that will have
>> troubles with that :p
>>
>> Julien
>>
>
>
>
> --
> Bernardo E.C.
>
> Sent from a cheap desktop computer in South America.