<html xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> CompilingInstalling – OpenSC </title><style type="text/css"> @import url(trac.css); </style></head><body><div id="content" class="wiki"> <div class="wikipage searchable"> <h1 id="CompilingandInstallingOpenSC">Compiling and Installing OpenSC</h1> <p> This page has all the details on compiling and installing OpenSC. First some general instructions for Linux (and all unix operating systems not mentioned), and then the special cases for Solaris, Mac OS X and Windows. </p> <p> First a small warning: do not use gcc 4.0.1/2, opensc will segfault. The backtraces we have show some stack corruption, and we haven't been able to isolate the issue yet. So in the meantime we can only ask you to use gcc 3.3 or 3.4, they work well, and we are not aware of any issue. Exception: the apple gcc 4.0 on Mac OS X is fine, so far no problem reports. </p> <p> To compile OpenSC you need to have installed: pkg-config, openssl (runtime and development), openct and/or pcsc-lite (runtime and development), libltdl (runtime and development) and if you want the signer part: libassuan (runtime and development) and x libraries (runtime and development). </p> <p> OpenSC tries to auto-detect all libraries using the pkg-config system. Most big software projects like KDE or Gnome use it already for a long time, so most users will have it installed. </p> <p> Note: if you don't have libassuan installed, the signer won't be built. Most users and developers neither use nor need it. Also note the configure script does currently not properly check for x11 libraries and development files, it simply tries to build the signer if libassuan is found, and possibly fails, if x11 libs and development files are missing. </p> <p> If you don't have pkg-config installed, and don't want to, you can use environment variables to tell configure, how to link with some library: </p> <ul><li>OPENCT_CFLAGS and OPENCT_LIBS for OpenCT </li><li>PCSC_CFLAGS and PCSC_LIBS for PC/SC-Lite </li><li>OPENSSL_CFLAGS and OPENSSL_LIBS for OpenSSL </li><li>ASSUAN_CFLAGS and ASSUAN_LIBS for Assuan </li></ul><p> But most of the time it is easier to let pkg-config handle the automatic detection. If some libraries are not installed in typical locations, you need to tell pkg-config where to find the *.pc files. You can do this with the PKG_CONFIG_PATH environment variable, for example: </p> <pre class="wiki" xml:space="preserve">export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/mystuff/liv/pkgconfig </pre><h2 id="TypicalInstallation">Typical Installation</h2> <p> But most users use whatever their linux distributions or other operating systems provide, and thus don't need any of this. We suggest to install OpenSC into /usr and to put the configfile into /etc. The default however would be /usr/local and /usr/local/etcc, so you might want to change those. We suggest to compile OpenSC like this: </p> <pre class="wiki" xml:space="preserve">tar xfvz opensc-a.b.c.tar.gz cd opensc-a.b.c ./configure --prefix=/usr --sysconfdir=/etc make make install cp etc/opensc.conf /etc/ </pre><h3 id="OpenCT">OpenCT</h3> <p> By default configure script tries to locate openct automatically, this can be disabled by --disable-openct option. </p> <h3 id="PCSC-Lite">PC/SC-Lite</h3> <p> Most distributions will include pcsc-lite version 1.2.0. However if you want to use pinpad readers, at least those that support the new PC/SC v2 Part 10 standard for pinpad readers, then you need to have pcsc-lite 1.2.9-beta8 or later. </p> <p> By default configure script tries to locate pcsc-lite automatically, this can be disabled by --disable-pcsc-lite option. </p> <p> The configure script will tell you about this: </p> <pre class="wiki" xml:space="preserve">checking for PCSC_CFLAGS... -I/usr/include/PCSC checking for PCSC_LIBS... -lpcsclite checking for reader.h... no configure: WARNING: reader.h not found, install pcsc-lite 1.2.9-beta8 or later, or use PCSC_CFLAGS=... ./configure </pre><p> In this example pcsc-lite was found, but only an older version without support for the new PCSC v2 part 10 standard. This is fine, except for suport of modern pinpad readers. </p> <h2 id="MacOSX">Mac OS X</h2> <p> Apple did not include pkg-config in Mac OS X, changed the pcsc-lite header files and includes a version of pcsc-lite that does not support the new PCSC v2 part 10 pinpad reader standard. </p> <p> To compile OpenSC on Mac OS X we suggest: </p> <pre class="wiki" xml:space="preserve">export OPENSSL_CFLAGS="-I/usr/include" export OPENSSL_LIBS="-L/usr/lib -lcrypto" tar xfvz opensc-a.b.c.tar.gz cd opensc-a.b.c ./configure --prefix=/usr --sysconfdir=/etc make make install cp etc/opensc.conf /etc/ </pre><h2 id="MicrosoftWindows">Microsoft Windows</h2> <p> if you have Visual Studio .NET installed already you need not download either of these. </p> <ul><li>Download, install and use once <a class="ext-link" href="http://msdn.microsoft.com/vstudio/express/default.aspx" shape="rect"><span class="icon"> </span>Visual Studio Express</a>. </li><li>Download and install <a class="ext-link" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en" shape="rect"><span class="icon"> </span>Microsoft Platform SDK</a>. </li><li>Download and install <a class="ext-link" href="ftp://ftp.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.8.819-MSWin32-x86-267479.msi" shape="rect"><span class="icon"> </span>Active State Perl</a> </li><li>Download and install (runtime and development) <a class="ext-link" href="http://gnuwin32.sourceforge.net/packages/libtool.htm" shape="rect"><span class="icon"> </span>LibTool libltdl3</a> </li></ul><p> To compile OpenSC: </p> <p> 1) Unpack the opensc-a.b.c.tar.gz </p> <p> 2) You need to edit the file <tt>win32/Make.rules.mak</tt> - Point the variable LIBLTDL_INCL = %LIBLTDL_HOME%\include - Point the variable LIBLTDL_LIB = %LIBLTDL_HOME%\lib\libltdl.lib Where LIBLTDL_HOME is where you installed <a class="missing wiki" shape="rect">LibTool?</a>. </p> <p> 3) Set the variable OPENSSL_DEF = /DHAVE_OPENSSL -- if you wish to use OpenSSL (suggested) you can get it <a class="ext-link" href="http://www.openssl.org/" shape="rect"><span class="icon"> </span>here</a> - if you opted yes to use OpenSSL </p> <p> -- Set OPENSSL_INCL_DIR=/I%OPENSSL_HOME\include\ </p> <p> -- Set OPENSSL_LIB=%OPENSSL_HOME\lib\VC\libeay32MD.lib </p> <p> -- Set PROGRAMS_OPENSSL=pkcs15-init.exe cryptoflex-tool.exe netkey-tool.exe </p> <p> - Alternatively, if your compiler seems to think that the above variables are actually input file arguments, you can comment them out and install them as environment variables. If someone knows why this might happen, please clear up this point. </p> <p> 4) In some versions of Visual Studio .NET you MAY have to make a change to \opensc-a.b.b\src\include\opensc\log.h to solve a minor compiling error. You need to replace <tt>__FUNCTION__</tt> by <tt>__SCFUNCTION__</tt>. In 7.1 (.NET 2003) this was <strong>NOT</strong> necessary </p> <p> 5) Unconfirmed is if you are using Mircrosoft Visual Sudio .NET development environment, you need to copy three files from Visual Studio .NET, namely afxres.h, winres.h and afsxres.rx, to \opensc-a.b.b\src\include sub-directory before compiling. This is unverified but being left incase you have wierd issues </p> <p> 6) Compiling OpenSC is done with </p> <p> - The Visual Studio Command Prompt or </p> <p> -- Alternatively with the regular command prompt (cmd). But, you <strong>MUST</strong> runs vcvars32.bat. This should already be in your path. If not, check your Platform SDK or .NET bin directory </p> <pre class="wiki" xml:space="preserve">cd opensc-a.b.c nmake /f Makefile.mak </pre><p> Configuration instructions for building inside of the IDE directly are coming. </p> <hr></hr> <hr></hr> </div> <h3>Attachments</h3> <ul> <li> <a href="/opensc/attachment/wiki/CompilingInstalling/Make.rules.mak" title="View attachment" shape="rect">Make.rules.mak</a> <a href="/opensc/raw-attachment/wiki/CompilingInstalling/Make.rules.mak" title="Download" class="trac-rawlink" shape="rect"><img src="/trac/download.png" alt="Download"></img></a> (<span title="1624 bytes">1.6 KB</span>) - added by <em>wiredland@…</em> <a class="timeline" href="/opensc/timeline?from=2006-01-17T09%3A28%3A00Z&precision=second" title="2006-01-17T09:28:00Z in Timeline" shape="rect">4 years</a> ago. <q>Sample of <tt>opensc-0.10.0\win32\Make.rules.mak</tt></q> </li> </ul> </div><div class="footer"><hr></hr><p><a href="index.html">Back to Index</a></p></div></body></html>