[xmlsec] xmlsec with Project Builder and CodeWarrior on Mac OS X

Dan Timis timis at museresearch.com
Tue Jun 17 01:24:59 PDT 2003


Thanks for all your help.  Just in case anybody else will want to use 
xmlsec with Project Builder or CodeWarrior here how I was able to do it.

I tried to make a framework, but I had to give up.  I'm sure it's 
possible; I just didn't have the time to mess with it enough.  If 
anyone builds an xmlsec framework, please tell me.

Using Project Builder was very straightforward.  I used the shell 
command:

$ xmlsec1-config --cflags
-DXMLSEC_NO_XKMS=1 -I/usr/local/include/xmlsec1 
-I/usr/local/include/libxml2 -I/usr/local/include 
-DXMLSEC_CRYPTO="openssl" -DXMLSEC_CRYPTO_OPENSSL=1

That showed me what include directories to add to the project and what 
other flags to use.  Then, I used:

$ xmlsec1-config --libs
-L/usr/local/lib -lxmlsec1-openssl -lxmlsec1 -lxslt -lxml2 -lz 
-lpthread -lm -lcrypto

That shows where the libraries are and what libraries to use.  In the 
Targets tab I clicked on "GCC Compiler Settings" and then in the "Other 
C Compiler Flags" field I added:

-DXMLSEC_NO_XKMS=1 -DXMLSEC_CRYPTO="openssl" -DXMLSEC_CRYPTO_OPENSSL=1

Of course this may be different for someone else depending on how they 
built xmlsec.  I just got these defines from the xmlsec1-config command.

Then, I clicked on "Search Path" and I added to "Headers" 
/usr/local/include/xmlsec1, /usr/local/include/libxml2, and 
/usr/local/include.  Finally, I added to "External Frameworks and 
Libraries" from /usr/local/lib libxml2.a, libxslt.a, libxmlsec1.a, 
libxmlsec1-openssl.a, and libcrypto.a.  The project already had 
libstdc++.a and that probably took care of the -lz -lpthread, and -lm.

Of course, you first have to build and install all these libraries, and 
the exact path will depend on your configuration.

With CodeWarrior it was more difficult. In the Target Settings Panels 
in the "Access Paths" Panel I added /usr/local/include to "System 
Paths."  When I added all the libraries listed above; /usr/local/lib 
got automatically added to the "User Paths" and I moved it to "System 
Paths" (it builds anyway).  I created a file "config.h" and added to it:

#include "MSLCarbonPrefix.h"
#define XMLSEC_NO_XKMS 1
#define XMLSEC_CRYPTO "openssl"
#define XMLSEC_CRYPTO_OPENSSL 1

Of course, this depends on what xmlsec1-config shows you and what kind 
of CodeWarrior project you are using.  I replaced "MSLCarbonPrefix.h" 
with config.h to the "C/C++ Language" panel in the "Prefix File:" 
field.  I also had to download and install libz, and added libz.a to 
the project.

After all this I kept getting link errors:

Link Error   : undefined: '__udivdi3' (code)
Referenced from 'fmtstr' in libcrypto.a

Link Error   : undefined: '__umoddi3' (code)
Referenced from 'BN_add_word' in libcrypto.a
Referenced from 'fmtstr' in libcrypto.a

I figured out these might be in the gcc library, but not in the 
Metrowerks Standard Library.  I took me several hours, I even 
downloaded the source files udivdi3.c and umoddi3.c, compiled them, and 
added them to the project.  Finally, I added libgcc.a from 
/usr/lib/gcc/darwin/3.1 and that fixed the problem.

I'm sure there is more elegant solution and if anybody finds one, 
please tell me.  But, at least this seems to work.  I can run the 
examples and they give the same result as from the command line.

Dan Timis










More information about the xmlsec mailing list