Problems compiling FTS5 extension

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

Problems compiling FTS5 extension

Eugene Mirotin
In short the error I get is
fts5_storage.c:305:9: error: 'sqlite3_api_routines' has no member named
'__builtin___snprintf_chk'

More details in SO question here:
https://stackoverflow.com/questions/46793988/sqlite-trouble-building-fts5-loadable-extension,
please let me know if I should paste everything in my email.

I've seen a similar problem reported before and somehow related to XCode,
but that issue was reported to be fixed.

Would be thankful for any tips, I haven't used C for years and have no idea
where to start.

To clarify my goal I need the standalone loadable extension to use with
embedded SQLite in my Node.js project.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Problems compiling FTS5 extension

Dan Kennedy-4
On 10/18/2017 06:32 PM, Eugene Mirotin wrote:

> In short the error I get is
> fts5_storage.c:305:9: error: 'sqlite3_api_routines' has no member named
> '__builtin___snprintf_chk'
>
> More details in SO question here:
> https://stackoverflow.com/questions/46793988/sqlite-trouble-building-fts5-loadable-extension,
> please let me know if I should paste everything in my email.
>
> I've seen a similar problem reported before and somehow related to XCode,
> but that issue was reported to be fixed.
>
> Would be thankful for any tips, I haven't used C for years and have no idea
> where to start.

Please try with the latest trunk checkin:

   http://www.sqlite.org/src/info/cd0471ca9f75e7c8

