PDA

View Full Version : Subversion APIs



dholliday
24th March 2011, 22:57
Hi There,

I'm having problems and would like some advice, or maybe someone can simply tell me the solution.

To put you in the picture:

I have a QT app that currently runs the svn (executable) and reads the standard output and interprets it accordingly. I want to change this to use the svn apis which I thought would be easy but can't seem to compile with QTs default builder. I can compile a small example app with cMake, but I want to use the default builder because it's easier for other developers to keep it maintained.

So created a project and included paths to the SVN Library and APR library. For snow leopard it was as follow.

INCLUDEPATH += /Developer/SDKs/MacOSX10.6.sdk/usr/include/subversion-1 \
/Developer/SDKs/MacOSX10.6.sdk/usr/include/apr-1

Now I can include the APIs in my project so I wrote a simple API call.

#include <QtGui/QApplication>
#include "svn_client.h"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

svn_client_ctx_t asd;
apr_pool_t *pool;
svn_client_cleanup("/Users/dan/QSubversion/",&asd,pool);

return a.exec();
}

QT recognises all the functions and data type, yeah that was easy.
Ok, I know that the code may crash during runtime but I can't even get it to compile.
It throws loads of errors all very similar but it starting with...

Undefined symbols:
"_svn_client_delete3", referenced from:
svn::Client_impl::remove(svn::Targets const&, bool, bool, QMap<QString, QString> const&)in client_modify.o

Which I don't understand. There is no function called _svn_client_delete3. It seems to be prefixed with an underscore???? Why would it try and link to this?

Now I have examples that work that are build with cMake and I can build that. I don't really know what the difference is when they all use the same include paths.

Is there a flag that I need to set for the QT compiler or is it just not possible. Anyone able to help.

SixDegrees
24th March 2011, 23:27
Undefined symbols are typical of linkage that can't locate a particular library. The first step would be to check your path settings and ensure that the libraries you think are needed are actually being found.

The function in question is likely an internal call, for what it's worth, and therefore isn't documented. You could dump the symbols in your libraries and see if it can be found; this is typically done with 'nm' or the compiler under Linux; Mac probably has its own tools to do the same thing.

dholliday
25th March 2011, 09:21
Cheers, pointed me in the right direction.
I needed to the following to my .PRO file. However it there a better way of doing this?


LIBS += /Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_client-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_delta-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_diff-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_fs-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_fs_fs-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_fs_util-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_ra-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_ra_local-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_ra_neon-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_ra_svn-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_repos-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_subr-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_swig_ruby-1.dylib \
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libsvn_wc-1.dylib \
/usr/lib/libapr-1.dylib \
/usr/lib/libaprutil-1.dylib

nightghost
25th March 2011, 09:31
Perhaps pkg-config (http://doc.qt.nokia.com/4.7/qmake-project-files.html#configuration-features) has support for subversion (I don't know it right now if it works under osx)