Issue using SEE

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

Issue using SEE

Kumar_xam
Hi Team,

We have recently purchased SEE subscription to encrypt our data in mobile.
Our application supports iOS, android and windows(UWP).  We used Xamarin
forms(.net standard2) approach to build this application which supports c#
language. We are following this link
https://www.sqlite.org/see/doc/trunk/www/readme.wiki where they have guided
how to compile and use SEE.

Basically we are trying to use this SQLITE as a dll and to do so we ran
below command in mac

    cat sqlite3.c see.c >see-sqlite3.c

    gcc -c -DSQLITE_DLL=1 see-sqlite3.c

    ar a see-sqlite3.dll see-sqlite3.o





This generates “see-sqlite3.dll” but for some reason when I am trying to
add this dll as a reference its throwing error "see-sqlite3.dll is not a
valid .Net assembly ".

Any help will be really appreciated.
_______________________________________________
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: Issue using SEE

Keith Medcalf

Firstly, the SQLITE_DLL define does not exist (is this a bug in the docs>?
Secondly you did not define SQLITE_HAS_CODEC as required to integrate the SEE codec/
Thirdly a .dll file cannot be created with ar.  ar is for creating libraries, not DLLs. (.a files)

To statically link you should just add the see_sqlite3.c file to your project making sure you define SQLITE_HAS_CODEC

Or do you really want a dynamically linked DLL?

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>[hidden email]] On Behalf Of sudeep singh
>Sent: Friday, 20 July, 2018 11:52
>To: [hidden email]
>Subject: [sqlite] Issue using SEE
>
>Hi Team,
>
>We have recently purchased SEE subscription to encrypt our data in
>mobile.
>Our application supports iOS, android and windows(UWP).  We used
>Xamarin
>forms(.net standard2) approach to build this application which
>supports c#
>language. We are following this link
>https://www.sqlite.org/see/doc/trunk/www/readme.wiki where they have
>guided
>how to compile and use SEE.
>
>Basically we are trying to use this SQLITE as a dll and to do so we
>ran
>below command in mac
>
>    cat sqlite3.c see.c >see-sqlite3.c
>
>    gcc -c -DSQLITE_DLL=1 see-sqlite3.c
>
>    ar a see-sqlite3.dll see-sqlite3.o
>
>
>
>
>
>This generates “see-sqlite3.dll” but for some reason when I am trying
>to
>add this dll as a reference its throwing error "see-sqlite3.dll is
>not a
>valid .Net assembly ".
>
>Any help will be really appreciated.
>_______________________________________________
>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: Issue using SEE

J Decker
On Fri, Jul 20, 2018 at 11:05 AM Keith Medcalf <[hidden email]> wrote:

