Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, August 2007
can't connect to SQLITE driver on a Mac deploy!


Message 1 in thread

I have an application that needs the sqlite driver. I've spent about an hour 
on this and I can't figure out how to add the sqlite driver to a bundle, and 
deploy it properly on a Mac.

I get the following error message when I load the application:

    QSqlDatabase: QSQLITE driver not loaded
    QSqlDatabase: available drivers:

I copied a deploy script from the internet, found at: 
http://wiki.qtcentre.org/index.php?title=Mac_OS_X_Deployment_Script, and I 
added these lines right before creating the .dmg:

mkdir $BUNDLE/Contents/plugins
mkdir $BUNDLE/Contents/plugins/sqldrivers
cp -R /Developer/Applications/Qt/plugins/sqldrivers/libqsqlite.dylib 
$BUNDLE/Contents/plugins/sqldrivers/

install_name_tool -change 
/Library/Frameworks/QtSql.framework/Versions/4/QtSql \
@executable_path/../Frameworks/QtSql.framework/Versions/4/QtSql \
 $BUNDLE/Contents/plugins/sqldrivers/libqsqlite.dylib

install_name_tool -change 
/Library/Frameworks/QtCore.framework/Versions/4/QtCore \
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \
$BUNDLE/Contents/plugins/sqldrivers/libqsqlite.dylib


I also added these lines to my main function:

#ifdef Q_WS_MAC
  QDir dir(QApplication::applicationDirPath());
  dir.cdUp();
  dir.cd("plugins");
  QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif


Please let me know what else I can do,

Thank you,

Cesar 


--
 [ signature omitted ] 

Message 2 in thread

Hey,

your install_name_tool -change call has to be modified to fit the framework 
the libqsqlite.dylib points to.

try

otool -L /path/to/libqsqlite.dylib

in my case there is a line: 

QtSql.framework/Versions/4/QtSql (compatibility version 4.3.0, current version 
4.3.1)

so the install_name_tool -change call has to look like

install_name_tool -change
QtSql.framework/Versions/4/QtSql \
@executable_path/../Frameworks/QtSql.framework/Versions/4/QtSql \
$BUNDLE/Contents/plugins/sqldrivers/libqsqlite.dylib

instead of

> install_name_tool -change
> /Library/Frameworks/QtSql.framework/Versions/4/QtSql \
> @executable_path/../Frameworks/QtSql.framework/Versions/4/QtSql \
>  $BUNDLE/Contents/plugins/sqldrivers/libqsqlite.dylib

the same for QtCore

install_name_tool -change
QtCore.framework/Versions/4/QtCore \
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \
$BUNDLE/Contents/plugins/sqldrivers/libqsqlite.dylib

instead of
>
> install_name_tool -change
> /Library/Frameworks/QtCore.framework/Versions/4/QtCore \
> @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \
> $BUNDLE/Contents/plugins/sqldrivers/libqsqlite.dylib
>

I.e. the second line in install_name_tool call should look like the framework 
path the *.dylib points to.

Hope that helps.

cheers

seb

--
 [ signature omitted ] 

Message 3 in thread

Thank you so much!! It worked!

Cesar

"Sebastian Breuers" <sebbreuers@xxxxxx> wrote in message 
news:200708171020.21230.sebbreuers@xxxxxxxxx
> Hey,
>
> your install_name_tool -change call has to be modified to fit the 
> framework
> the libqsqlite.dylib points to.
>
> try
>
> otool -L /path/to/libqsqlite.dylib
>
> in my case there is a line:
>
> QtSql.framework/Versions/4/QtSql (compatibility version 4.3.0, current 
> version
> 4.3.1)
>
> so the install_name_tool -change call has to look like
>
> install_name_tool -change
> QtSql.framework/Versions/4/QtSql \
> @executable_path/../Frameworks/QtSql.framework/Versions/4/QtSql \
> $BUNDLE/Contents/plugins/sqldrivers/libqsqlite.dylib
>
> instead of
>
>> install_name_tool -change
>> /Library/Frameworks/QtSql.framework/Versions/4/QtSql \
>> @executable_path/../Frameworks/QtSql.framework/Versions/4/QtSql \
>>  $BUNDLE/Contents/plugins/sqldrivers/libqsqlite.dylib
>
> the same for QtCore
>
> install_name_tool -change
> QtCore.framework/Versions/4/QtCore \
> @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \
> $BUNDLE/Contents/plugins/sqldrivers/libqsqlite.dylib
>
> instead of
>>
>> install_name_tool -change
>> /Library/Frameworks/QtCore.framework/Versions/4/QtCore \
>> @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore \
>> $BUNDLE/Contents/plugins/sqldrivers/libqsqlite.dylib
>>
>
> I.e. the second line in install_name_tool call should look like the 
> framework
> path the *.dylib points to.
>
> Hope that helps.
>
> cheers
>
> seb
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/ 


--
 [ signature omitted ] 

Message 4 in thread

Hi, Cesar.
You might try to build a version of the Qt libraries that has the SQLITE driver compiled in, rather than as a plugin.

Hope this helps

Cheers :)
 
--
 [ signature omitted ]