1. 程式人生 > >用msys1.0+mingw gcc4.7.1編譯libodb(C++ ORM)

用msys1.0+mingw gcc4.7.1編譯libodb(C++ ORM)

oca code start content out 當前 six xcode --

這裏主要使用的是libodb 對sqlite數據庫的支持.

(1)下載編譯sqlite3,當初編譯go-sqlite3的時候下載過sqlite3,就直接拿過來用了.

start msys.bat
gcc -c sqlite3.c -I./inc/sqlite3/
ar crvs libsqlite3.a sqlite3.o
cp libsqlite3.a /d/private/library/lib
cp sqlite3.h /d/private/library/inc/sqlite3
cp sqlite3ext.h /d/private/library/inc/sqlite3
rm libsqlite3.a
rm sqlite3.o

(2)下載libodb到/d/wxwidgets/wxcode/

libodb-2.3.0.zip libodb的庫

libodb-sqlite-2.3.0.zip libodb對Sqlite數據庫的支持

(3)編譯libodb的通用庫.

start msys.bat
cd /d/wxwidgets/wxcode/libodb-2.3.0
./configure
make

順利編譯成功.

(4)編譯libodb的sqlite支持

start msys.bat
cd /d/wxwidgets/wxcode/libodb-sqlite-2.3.0
./configure

提示libsqlite3沒有找到,因為上面對sqlite3的編譯後,對頭文件與靜態庫的存放,沒有按msys的標準(或POSIX標準或類unix標準)存放.執行./configure --includedir=/d/private/library/inc/sqlite3或./configure --includedir=/d/private/library/inc/sqlite3 --libdir=/d/private/library/lib 還是提示找不到sqlite3, 提示信息如下:

config.lt: creating libtoolchecking for libsqlite3... noconfigure: error: libsqlite3 is not found; consider using CPPFLAGS/LDFLAGS to specify its location

直接在msys中執行下面的命令,不再傳遞--includedir與--libdir參數,這時對sqlite3的檢查順利通過.

export CXXFLAGS=-I/d/private/library/inc/sqlite3
export LDFLAGS=-L/d/private/library/lib
./configure

提示sqlite3的一個特性沒有開啟,可能是在編譯的時候開啟這個特性的控制宏沒有定義.或當前代碼的版本不支持libodb需要的特性,暫時不理會了.

checking for libsqlite3... yes

configure: WARNING: libsqlite3 is built without sqlite3_unlock_notify support; multi-threaded support will be limited

checking for libodb... no

configure: error: libodb is not found; consider using --with-libodb=DIR

需要指定libodb的路徑

./configure --with-libodb=/d/wxwidgets/wxcode/libodb-2.3.0

之後順利通過configure, 並且make 直接編譯成功.

checking for libsqlite3... yesconfigure: WARNING: libsqlite3 is built without sqlite3_unlock_notify support; multi-threaded support will be limitedchecking for libodb... yeschecking whether to use rpath... yes

用msys1.0+mingw gcc4.7.1編譯libodb(C++ ORM)