linking error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

linking error

Todd Douty
I'm attempting to use OpenSSL to talk to an SSL server across campus.  I
obtained example OpenSSL client code written in C from
http://www.rtfm.com/openssl-examples and modified this code slightly to fit
my needs.  ssl_stuff.o is my version of the file that one time included the
"main" program in the example I downloaded.  I just modified the main
program to be my main initialization routine for SSL.  The makefile at the
bottom of this email generates the following link errors on our Solaris
platform:

Tramp->make
cc -g -xCC   -L/usr/local/ssl/lib -L/usr/local/lib  -o libfps.exe
./binchar.o  ./charbin.o  ./itoa.o  ./libfps.o  ./libfps_cgi.o
./process_url.o  ./ssl_stuff.o -lssl -lcrypto
ild: (undefined symbol) socket -- referenced in the text segment of
/usr/local/ssl/lib/libcrypto.a(rand_egd.o)
ild: (undefined symbol) err_exit -- referenced in the text segment of
./ssl_stuff.o
ild: (undefined symbol) connect -- referenced in the text segment of
/usr/local/ssl/lib/libcrypto.a(rand_egd.o)
ild: (undefined symbol) check_cert -- referenced in the text segment of
./ssl_stuff.o
ild: (undefined symbol) shutdown -- referenced in the text segment of
/usr/local/ssl/lib/libcrypto.a(bss_sock.o)
ild: (undefined symbol) destroy_ctx -- referenced in the text segment of
./ssl_stuff.o
ild: (undefined symbol) initialize_ctx -- referenced in the text segment of
./ssl_stuff.o
ild: (undefined symbol) berr_exit -- referenced in the text segment of
./ssl_stuff.o
ild: (undefined symbol) tcp_connect -- referenced in the text segment of
./ssl_stuff.o
*** Error code 5
make: Fatal error: Command failed for target `libfps.exe'


I'm apparently not linking with something I need to link.  The only two
OpenSSL libraries I could find on our system are in
/usr/local/ssl/lib.  The two libraries are libcrypto.a and libssl.a.  The
only other file in this directory is something called pkgconfig.  What do I
need to link in to resolve the above undefined references?  Thanks for the
help.


Here's my makefile:
CC = cc
BASICOPTS = -g
CFLAGS = $(BASICOPTS) -xCC
IFLAGS = -I/usr/include -I/usr/include/arpa -I/usr/local/ssl/include
LDLIBS = -L/usr/local/ssl/lib -L/usr/local/lib
LIBS = -lssl -lcrypto

# Define the target directories.
TARGETDIR_libfps.exe=.


all: $(TARGETDIR_libfps.exe)/libfps.exe

## Target: libfps.exe
OBJS_libfps.exe =  \
         $(TARGETDIR_libfps.exe)/binchar.o \
         $(TARGETDIR_libfps.exe)/charbin.o \
         $(TARGETDIR_libfps.exe)/itoa.o \
         $(TARGETDIR_libfps.exe)/libfps.o \
         $(TARGETDIR_libfps.exe)/libfps_cgi.o \
         $(TARGETDIR_libfps.exe)/process_url.o \
         $(TARGETDIR_libfps.exe)/ssl_stuff.o


# Link or archive
$(TARGETDIR_libfps.exe)/libfps.exe: $(TARGETDIR_libfps.exe) $(OBJS_libfps.exe)
         $(LINK.c) $(LDLIBS) $(CFLAGS_libfps.exe) -o $@ $(OBJS_libfps.exe)
$(LIBS
)


# Compile source files into .o files
$(TARGETDIR_libfps.exe)/binchar.o: $(TARGETDIR_libfps.exe) binchar.c
         $(COMPILE.c) $(CFLAGS_libfps.exe) $(IFLAGS) $(CPPFLAGS_libfps.exe)
-o $@
  binchar.c

$(TARGETDIR_libfps.exe)/charbin.o: $(TARGETDIR_libfps.exe) charbin.c
         $(COMPILE.c) $(CFLAGS_libfps.exe) $(IFLAGS) $(CPPFLAGS_libfps.exe)
-o $@
  charbin.c

$(TARGETDIR_libfps.exe)/itoa.o: $(TARGETDIR_libfps.exe) itoa.c
         $(COMPILE.c) $(CFLAGS_libfps.exe) $(IFLAGS) $(CPPFLAGS_libfps.exe)
-o $@
  itoa.c

$(TARGETDIR_libfps.exe)/libfps.o: $(TARGETDIR_libfps.exe) libfps.c
         $(COMPILE.c) $(CFLAGS_libfps.exe) $(IFLAGS) $(CPPFLAGS_libfps.exe)
-o $@
  libfps.c

$(TARGETDIR_libfps.exe)/libfps_cgi.o: $(TARGETDIR_libfps.exe) libfps_cgi.c
         $(COMPILE.c) $(CFLAGS_libfps.exe) $(IFLAGS) $(CPPFLAGS_libfps.exe)
-o $@
  libfps_cgi.c

$(TARGETDIR_libfps.exe)/process_url.o: $(TARGETDIR_libfps.exe) process_url.c
         $(COMPILE.c) $(CFLAGS_libfps.exe) $(IFLAGS) $(CPPFLAGS_libfps.exe)
-o $@
  process_url.c

$(TARGETDIR_libfps.exe)/ssl_stuff.o: $(TARGETDIR_libfps.exe) ssl_stuff.c
         $(COMPILE.c) $(CFLAGS_libfps.exe) $(IFLAGS) $(CPPFLAGS_libfps.exe)
-o $@
  ssl_stuff.c


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]