(click the "ZIP archive" link to download if you're not using fossil)

To generate the sqlite3ext.h and sqlite3.h files required when compiling
fts5.c, run [make sqlite3.h sqlite3ext.h]. So, altogether, something like:

   ./configure
   make fts5.c sqlite3.h sqlite3ext.h
   gcc -O2 -fPIC -shared fts5.c -o fts5.dylib

Or, if you want to use a released version, after [make sqlite3ext.h]
replace the two instances of "snprintf" in the sqlite3ext.h with
"xsnprintf".

Dan.




_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Problems compiling FTS5 extension

Eugene Mirotin
Thanks a lot Dan, that worked!
I'm fine with the trunk version for now but hope to see this in stable
eventually as I'll have to later build this extension for various platforms
for the release of my app.
Thanks again for the quick fix

On Wed, Oct 18, 2017 at 6:06 PM Dan Kennedy <[hidden email]> wrote:

> On 10/18/2017 06:32 PM, Eugene Mirotin wrote:
> > In short the error I get is
> > fts5_storage.c:305:9: error: 'sqlite3_api_routines' has no member named
> > '__builtin___snprintf_chk'
> >
> > More details in SO question here:
> >
> https://stackoverflow.com/questions/46793988/sqlite-trouble-building-fts5-loadable-extension
> ,
> > please let me know if I should paste everything in my email.
> >
> > I've seen a similar problem reported before and somehow related to XCode,
> > but that issue was reported to be fixed.
> >
> > Would be thankful for any tips, I haven't used C for years and have no
> idea
> > where to start.
>
> Please try with the latest trunk checkin:
>
>    http://www.sqlite.org/src/info/cd0471ca9f75e7c8
>
> (click the "ZIP archive" link to download if you're not using fossil)
>
> To generate the sqlite3ext.h and sqlite3.h files required when compiling
> fts5.c, run [make sqlite3.h sqlite3ext.h]. So, altogether, something like:
>
>    ./configure
>    make fts5.c sqlite3.h sqlite3ext.h
>    gcc -O2 -fPIC -shared fts5.c -o fts5.dylib
>
> Or, if you want to use a released version, after [make sqlite3ext.h]
> replace the two instances of "snprintf" in the sqlite3ext.h with
> "xsnprintf".
>
> Dan.
>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Problems compiling FTS5 extension

Eugene Mirotin
Well, now I have troubles loading this extension.

I've built another one before, fts5stemmer.

When using the CLI sqlite3 (version 3.20.1 from MacPorts):

❯ sqlite3
SQLite version 3.20.1 2017-08-24 16:21:36
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .load './fts5.dylib'
Error: error during initialization:
sqlite> .load './fts5stemmer.dylib'
[1]    35952 segmentation fault  sqlite3

When using the GUI DB Browser for SQLite:
fts5 extension reports the same error "Error: error during initialization:"
fst5stemmer loads fine (or at least reports to)

On Thu, Oct 19, 2017 at 3:09 PM Eugene Mirotin <[hidden email]> wrote:

> Thanks a lot Dan, that worked!
> I'm fine with the trunk version for now but hope to see this in stable
> eventually as I'll have to later build this extension for various platforms
> for the release of my app.
> Thanks again for the quick fix
>
> On Wed, Oct 18, 2017 at 6:06 PM Dan Kennedy <[hidden email]> wrote:
>
>> On 10/18/2017 06:32 PM, Eugene Mirotin wrote:
>> > In short the error I get is
>> > fts5_storage.c:305:9: error: 'sqlite3_api_routines' has no member named
>> > '__builtin___snprintf_chk'
>> >
>> > More details in SO question here:
>> >
>> https://stackoverflow.com/questions/46793988/sqlite-trouble-building-fts5-loadable-extension
>> ,
>> > please let me know if I should paste everything in my email.
>> >
>> > I've seen a similar problem reported before and somehow related to
>> XCode,
>> > but that issue was reported to be fixed.
>> >
>> > Would be thankful for any tips, I haven't used C for years and have no
>> idea
>> > where to start.
>>
>> Please try with the latest trunk checkin:
>>
>>    http://www.sqlite.org/src/info/cd0471ca9f75e7c8
>>
>> (click the "ZIP archive" link to download if you're not using fossil)
>>
>> To generate the sqlite3ext.h and sqlite3.h files required when compiling
>> fts5.c, run [make sqlite3.h sqlite3ext.h]. So, altogether, something like:
>>
>>    ./configure
>>    make fts5.c sqlite3.h sqlite3ext.h
>>    gcc -O2 -fPIC -shared fts5.c -o fts5.dylib
>>
>> Or, if you want to use a released version, after [make sqlite3ext.h]
>> replace the two instances of "snprintf" in the sqlite3ext.h with
>> "xsnprintf".
>>
>> Dan.
>>
>>
>>
>>
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email]
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Problems compiling FTS5 extension

Eugene Mirotin
Hm, I think that's because the extension is already preloaded with my
version if sqlite. Which means I didn't even have to build it :)
But now is the question how would I reliably load / not load it in
production env if the target user may or may not have sqlite precompiled
with it?

On Thu, Oct 19, 2017 at 3:30 PM Eugene Mirotin <[hidden email]> wrote:

> Well, now I have troubles loading this extension.
>
> I've built another one before, fts5stemmer.
>
> When using the CLI sqlite3 (version 3.20.1 from MacPorts):
>
> ❯ sqlite3
> SQLite version 3.20.1 2017-08-24 16:21:36
> Enter ".help" for usage hints.
> Connected to a transient in-memory database.
> Use ".open FILENAME" to reopen on a persistent database.
> sqlite> .load './fts5.dylib'
> Error: error during initialization:
> sqlite> .load './fts5stemmer.dylib'
> [1]    35952 segmentation fault  sqlite3
>
> When using the GUI DB Browser for SQLite:
> fts5 extension reports the same error "Error: error during initialization:"
> fst5stemmer loads fine (or at least reports to)
>
> On Thu, Oct 19, 2017 at 3:09 PM Eugene Mirotin <[hidden email]> wrote:
>
>> Thanks a lot Dan, that worked!
>> I'm fine with the trunk version for now but hope to see this in stable
>> eventually as I'll have to later build this extension for various platforms
>> for the release of my app.
>> Thanks again for the quick fix
>>
>> On Wed, Oct 18, 2017 at 6:06 PM Dan Kennedy <[hidden email]>
>> wrote:
>>
>>> On 10/18/2017 06:32 PM, Eugene Mirotin wrote:
>>> > In short the error I get is
>>> > fts5_storage.c:305:9: error: 'sqlite3_api_routines' has no member named
>>> > '__builtin___snprintf_chk'
>>> >
>>> > More details in SO question here:
>>> >
>>> https://stackoverflow.com/questions/46793988/sqlite-trouble-building-fts5-loadable-extension
>>> ,
>>> > please let me know if I should paste everything in my email.
>>> >
>>> > I've seen a similar problem reported before and somehow related to
>>> XCode,
>>> > but that issue was reported to be fixed.
>>> >
>>> > Would be thankful for any tips, I haven't used C for years and have no
>>> idea
>>> > where to start.
>>>
>>> Please try with the latest trunk checkin:
>>>
>>>    http://www.sqlite.org/src/info/cd0471ca9f75e7c8
>>>
>>> (click the "ZIP archive" link to download if you're not using fossil)
>>>
>>> To generate the sqlite3ext.h and sqlite3.h files required when compiling
>>> fts5.c, run [make sqlite3.h sqlite3ext.h]. So, altogether, something
>>> like:
>>>
>>>    ./configure
>>>    make fts5.c sqlite3.h sqlite3ext.h
>>>    gcc -O2 -fPIC -shared fts5.c -o fts5.dylib
>>>
>>> Or, if you want to use a released version, after [make sqlite3ext.h]
>>> replace the two instances of "snprintf" in the sqlite3ext.h with
>>> "xsnprintf".
>>>
>>> Dan.
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> sqlite-users mailing list
>>> [hidden email]
>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>>
>>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Problems compiling FTS5 extension

Dan Kennedy-4
On 10/19/2017 08:40 PM, Eugene Mirotin wrote:
> Hm, I think that's because the extension is already preloaded with my
> version if sqlite. Which means I didn't even have to build it :)
> But now is the question how would I reliably load / not load it in
> production env if the target user may or may not have sqlite precompiled
> with it?

Right, it's an error to try to register a new version of a module -
"fts5" in this case - that has already been registered.

You could just assume that if the attempt to load fts5 dynamically fails
it is already registered. Or you could try preparing the statement
"SELECT fts5_source_id()" before loading the extension. If preparing the
statement succeeds, fts5 is already present and you don't need to load it.

Don't know why you might be getting the segfault.

Dan.


>
> On Thu, Oct 19, 2017 at 3:30 PM Eugene Mirotin <[hidden email]> wrote:
>
>> Well, now I have troubles loading this extension.
>>
>> I've built another one before, fts5stemmer.
>>
>> When using the CLI sqlite3 (version 3.20.1 from MacPorts):
>>
>> ❯ sqlite3
>> SQLite version 3.20.1 2017-08-24 16:21:36
>> Enter ".help" for usage hints.
>> Connected to a transient in-memory database.
>> Use ".open FILENAME" to reopen on a persistent database.
>> sqlite> .load './fts5.dylib'
>> Error: error during initialization:
>> sqlite> .load './fts5stemmer.dylib'
>> [1]    35952 segmentation fault  sqlite3
>>
>> When using the GUI DB Browser for SQLite:
>> fts5 extension reports the same error "Error: error during initialization:"
>> fst5stemmer loads fine (or at least reports to)
>>
>> On Thu, Oct 19, 2017 at 3:09 PM Eugene Mirotin <[hidden email]> wrote:
>>
>>> Thanks a lot Dan, that worked!
>>> I'm fine with the trunk version for now but hope to see this in stable
>>> eventually as I'll have to later build this extension for various platforms
>>> for the release of my app.
>>> Thanks again for the quick fix
>>>
>>> On Wed, Oct 18, 2017 at 6:06 PM Dan Kennedy <[hidden email]>
>>> wrote:
>>>
>>>> On 10/18/2017 06:32 PM, Eugene Mirotin wrote:
>>>>> In short the error I get is
>>>>> fts5_storage.c:305:9: error: 'sqlite3_api_routines' has no member named
>>>>> '__builtin___snprintf_chk'
>>>>>
>>>>> More details in SO question here:
>>>>>
>>>> https://stackoverflow.com/questions/46793988/sqlite-trouble-building-fts5-loadable-extension
>>>> ,
>>>>> please let me know if I should paste everything in my email.
>>>>>
>>>>> I've seen a similar problem reported before and somehow related to
>>>> XCode,
>>>>> but that issue was reported to be fixed.
>>>>>
>>>>> Would be thankful for any tips, I haven't used C for years and have no
>>>> idea
>>>>> where to start.
>>>> Please try with the latest trunk checkin:
>>>>
>>>>     http://www.sqlite.org/src/info/cd0471ca9f75e7c8
>>>>
>>>> (click the "ZIP archive" link to download if you're not using fossil)
>>>>
>>>> To generate the sqlite3ext.h and sqlite3.h files required when compiling
>>>> fts5.c, run [make sqlite3.h sqlite3ext.h]. So, altogether, something
>>>> like:
>>>>
>>>>     ./configure
>>>>     make fts5.c sqlite3.h sqlite3ext.h
>>>>     gcc -O2 -fPIC -shared fts5.c -o fts5.dylib
>>>>
>>>> Or, if you want to use a released version, after [make sqlite3ext.h]
>>>> replace the two instances of "snprintf" in the sqlite3ext.h with
>>>> "xsnprintf".
>>>>
>>>> Dan.
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> sqlite-users mailing list
>>>> [hidden email]
>>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>>>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Problems compiling FTS5 extension

Eugene Mirotin
Thanks for the tips!

Don't know about the segfault too but can ignore it for now — this same
file works well with the GUI app and with my Node.js program.

On Thu, Oct 19, 2017 at 6:38 PM Dan Kennedy <[hidden email]> wrote:

> On 10/19/2017 08:40 PM, Eugene Mirotin wrote:
> > Hm, I think that's because the extension is already preloaded with my
> > version if sqlite. Which means I didn't even have to build it :)
> > But now is the question how would I reliably load / not load it in
> > production env if the target user may or may not have sqlite precompiled
> > with it?
>
> Right, it's an error to try to register a new version of a module -
> "fts5" in this case - that has already been registered.
>
> You could just assume that if the attempt to load fts5 dynamically fails
> it is already registered. Or you could try preparing the statement
> "SELECT fts5_source_id()" before loading the extension. If preparing the
> statement succeeds, fts5 is already present and you don't need to load it.
>
> Don't know why you might be getting the segfault.
>
> Dan.
>
>
> >
> > On Thu, Oct 19, 2017 at 3:30 PM Eugene Mirotin <[hidden email]>
> wrote:
> >
> >> Well, now I have troubles loading this extension.
> >>
> >> I've built another one before, fts5stemmer.
> >>
> >> When using the CLI sqlite3 (version 3.20.1 from MacPorts):
> >>
> >> ❯ sqlite3
> >> SQLite version 3.20.1 2017-08-24 16:21:36
> >> Enter ".help" for usage hints.
> >> Connected to a transient in-memory database.
> >> Use ".open FILENAME" to reopen on a persistent database.
> >> sqlite> .load './fts5.dylib'
> >> Error: error during initialization:
> >> sqlite> .load './fts5stemmer.dylib'
> >> [1]    35952 segmentation fault  sqlite3
> >>
> >> When using the GUI DB Browser for SQLite:
> >> fts5 extension reports the same error "Error: error during
> initialization:"
> >> fst5stemmer loads fine (or at least reports to)
> >>
> >> On Thu, Oct 19, 2017 at 3:09 PM Eugene Mirotin <[hidden email]>
> wrote:
> >>
> >>> Thanks a lot Dan, that worked!
> >>> I'm fine with the trunk version for now but hope to see this in stable
> >>> eventually as I'll have to later build this extension for various
> platforms
> >>> for the release of my app.
> >>> Thanks again for the quick fix
> >>>
> >>> On Wed, Oct 18, 2017 at 6:06 PM Dan Kennedy <[hidden email]>
> >>> wrote:
> >>>
> >>>> On 10/18/2017 06:32 PM, Eugene Mirotin wrote:
> >>>>> In short the error I get is
> >>>>> fts5_storage.c:305:9: error: 'sqlite3_api_routines' has no member
> named
> >>>>> '__builtin___snprintf_chk'
> >>>>>
> >>>>> More details in SO question here:
> >>>>>
> >>>>
> https://stackoverflow.com/questions/46793988/sqlite-trouble-building-fts5-loadable-extension
> >>>> ,
> >>>>> please let me know if I should paste everything in my email.
> >>>>>
> >>>>> I've seen a similar problem reported before and somehow related to
> >>>> XCode,
> >>>>> but that issue was reported to be fixed.
> >>>>>
> >>>>> Would be thankful for any tips, I haven't used C for years and have
> no
> >>>> idea
> >>>>> where to start.
> >>>> Please try with the latest trunk checkin:
> >>>>
> >>>>     http://www.sqlite.org/src/info/cd0471ca9f75e7c8
> >>>>
> >>>> (click the "ZIP archive" link to download if you're not using fossil)
> >>>>
> >>>> To generate the sqlite3ext.h and sqlite3.h files required when
> compiling
> >>>> fts5.c, run [make sqlite3.h sqlite3ext.h]. So, altogether, something
> >>>> like:
> >>>>
> >>>>     ./configure
> >>>>     make fts5.c sqlite3.h sqlite3ext.h
> >>>>     gcc -O2 -fPIC -shared fts5.c -o fts5.dylib
> >>>>
> >>>> Or, if you want to use a released version, after [make sqlite3ext.h]
> >>>> replace the two instances of "snprintf" in the sqlite3ext.h with
> >>>> "xsnprintf".
> >>>>
> >>>> Dan.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> sqlite-users mailing list
> >>>> [hidden email]
> >>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >>>>
> > _______________________________________________
> > sqlite-users mailing list
> > [hidden email]
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users