Alex wrote:
I compiled nss on FreeBSD platform, and wrote a program .
My program use function SECU_ReadDERFromFile, like this

#include "secutil.h"
......
rv = SECU_ReadDERFromFile(&certDER, inFile, PR_TRUE);
......


This function is in libsectool.a

#nm libsectool.a |grep SECU_Read
00001290 T SECU_ReadDERFromFile

when I compile my program, it can generate .o file. but can't make executable file. error message like this:

g++ -o certools ./certool/GetDNToDB.o ./certool/pk12util.o -L. -L./lib -Wl,-rpath-link,./lib -lsectool -lssl3 -lsmime3 -lnss3 -lplc4 -lplds4 -lnspr4 -lpthread -lc -fpic ./lib/libsoftokn3.so: warning: warning: mktemp() possibly used unsafely; consider using mkstemp()
./certool/GetDNToDB.o(.text+0xc9e): In function `GetCertFullDN(char*)':
: undefined reference to `SECU_ReadDERFromFile(SECItemStr*, PRFileDesc*, int)'
gmake: *** [certool] Error 1

I try other functions in libsectool.a which is defined in secutil.h. it also can't been use. I feel so despondent.

Why?? I have already include header file(secutil.h). Anyone can give me some suggestions? Please help me.

Your link command line looks correct.  We link our
command-line utilities with ./lib/libsectool.a instead
of -L./lib -lsectool, but -L./lib -lsectool should work.

Since you use g++ to link, I suspect that you also GetDNToDB.o
is compiled from a C++ file.  Try include secutil.h in an extern "C"
block like this:

extern "C" {
#include "secutil.h"
}

Note that libsectool.a is for NSS internal use.  So
you are using it at your own risk.

Wan-Teh
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to