Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jul 2012 01:11:21 +0200
From:      Polytropon <freebsd@edvax.de>
To:        lei yang <yanglei.fage@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: help about free bsp version netcat to work it on ubuntu
Message-ID:  <20120725011121.c4671dfa.freebsd@edvax.de>
In-Reply-To: <CAHsH0E9S_8wq+fVY115C78vDk6kPdzqasQJD0E=yXiPjj6EQdQ@mail.gmail.com>
References:  <CAHsH0E_mj-g3YZcuMe0+DYLy_6=gzJNrhFE=CAy2SmiufUCAYA@mail.gmail.com> <20120722182545.39d6b96c.freebsd@edvax.de> <CAHsH0E9NkghmTPB=81bdquxq58kNFWuzyQAnzgZrhM54S7n9vA@mail.gmail.com> <20120723163604.6e795aa4.freebsd@edvax.de> <CAHsH0E9e28xwSpYnp7GmW=S=tvkWoMorHhqfepd6M9EyiahyUA@mail.gmail.com> <20120723184701.f21a4744.freebsd@edvax.de> <CAHsH0E9S_8wq+fVY115C78vDk6kPdzqasQJD0E=yXiPjj6EQdQ@mail.gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Tue, 24 Jul 2012 19:13:00 +0800, lei yang wrote:
> On Tue, Jul 24, 2012 at 12:47 AM, Polytropon <freebsd@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@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, ...



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20120725011121.c4671dfa.freebsd>