Compiling the UNP Libs Under Opensolaris
May 9, 2009
[REPOST FROM DECEMBER 2008]
Having recently changed my changed my operating system to Opensolaris I had to re-compile the unp library from (sadly the late) Richard Stevens definitive text Unix Network Programming.
Following the instructions provided with the library source, resulted in various compilation errors rendering the library impossible to compile. I have seen many posts on this subject but no definitive how-to to fix the problem. As Stevens himself points out…
“[He does] *NOT* have time to help everyone port the code to different environments”.
I can however help when it comes to Opensolaris build 2008.11!
To compile the library take the following steps (the steps in bold are the extra bits you need for Opensolaris)…
- Get the file unpv12e.tar.gz (which is the source distribution of the library)
- gunzip -c unpv12e.tar.gz | tar xvf – # Unpack the archive into a location of your choice
- cd unpv12e
- Open the file ‘configure’ in the text editor of your choice and change line 4374 to be the same as line 4372 (overwrite the existing line)
- ./configure # which should sort out the implementation differences
- cd lib # build the basic library that all programs need
- Open the file ‘unp.h’ in the text editor of your choice and comment out lines 114 to 117
- make
- cd ../libfree # continue building the basic library
- make
- cd ../libgai # the getaddrinfo() and getnameinfo() functions
- make
- cd ../libxti # opensolaris supports XTI
- make # opensolaris supports XTI
You should now be good to go! Just to make sure, try to build and run the intro project from the book…
cd ../intro # build and test a basic client program
make daytimetcpcli
./daytimetcpcli 127.0.0.1 # run the program
I must say that this book is the definitive text on the subject and I can’t recommend it heartily enough.
Happy hacking,
Matt
Resources…
Read more about the author Richard Stevens.
unpv12e.tar.gz – The original file from the book
unpprecomp.tar.gz – My precompiled library based on the instructions above for Opensolaris build 2008.11 for those who cant be arsed to do it themselves!