Compiling socat for x86 and powerpc

The socat (socket-cat) utility is a variant on the netcat family of utilities that allow for information to be streamed easily to and from network sockets on different machines from the commandline. These utilities are designed to mimic the traditional "cat" utility but allowing for the input or destination to be a network socket.

For the DAQ system we have compiled and cross compiled both the netcat and socat programs. This allows us to turn small diagnostic utilities into pseudo network servers from the commandline or from scripts.

Building socat

The socat source code was obtained from

For the current DAQ release I build version 2.0.0-b5.

The build process had to be done separately for the x86 and powerpc environments. This is detailed below.


For x86_65 (SLF6) I was able to use our normal DAQ version of gcc and the autoconfig utilities to build the socat suite. The process was straight forward:

(from the socat source tree)

This produced the socat executable and the appropriate libraries.

PowerPC (603)

For the DCMs the build was not as simple. I had to disable a number of the build options and then effectively build the suite by hand. The process was:

source /nova/novadaq/setup/ --xcompile --opt

This gave me the correct compilers
./configure --disable-libwrap --disable-filan --disable-sycls --disable-tun --disable-fips ---disable-openssl --disable-readline

Then for the build step I compiled down all but those files with a main function:
ls *.c |grep -v main |grep -v socat| xargs -I {} gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I. -c {} 

I then built a static library:
ar r libxio.a *.o

To build the socat executable I then did a:

gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I. -o socat socat.c libxio.a -lutil -lpthread

I was also able to build a static version which can easily be deployed to a DCM without any additional libs.

gcc -o socat_static socat.o libxio.a -lutil -lpthreads --static