Re: [sqlite] Linking to SQLite with Cygwin / CMake [SOLVED]
Reid, Thanks for the help! 1) I didn't realize the catch that the .lib directory was a hidden folder 2) I wasn't using the --enable-debug and --disable-tcl flags 3) CMake is not generating a valid Makefile that links correctly =(
RE: [sqlite] Linking to SQLite with Cygwin / CMake
Kiel W. wrote: > Ok, I'm definately thinking this is just a problem with my > understanding of the build process in *nix's and the quirks of Cygwin. > > I am getting the following warning with the default Makefile that is > generated. "libtool: link: warning: undefined symbols not allowed in > i686-pc-cygwin shared libraries" > > I found that this is because Windows(r) dlls can't have undefined > symbols in them and the warning can be removed with the > following flag: > '-no-undefined'. This also generates some other information > that is not > helpful to me (probably someone else). However, this didn't seem to > produce a static library (either .a or .lib). > > I ran across the 'make sqlite3.dll' target in the make file and tried > that. It succeeded without any problems and generated a .dll. I tried > the companion 'make sqlite3.lib' and this fails because it can't find > impdef/implib/lib. > > If anyone as other suggestions, or steps to build a static lib under > Cygwin I'd appreciate it, otherwise I may just bite the > bullet and see > about going the shared libary route. > > -- Kiel download http://www.sqlite.org/sqlite-3.2.4.tar.gz $ wget http://www.sqlite.org/sqlite-3.2.4.tar.gz $ tar xvfz sqlite-3.2.4.tar.gz $ cd sqlite-3.2.4 $ ./configure $ make $ ---you can do make test here $ ls -lrt .libs total 22310 ( snip non-pertinent .o files, etc ) -rw-rw-rw- 1 Reid.Thompson Domain Users 7504336 Aug 26 13:07 libsqlite3.a -rw-rw-rw- 1 Reid.Thompson Domain Users 761 Aug 26 13:07 libsqlite3.lai lrwxrwxrwx 1 Reid.Thompson Domain Users 16 Aug 26 13:07 libsqlite3.la -> ../libsqlite3.la -rw-rw-rw- 1 Reid.Thompson Domain Users 125589 Aug 26 13:07 tclsqlite.o -rw-rw-rw- 1 Reid.Thompson Domain Users 7630154 Aug 26 13:07 libtclsqlite3.a -rw-rw-rw- 1 Reid.Thompson Domain Users 800 Aug 26 13:07 libtclsqlite3.lai lrwxrwxrwx 1 Reid.Thompson Domain Users 19 Aug 26 13:07 libtclsqlite3.la -> ../libtclsqlite3.la $ make install $ ls -lrt /usr/local/lib/*sql* -rwx--+ 1 Reid.Thompson Domain Users 758 Aug 26 2004 /usr/local/lib/libsqlite.la -rwx--+ 1 Reid.Thompson Domain Users 4952172 Aug 26 2004 /usr/local/lib/libsqlite.a -rwx--+ 1 Reid.Thompson Domain Users 282624 Mar 8 13:47 /usr/local/lib/sqlite3.dll -rwx--+ 1 Reid.Thompson Domain Users 340680 Mar 8 14:40 /usr/local/lib/libsqlite3.dll.a -rwx--+ 1 Reid.Thompson Domain Users 1148960 Mar 8 14:46 /usr/local/lib/cygsqlite3.dll -rwx--+ 1 Reid.Thompson Domain Users 761 Apr 12 11:52 /usr/local/lib/libsqlite3.la -rwx--+ 1 Reid.Thompson Domain Users 6981520 Apr 12 11:52 /usr/local/lib/libsqlite3.a reid
Re: [sqlite] Linking to SQLite with Cygwin / CMake
Ok, I'm definately thinking this is just a problem with my understanding of the build process in *nix's and the quirks of Cygwin. I am getting the following warning with the default Makefile that is generated. "libtool: link: warning: undefined symbols not allowed in i686-pc-cygwin shared libraries" I found that this is because Windows(r) dlls can't have undefined symbols in them and the warning can be removed with the following flag: '-no-undefined'. This also generates some other information that is not helpful to me (probably someone else). However, this didn't seem to produce a static library (either .a or .lib). I ran across the 'make sqlite3.dll' target in the make file and tried that. It succeeded without any problems and generated a .dll. I tried the companion 'make sqlite3.lib' and this fails because it can't find impdef/implib/lib. If anyone as other suggestions, or steps to build a static lib under Cygwin I'd appreciate it, otherwise I may just bite the bullet and see about going the shared libary route. -- Kiel
RE: [sqlite] Linking to SQLite with Cygwin / CMake
Doug Currie wrote: >> I downloaded the raw source and ran 'configure' and 'make' from a >> separate folder. The resulting output I copied to /usr/lib/sqlite. >> In it a see the bunch of .lo, .o and the two .la files >> (libsqlite3.la, libtclsqlite3.la) using cygwin ( when i built sqlite3 from the source, it used --prefix=/usr/local ) WS-XP-4960: /home/rthompso> $ gcc -Wall sqlite3tst.c -o testsqlite3 -lsqlite3 sqlite3tst.c:4: warning: unused parameter 'argc' sqlite3tst.c:4: warning: unused parameter 'argv' WS-XP-4960: /home/rthompso> $ cat sqlite3tst.c #include #include int main (int argc, char **argv) { sqlite3 *pilotLog; sqlite3_open("logbook.dat", ); sqlite3_close(pilotLog); return 0; } reid
Re: [sqlite] Linking to SQLite with Cygwin / CMake
KW> I downloaded the raw source and ran 'configure' and 'make' from a KW> separate folder. The resulting output I copied to /usr/lib/sqlite. In KW> it a see the bunch of .lo, .o and the two .la files (libsqlite3.la, KW> libtclsqlite3.la) KW> I am use to a Visual Studio build environment, but from what I KW> understand this is all I need. Please correction me if that assumption KW> is wrong. Visual Studio is not designed to use static libraries built by Cygwin. Either build the library with Visual Studio by using the preprocessed sources at http://www.sqlite.org/sqlite-source-3_2_4.zip Or build the library with Cygwin and use Cygwin for your own code as well. KW> I'm unsure what direction to go at this point and would appreciate any KW> guidance - whether it is a complete change of direction or not. I would KW> rather not use a .dll because I don't want my code to have to handle the KW> loading; I may change this later or if it is the recommendation of those KW> wiser =) With DLLs at least you can share between Cygwin and Visual Studio (although you have to build a .lib file for VS to be happy). However there is no reason you can't either use a static library as described above, or simply include the sqlite source code in your project. See http://www.sqlite.org/cvstrac/wiki?p=HowToCompile for more hints. e
Re: [sqlite] Linking to SQLite with Cygwin / CMake
Jay Sprenkle wrote: undefined reference at link time is usually a missing library. I think you're using linux? I'm actually Cgywin is a linux emulation layer.. from their site: "Cygwin is a Linux-like environment for Windows. It consists of two parts: A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality. A collection of tools, which provide Linux look and feel." So you are partly correct. It doesn't appear I have 'ldconfig' in Cygwin.Perhaps this is the root of my problem but I don't believe so. Am I correct in saying I would NOT get this error if it was simply a matter of mixing debug and release information?
Re: [sqlite] Linking to SQLite with Cygwin / CMake
On 8/24/05, Kiel Wadner <[EMAIL PROTECTED]> wrote: > This is almost a general programming question, but any help would be > appreciated. > > Root Problem: > /home/kiel/development/omms/output/libdbWrapper.a(dbwrapper.o): In > function `_ZN3srs9DbWrapper4openERKSs': > /home/kiel/development/omms/src/dbwrapper/dbwrapper.cpp:49: undefined > reference to `_sqlite3_open' undefined reference at link time is usually a missing library. I think you're using linux? It's probably the linker doesn't know which directory to look for the library. Try reading the output from 'man ldconfig' or check the 'see also' section of 'man ld' to find out what your particular system uses to manage where it finds libraries.