>
> Firstly, the SQLITE_DLL define does not exist (is this a bug in the docs>?
> Secondly you did not define SQLITE_HAS_CODEC as required to integrate the
> SEE codec/
> Thirdly a .dll file cannot be created with ar.  ar is for creating
> libraries, not DLLs. (.a files)
>
> To statically link you should just add the see_sqlite3.c file to your
> project making sure you define SQLITE_HAS_CODEC
>
> Or do you really want a dynamically linked DLL?
>
It would be a dll... but you missed the more mportant point

This generates “see-sqlite3.dll” but for some reason when I am trying to
add this dll as a reference its throwing error "see-sqlite3.dll is not a
valid .Net assembly ".

that it needs to be built as system.data.sqlite is.... not just a dll.


>
> ---
> The fact that there's a Highway to Hell but only a Stairway to Heaven says
> a lot about anticipated traffic volume.
>
>
> >-----Original Message-----
> >From: sqlite-users [mailto:sqlite-users-
> >[hidden email]] On Behalf Of sudeep singh
> >Sent: Friday, 20 July, 2018 11:52
> >To: [hidden email]
> >Subject: [sqlite] Issue using SEE
> >
> >Hi Team,
> >
> >We have recently purchased SEE subscription to encrypt our data in
> >mobile.
> >Our application supports iOS, android and windows(UWP).  We used
> >Xamarin
> >forms(.net standard2) approach to build this application which
> >supports c#
> >language. We are following this link
> >https://www.sqlite.org/see/doc/trunk/www/readme.wiki where they have
> >guided
> >how to compile and use SEE.
> >
> >Basically we are trying to use this SQLITE as a dll and to do so we
> >ran
> >below command in mac
> >
> >    cat sqlite3.c see.c >see-sqlite3.c
> >
> >    gcc -c -DSQLITE_DLL=1 see-sqlite3.c
> >
> >    ar a see-sqlite3.dll see-sqlite3.o
> >
> >
> >
> >
> >
> >This generates “see-sqlite3.dll” but for some reason when I am trying
> >to
> >add this dll as a reference its throwing error "see-sqlite3.dll is
> >not a
> >valid .Net assembly ".
> >
> >Any help will be really appreciated.
> >_______________________________________________
> >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: Issue using SEE

Kumar_xam
In reply to this post by Keith Medcalf
Yes I am trying to create a dll so that I can add it as reference in my
project. Is there any way to do that?



On Fri, Jul 20, 2018 at 11:05 AM, Keith Medcalf <[hidden email]> wrote:

>
> Firstly, the SQLITE_DLL define does not exist (is this a bug in the docs>?
> Secondly you did not define SQLITE_HAS_CODEC as required to integrate the
> SEE codec/
> Thirdly a .dll file cannot be created with ar.  ar is for creating
> libraries, not DLLs. (.a files)
>
> To statically link you should just add the see_sqlite3.c file to your
> project making sure you define SQLITE_HAS_CODEC
>
> Or do you really want a dynamically linked DLL?
>
> ---
> The fact that there's a Highway to Hell but only a Stairway to Heaven says
> a lot about anticipated traffic volume.
>
>
> >-----Original Message-----
> >From: sqlite-users [mailto:sqlite-users-
> >[hidden email]] On Behalf Of sudeep singh
> >Sent: Friday, 20 July, 2018 11:52
> >To: [hidden email]
> >Subject: [sqlite] Issue using SEE
> >
> >Hi Team,
> >
> >We have recently purchased SEE subscription to encrypt our data in
> >mobile.
> >Our application supports iOS, android and windows(UWP).  We used
> >Xamarin
> >forms(.net standard2) approach to build this application which
> >supports c#
> >language. We are following this link
> >https://www.sqlite.org/see/doc/trunk/www/readme.wiki where they have
> >guided
> >how to compile and use SEE.
> >
> >Basically we are trying to use this SQLITE as a dll and to do so we
> >ran
> >below command in mac
> >
> >    cat sqlite3.c see.c >see-sqlite3.c
> >
> >    gcc -c -DSQLITE_DLL=1 see-sqlite3.c
> >
> >    ar a see-sqlite3.dll see-sqlite3.o
> >
> >
> >
> >
> >
> >This generates “see-sqlite3.dll” but for some reason when I am trying
> >to
> >add this dll as a reference its throwing error "see-sqlite3.dll is
> >not a
> >valid .Net assembly ".
> >
> >Any help will be really appreciated.
> >_______________________________________________
> >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: Issue using SEE

Keith Medcalf
In reply to this post by J Decker

-m64 means generate 64-bit code.  If you want 32-bit use -m32
-mwin32 means that the compilation is for windows.  If it is not for Windows, omit this.
-mdll means to compile/link as a DLL
The SQLITE_API=... define adds the necessary attribute to export the API on windows.
-mthreads tells the compiler to use threadsafe code and libraries
The SQLITE_HAS_CODEC define enables the SEE hooks
-Wl,-Bstatic tells the linker to link using the static versions of the library's
--nxcompat,--dynamicbase mean what they say and are instructions to the linker for Windows
-static-libgc tells the compiler to statically link the gcc c runtime into the DLL

gcc -m64 -s -O3 -mwin32 -pipe -mdll -Wl,-Bstatic,--nxcompat,--dynamicbase -DSQLITE_API=__declspec(dllexport) -mthreads -DSQLITE_HAS_CODEC=1 see_sqlite3x.c   -o see_sqlite3.dll -Wl,--output-def,see_sqlite3.def,--out-implib,libssee_sqlite3.dll.a -static-libgc

compiles a "C" file called "see_sqlite3.c" and creates "see_sqlite3.dll", "see_sqlite3.def", and "libsee_sqlite3.a"

lib /nologo /machine:x86 /def:see_sqlite3.def

generates a Windows .lib file from the .def file for use with Windows compilers that need the .lib format rather than the .a format libraries used by GCC.

You will get the following files:
 see_sqlite3.c -- input source code
 see_sqlite3.dll -- output dynamic link library
 see_sqlite3.lib -- output lib format library to import the dll entry points
 libsee_sqlite3.dll.a -- output a format library to create the trampolines for GCC

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>[hidden email]] On Behalf Of J Decker
>Sent: Friday, 20 July, 2018 12:13
>To: General Discussion of SQLite Database
>Subject: Re: [sqlite] Issue using SEE
>
>On Fri, Jul 20, 2018 at 11:05 AM Keith Medcalf <[hidden email]>
>wrote:
>
>>
>> Firstly, the SQLITE_DLL define does not exist (is this a bug in the
>docs>?
>> Secondly you did not define SQLITE_HAS_CODEC as required to
>integrate the
>> SEE codec/
>> Thirdly a .dll file cannot be created with ar.  ar is for creating
>> libraries, not DLLs. (.a files)
>>
>> To statically link you should just add the see_sqlite3.c file to
>your
>> project making sure you define SQLITE_HAS_CODEC
>>
>> Or do you really want a dynamically linked DLL?
>>
>It would be a dll... but you missed the more mportant point
>
>This generates “see-sqlite3.dll” but for some reason when I am trying
>to
>add this dll as a reference its throwing error "see-sqlite3.dll is
>not a
>valid .Net assembly ".
>
>that it needs to be built as system.data.sqlite is.... not just a
>dll.
>
>
>>
>> ---
>> The fact that there's a Highway to Hell but only a Stairway to
>Heaven says
>> a lot about anticipated traffic volume.
>>
>>
>> >-----Original Message-----
>> >From: sqlite-users [mailto:sqlite-users-
>> >[hidden email]] On Behalf Of sudeep singh
>> >Sent: Friday, 20 July, 2018 11:52
>> >To: [hidden email]
>> >Subject: [sqlite] Issue using SEE
>> >
>> >Hi Team,
>> >
>> >We have recently purchased SEE subscription to encrypt our data in
>> >mobile.
>> >Our application supports iOS, android and windows(UWP).  We used
>> >Xamarin
>> >forms(.net standard2) approach to build this application which
>> >supports c#
>> >language. We are following this link
>> >https://www.sqlite.org/see/doc/trunk/www/readme.wiki where they
>have
>> >guided
>> >how to compile and use SEE.
>> >
>> >Basically we are trying to use this SQLITE as a dll and to do so
>we
>> >ran
>> >below command in mac
>> >
>> >    cat sqlite3.c see.c >see-sqlite3.c
>> >
>> >    gcc -c -DSQLITE_DLL=1 see-sqlite3.c
>> >
>> >    ar a see-sqlite3.dll see-sqlite3.o
>> >
>> >
>> >
>> >
>> >
>> >This generates “see-sqlite3.dll” but for some reason when I am
>trying
>> >to
>> >add this dll as a reference its throwing error "see-sqlite3.dll is
>> >not a
>> >valid .Net assembly ".
>> >
>> >Any help will be really appreciated.
>> >_______________________________________________
>> >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
Reply | Threaded
Open this post in threaded view
|

Re: Issue using SEE

Warren Young
In reply to this post by Kumar_xam
On Jul 20, 2018, at 11:51 AM, sudeep singh <[hidden email]> wrote:
>
> Our application supports iOS, android and windows(UWP).

Xamarin’s standard assumption is that you’re building your application with all-CLR code, which is why it’s trying to treat the DLL as a .NET assembly.  That in turn means that even once you get past the .a vs .dll problems others are helping you with, you’re still stuffed because it’s going to create a native DLL for the platform you built it on, which won’t work on the ARM CPUs in your iOS and [probably] Android devices.  And on macOS, you won’t need a DLL anyway, you’ll need a .dylib file.

I think the only way to make it work is to cross-compile the library separately for all four(!) platforms, then use Xamarin’s native code linking functions.

The fourth platform is macOS, since without a native build of the SQLite + SEE library, you won’t be able to test and debug the application on macOS.

The following thread shows one way to do it which will work for iOS and macOS, each a separate build:

    https://forums.xamarin.com/discussion/37935/native-dylib

Windows native and Android native build and linkage steps will differ.
_______________________________________________
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: Issue using SEE

Kumar_xam
Hi Team,

I have successfully created a .dylib file for macOS and now trying to
activate the library using sqlite3_activate_see("7bb07b8d471d642e"). My
question is do I need to use same activation code "7bb07b8d471d642e" or can
I use any 16 digit code.

https://www.sqlite.org/see/doc/trunk/www/readme.wiki
<https://www.sqlite.org/see/doc/trunk/www/readme.wiki>  

Thanks,
Sudeep



--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
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: Issue using SEE

Richard Hipp-3
On 7/30/18, Kumar_xam <[hidden email]> wrote:
>
> I have successfully created a .dylib file for macOS and now trying to
> activate the library using sqlite3_activate_see("7bb07b8d471d642e"). My
> question is do I need to use same activation code "7bb07b8d471d642e" or can
> I use any 16 digit code.

Please see section 5.0 of the document here:
https://www.sqlite.org/see/doc/trunk/www/readme.wiki
--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users