Description

When compiling mbed TLS on Solaris, you can run into some known issues. The default Makefile tries to handle as much systems as possible, but some changes have to be done by hand.

Linking error

If you run make and get an error during linking similar to:

$ make
...
  CC    pkey/dh_client.c
Undefined                       first referenced
 symbol                             in file
bind                                ../library/libmbedtls.a(net.o)
accept                              ../library/libmbedtls.a(net.o)
listen                              ../library/libmbedtls.a(net.o)
gethostbyname                       ../library/libmbedtls.a(net.o)
socket                              ../library/libmbedtls.a(net.o)
setsockopt                          ../library/libmbedtls.a(net.o)
connect                             ../library/libmbedtls.a(net.o)
shutdown                            ../library/libmbedtls.a(net.o)
ld: fatal: symbol referencing errors. No output written to pkey/dh_client
collect2: ld returned 1 exit status
make[1]: *** [pkey/dh_client] Error 1
make: *** [all] Error 2

The reason is that under Solaris you have to instruct GCC to include libsocket and libnsl during linking.

So on Solaris 10, you'll define LDFLAGS to include -lsocket -lnsl when running make.

Ar error

If you run make and receive the following error:

$ make
....
  AR    libmbedtls.a
ar: creating libmbedtls.a
  RL    libmbedtls.a
ar: one of [drqtpmx] must be specified
make[1]: *** [libmbedtls.a] Error 1
make: *** [all] Error 2

Workaround

Install the package SUNWbinutils and then before building do:

export AR=gar

Did this help?