help about free bsp version netcat to work it on ubuntu

Polytropon freebsd at edvax.de
Tue Jul 24 23:11:23 UTC 2012


On Tue, 24 Jul 2012 19:13:00 +0800, lei yang wrote:
> On Tue, Jul 24, 2012 at 12:47 AM, Polytropon <freebsd at edvax.de> wrote:
> > On Mon, 23 Jul 2012 23:29:38 +0800, lei yang wrote:
> >> Yes, the second version I post is using the source from you supplied,
> >> then I compiled it, but it has no
> >> "-U" flag like what I post, it seems a version different casued this.
> >
> > Yes. The version distributed by the ports collection is different
> > from that one supplied with the base system of FreeBSD.
> >
> > To try _that_ version, you can download the source tarball and
> > extract it; in the directory
> >
> > # wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/9.0-RELEASE/src.txz
> > # tar xvf src.txz
> 
> Thanks for the help,
> 
> tar xvf src.txz
> tar: This does not look like a tar archive
> tar: Skipping to next header
> tar: Archive contains obsolescent base-64 headers
> tar: Read 4896 bytes from src.txz
> tar: Error exit delayed from previous errors
> [lyang0 at ala-lpggp2 lyang0]$ tar xvf src.txz
> tar: This does not look like a tar archive
> tar: Skipping to next header
> tar: Archive contains obsolescent base-64 headers
> tar: Read 4896 bytes from src.txz
> tar: Error exit delayed from previous errors

Oh sorry I forgot: You're _not_ on a FreeBSD system!
That's why you cannot use tar (means: bsdtar) with
the xz compression support.

On your system, you first need to install xz. Use
the unxz to uncompress the archive. Then you will have
a valid tar archive which you can extract with "stock"
tar.



> > # cd cusr/src/ontrib/netcat/
> > # ls
> > FREEBSD-Xlist    FREEBSD-vendor   atomicio.h       netcat.c
> > FREEBSD-upgrade  atomicio.c       nc.1             socks.c
> > #
> > <your build command(s) here>
> >
> 
> Suppose gcc -o netcat netcat.c atomicio.c socks.c should work

It seems that I pointed you to a wrong location inside
the src/ tree. Maybe try this instead:

# unxz src.txz
# tar xvf src.tar usr/src/usr.bin/nc/
# tar xvf src.tar usr/src/contrib/netcat/
# cd usr/src/usr.bin/nc/
# ls
Makefile
# cd ../../contrib/netcat/
# ls
FREEBSD-Xlist    FREEBSD-vendor   atomicio.h       netcat.c
FREEBSD-upgrade  atomicio.c       nc.1             socks.c

"Problem": The Makefile which describes the build
process refers to bsd.prog.mk which is specific to
FreeBSD (and located in src/share/Mk which you'd
also have to extract).

The content of the Makefile is rather simple:

.PATH: ${.CURDIR}/../../contrib/netcat

PROG=   nc
SRCS=   netcat.c atomicio.c socks.c

CFLAGS+=-DIPSEC
LDADD=  -lipsec
DPADD=  ${LIBIPSEC}

.include <bsd.prog.mk>

Still it seems that your "simplified" approach could
work: Compile all the .c files.






-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list