Monthly Archives: August 2014

Cross Debugging with GDB

FreeBSD under Linux

Build

i386fbsd-tdep.c:48:12: error: static declaration of ‘i386fbsd_sc_reg_offset’ follows non-static declaration
In file included from i386fbsd-tdep.c:26:0:
i386-tdep.h:228:12: note: previous declaration of ‘i386fbsd_sc_reg_offset’ was here
make[1]: *** [i386fbsd-tdep.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gdb-6.1.1/gdb'
make: *** [all-gdb] Error 2

# grep -r i386fbsd_sc_reg_offset .
./gdb/i386bsd-nat.c:#define SC_REG_OFFSET i386fbsd_sc_reg_offset
./gdb/i386fbsd-tdep.c:static int i386fbsd_sc_reg_offset[] =
./gdb/i386fbsd-tdep.c:  tdep->sc_reg_offset = i386fbsd_sc_reg_offset;
./gdb/i386fbsd-tdep.c:  tdep->sc_num_regs = ARRAY_SIZE (i386fbsd_sc_reg_offset);
./gdb/i386-tdep.h:extern int i386fbsd_sc_reg_offset[];

Execute

(gdb) file apu/src/dns-amplification-defender/dnsdefend
Reading symbols from apu/src/dns-amplification-defender/dnsdefend...Dwarf Error: Cannot handle DW_FORM_<unknown> in DWARF reader [in module /home/andreas/apu/src/dns-amplification-defender/dnsdefend]
(gdb) target remote 10.41.10.20:2345
Remote debugging using 10.41.10.20:2345
0x000000080060c070 in ?? ()
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
warning: shared library handler failed to enable breakpoint

Receiving GDB error “Dwarf Error: Cannot handle DW_FORM_flag_present in DWARF reader [in module /xxx/yyy/executable]”

GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=x86_64-pc-freebsd10.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
(gdb) file apu/src/dns-amplification-defender/dnsdefend
Reading symbols from /home/andreas/apu/src/dns-amplification-defender/dnsdefend...done.
(gdb) target remote 10.41.10.20:2345
Remote debugging using 10.41.10.20:2345
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x000000080060c070 in ?? ()
(gdb) b dns_header_decode_label
Breakpoint 1 at 0x406bf4: file src/packet/dns_header.c, line 159.
(gdb) r
The "remote" target does not support "run".  Try "help target" or "continue".
(gdb) help target
Connect to a target machine or process.
The first argument is the type or protocol of the target machine.
Remaining arguments are interpreted by the target protocol.  For more
information on the arguments for a particular protocol, type
`help target ' followed by the protocol name.

List of target subcommands:

target bsd-uthreads -- BSD user-level threads
target core -- Use a core file as a target
target exec -- Use an executable file as a target
target extended-remote -- Use a remote computer via a serial line
target record -- Log program while executing and replay execution from log
target record-btrace -- Collect control-flow trace and provide the execution history
target record-core -- Log program while executing and replay execution from log
target record-full -- Log program while executing and replay execution from log
target remote -- Use a remote computer via a serial line
target tfile -- Use a trace file as a target

Type "help target" followed by target subcommand name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb) set sysroot /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/
bin/     include/ lib/     usr/     
(gdb) set sysroot /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
(gdb) bt
#0  0x000000080060c070 in ?? ()
#1  0x0000000000000001 in ?? ()
#2  0x00007fffffffdd58 in ?? ()
#3  0x0000000000000000 in ?? ()
(gdb) set sysroot /usr/x86_64-freebsd/x86_64-pc-freebsd10.0
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
(gdb) bt
#0  0x000000080060c070 in ?? ()
#1  0x0000000000000001 in ?? ()
#2  0x00007fffffffdd58 in ?? ()
#3  0x0000000000000000 in ?? ()
(gdb) c
Continuing.
warning: Could not load shared library symbols for /libexec/ld-elf.so.1.
Do you need "set solib-search-path" or "set sysroot"?

Program received signal SIGBUS, Bus error.
0x0000000800949f8a in ?? () from /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/libc.so.7
(gdb) set sysroot /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
(gdb) c
Continuing.

Program terminated with signal SIGBUS, Bus error.
The program no longer exists.
(gdb) quit
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=x86_64-pc-freebsd10.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
(gdb) ffile apu/src/dns-amplification-defender/dnsdefend
Undefined command: "ffile".  Try "help".
(gdb) file apu/src/dns-amplification-defender/dnsdefend
Reading symbols from /home/andreas/apu/src/dns-amplification-defender/dnsdefend...done.
(gdb) target remote 10.41.10.20:2345
Remote debugging using 10.41.10.20:2345
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x000000080060c070 in ?? ()
(gdb) c
Continuing.
warning: Could not load shared library symbols for 2 libraries, e.g. /lib/libc.so.7.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?

Program received signal SIGBUS, Bus error.
0x0000000800949f8a in ?? ()
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=x86_64-pc-freebsd10.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
(gdb) set sysroot /usr/x86_64-freebsd/x86_64-pc-freebsd10.0
(gdb) file apu/src/dns-amplification-defender/dnsdefend
Reading symbols from /home/andreas/apu/src/dns-amplification-defender/dnsdefend...done.
(gdb) target remote 10.41.10.20:2345
Remote debugging using 10.41.10.20:2345
Reading symbols from /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/libexec/ld-elf.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/libexec/ld-elf.so.1
0x000000080060c070 in ?? () from /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/libexec/ld-elf.so.1
(gdb) b dns_header_decode_label
Breakpoint 1 at 0x406bf4: file src/packet/dns_header.c, line 159.
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x0000000000400c21 in _start ()
(gdb) bt
#0  0x0000000000400c21 in _start ()

Cross-Compiler

FreeBSD Toolchain

BSD Toolchain Project
The LLVM Compiler Infrastructure
The LLDB Debugger

build – host – target

Traditional cross-compilation terminology defines three platforms:

  • build – the platform we’re building on
  • host – the platform the compiler will run on
  • target – the platform the compiler we’re building will generate code for

Cross-compiling GHC

arch-vendor-os

Can anyone explain the gcc cross-compiler naming convention?

Building a Cross-Compiler

How to make a cross compiler (gcc) for freebsd under linux. A small tutorial

GNU development tools (binutils)

This directory contains various GNU compilers, assemblers, linkers,
debuggers, etc., plus their support routines, definitions, and documentation.t

$ mkdir /usr/x86_64-freebsd
$ mkdir /usr/x86_64-freebsd/src

$ mv ~/Downloads/binutils-2.24.tar.gz /usr/x86_64-freebsd/src
$ cd /usr/x86_64-freebsd/src
$ tar -xzf binutils-2.24.tar.gz
$ cd binutils-2.24
$ ./configure --enable-libssp --enable-gold --enable-ld \
--target=x86_64-pc-freebsd10.0 --prefix=/usr/x86_64-freebsd
$ make -j 4
$ make install

GNU MP (gmp)

GNU MP is a library for arbitrary precision arithmetic, operating on signed
integers, rational numbers, and floating point numbers.

$ mv ~/Downloads/gmp-5.1.3.tar.gz /usr/x86_64-freebsd/src
$ cd /usr/x86_64-freebsd/src
$ tar -xzf gmp-5.1.3.tar.gz
$ cd gmp-5.1.3
$ ./configure --prefix=/usr/x86_64-freebsd --enable-shared \
--enable-static --enable-mpbsd --enable-fft --enable-cxx \
--host=x86_64-pc-freebsd10.0
configure: summary of build options:

  Version:           GNU MP 5.1.3
  Host type:         x86_64-pc-freebsd10.0
  ABI:               64
  Install prefix:    /usr/x86_64-freebsd
  Compiler:          gcc -std=gnu99
  Static libraries:  yes
  Shared libraries:  yes
$ make -j 4
$ make install
+-------------------------------------------------------------+
| CAUTION:                                                    |
|                                                             |
| If you have not already run "make check", then we strongly  |
| recommend you do so.                                        |
|                                                             |
| GMP has been carefully tested by its authors, but compilers |
| are all too often released with serious bugs.  GMP tends to |
| explore interesting corners in compilers and has hit bugs   |
| on quite a few occasions.                                   |
|                                                             |
+-------------------------------------------------------------+
$ make check

GNU MPFR (mpfr)

The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.

$ mv ~/Downloads/mpfr-3.1.2.tar.gz /usr/x86_64-freebsd/src
$ cd /usr/x86_64-freebsd/src
$ tar -xzf mpfr-3.1.2.tar.gz
$ cd mpfr-3.1.2
$ ./configure --prefix=/usr/x86_64-freebsd --with-gnu-ld \
--with-gmp=/usr/x86_64-freebsd --enable-static \
--enable-shared --host=x86_64-pc-freebsd10.0
$ make -j 4
$ make install

GNU MPC (mpc)

GNU MPC is a C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result.

$ mv ~/Downloads/mpc-1.0.2.tar.gz /usr/x86_64-freebsd/src
$ cd /usr/x86_64-freebsd/src
$ tar -xzf mpc-1.0.2.tar.gz
$ cd mpc-1.0.2
$  ./configure --prefix=/usr/x86_64-freebsd --with-gnu-ld \
--with-gmp=/usr/x86_64-freebsd --with-mpfr=/usr/x86_64-freebsd \
--enable-static --enable-shared --host=x86_64-pc-freebsd10.0
$ make -j 4
$ make install

GNU libgomp

The GOMP project has developed an implementation of OpenMP for the C, C++, and Fortran compilers in the GNU Compiler Collection and is further improving it. As part of the GNU Project, GOMP simplifies parallel programming for all GNU system variants. This effort operates in an open environment to attract developers and ensure applicability across multiple architectures and applications.

Not used!

GCC

$ mv ~/Downloads/gcc-4.8.3.tar.gz /usr/x86_64-freebsd/src
$ cd /usr/x86_64-freebsd/src
$ tar -xzf gcc-4.8.3.tar.gz
$ cd gcc-4.8.3
$ mkdir obj
$ cd obj
$ ../configure --without-headers --with-gnu-as --with-gnu-ld \
--enable-languages=c,c++ --disable-nls --enable-libssp \
--enable-gold --enable-ld --target=x86_64-pc-freebsd10.0 \
--prefix=/usr/x86_64-freebsd \
--with-gmp=/usr/x86_64-freebsd \
--with-mpc=/usr/x86_64-freebsd \
--with-mpfr=/usr/x86_64-freebsd \
--disable-libgomp
$ LD_LIBRARY_PATH=/usr/x86_64-freebsd/lib make -j 4

../configure --without-headers --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-nls --enable-libssp --enable-gold --enable-ld --target=x86_64-pc-freebsd10.0 --prefix=/usr/x86_64-freebsd --with-gmp=/usr/x86_64-freebsd --with-mpc=/usr/x86_64-freebsd --with-mpfr=/usr/x86_64-freebsd --disable-libgomp --with-build-sysroot=/usr/x86_64-freebsd

FAQ

$ mv ~/Downloads/gcc-4.8.3.tar.gz /usr/x86_64-freebsd/src
$ cd /usr/x86_64-freebsd/src
$ tar -xzf gcc-4.8.3.tar.gz
$ cd gcc-4.8.3
$ mkdir obj
$ cd obj
$ ../configure [...]
$ LD_LIBRARY_PATH=/usr/x86_64-freebsd/lib make -j 4
[...]
/usr/x86_64-freebsd/src/gcc-4.8.3/obj/./gcc/xgcc -B/usr/x86_64-freebsd/src/gcc-4.8.3/obj/./gcc/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include    -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o cpuinfo_s.o sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: cannot find /lib/libc.so.7
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: cannot find /usr/lib/libc_nonshared.a
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: cannot find /usr/lib/libssp_nonshared.a
collect2: error: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[2]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/obj/x86_64-pc-freebsd10.0/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/obj'
make: *** [all] Error 2
.../bin/ld: cannot find /lib/libc.so.7
.../bin/ld: cannot find /usr/lib/libc_nonshared.a
.../bin/ld: cannot find /usr/lib/libssp_nonshared.a
$ uname -a
FreeBSD gateway 10.0-RELEASE FreeBSD 10.0-RELEASE #1: Sun Apr 20 15:45:27 CEST 2014     bachi@gateway:/usr/obj/usr/src/sys/INES  amd64

$ find /lib -name 'libc.so*'
/lib/libc.so.7

$ find /usr/lib -name 'libc.so*'
/usr/lib/libc.so

$ find /usr/lib -name 'libc_nonshared*'
/usr/lib/libc_nonshared.a

$ find /usr/lib -name 'libssp_nonshared*'
/usr/lib/libssp_nonshared.a
$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu quantal (development branch)
Release:        12.10
Codename:       quantal

$ uname -a
Linux andreas-OptiPlex-9010 3.5.0-6-generic #6-Ubuntu SMP Mon Jul 23 19:52:14 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ find /lib -name 'libc.so*'
/lib/x86_64-linux-gnu/libc.so.6
/lib/i386-linux-gnu/libc.so.6

$ find /usr/lib -name 'libc.so*'
/usr/lib/x86_64-linux-gnu/libc.so

$ find /usr/lib -name 'libc_nonshared*'
/usr/lib/x86_64-linux-gnu/libc_nonshared.a

$ find /usr/lib -name 'libssp_nonshared*'
/usr/lib/gcc/x86_64-linux-gnu/4.7/libssp_nonshared.a
/usr/lib/gcc/arm-linux-gnueabi/4.7/libssp_nonshared.a
$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:        14.04
Codename:       trusty

$ uname -a
Linux ines-OptiPlex-745 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:01 UTC 2014 i686 i686 i686 GNU/Linux

$ find /lib -name 'libc.so*'
/lib/i386-linux-gnu/libc.so.6

$ find /usr/lib -name 'libc.so*'
/usr/lib/i386-linux-gnu/libc.so

$ find /usr/lib -name 'libc_nonshared*'
/usr/lib/i386-linux-gnu/libc_nonshared.a

$ find /usr/lib -name 'libssp_nonshared*'
/usr/lib/gcc/i686-linux-gnu/4.7/libssp_nonshared.a
/usr/lib/gcc/i686-linux-gnu/4.8/libssp_nonshared.a

–disable-multilib

The same as above

Make without LD_LIBRARY_PATH

make[2]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.7.4/objdir/gcc'
Checking multilib configuration for libgcc...
mkdir -p -- x86_64-pc-freebsd10.0/libgcc
Configuring in x86_64-pc-freebsd10.0/libgcc
configure: creating cache ./config.cache
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-pc-freebsd10.0
checking for --enable-version-specific-runtime-libs... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking for x86_64-pc-freebsd10.0-ar... /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ar
checking for x86_64-pc-freebsd10.0-lipo... x86_64-pc-freebsd10.0-lipo
checking for x86_64-pc-freebsd10.0-nm... /usr/x86_64-freebsd/src/gcc-4.7.4/objdir/./gcc/nm
checking for x86_64-pc-freebsd10.0-ranlib... /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ranlib
checking for x86_64-pc-freebsd10.0-strip... /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/strip
checking whether ln -s works... yes
checking for x86_64-pc-freebsd10.0-gcc... /usr/x86_64-freebsd/src/gcc-4.7.4/objdir/./gcc/xgcc -B/usr/x86_64-freebsd/src/gcc-4.7.4/objdir/./gcc/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include   
checking for suffix of object files... configure: error: in `/usr/x86_64-freebsd/src/gcc-4.7.4/objdir/x86_64-pc-freebsd10.0/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.7.4/objdir'
make: *** [all] Error 2
...

Configure with –with-build-sysroot

# ../configure --without-headers --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-nls --enable-libssp --enable-gold --enable-ld --target=x86_64-pc-freebsd10.0 --prefix=/usr/x86_64-freebsd --with-gmp=/usr/x86_64-freebsd --with-mpc=/usr/x86_64-freebsd --with-mpfr=/usr/x86_64-freebsd --disable-libgomp --disable-multilib --with-build-sysroot=/usr/x86_64-freebsd

# LD_LIBRARY_PATH=/usr/x86_64-freebsd/lib make -j 4
[...]
/usr/x86_64-freebsd/src/gcc-4.7.4/objdir/./gcc/xgcc -B/usr/x86_64-freebsd/src/gcc-4.7.4/objdir/./gcc/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include --sysroot=/usr/x86_64-freebsd   -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[2]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.7.4/objdir/x86_64-pc-freebsd10.0/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.7.4/objdir'
make: *** [all] Error 2

========================================================================

Alles mit sysroot

$ ./configure --enable-libssp --enable-gold --enable-ld --target=x86_64-pc-freebsd10.0 --prefix=/usr/x86_64-freebsd --with-build-sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0
$ ../configure \
--with-gnu-as \
--with-gnu-ld \
--enable-languages=c,c++ \
--disable-nls \
--enable-libssp \
--enable-gold \
--enable-ld \
--target=x86_64-pc-freebsd10.0 \
--prefix=/usr/x86_64-freebsd \
--with-gmp=/usr/x86_64-freebsd \
--with-mpc=/usr/x86_64-freebsd \
--with-mpfr=/usr/x86_64-freebsd \
--disable-libgomp \
--disable-multilib \
--with-build-sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0
$ LD_LIBRARY_PATH=/usr/x86_64-freebsd/lib make
[...]

make[2]: Entering directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libgcc'
# If this is the top-level multilib, build all the other
# multilibs.
DEFINES='' HEADERS='' \
		../../../libgcc/mkheader.sh > tmp-libgcc_tm.h
/bin/bash ../../../libgcc/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
echo timestamp > libgcc_tm.stamp
/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/xgcc -B/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include --sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0   -g -O2 -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -fpic -pthread -I. -I. -I../.././gcc -I../../../libgcc -I../../../libgcc/. -I../../../libgcc/../gcc -I../../../libgcc/../include  -DHAVE_CC_TLS  -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
In file included from ../../../libgcc/../gcc/tsystem.h:44:0,
                 from ../../../libgcc/libgcc2.c:27:
/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/gcc/include/stddef.h:56:24: fatal error: sys/_types.h: No such file or directory
 #include <sys/_types.h>
                        ^
compilation terminated.
make[2]: *** [_muldi3.o] Error 1
make[2]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir'
make: *** [all] Error 2

# find /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/include -name _types.h
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/include/sys/_types.h
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/include/machine/_types.h
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/include/x86/_types.h

==========================

/bin/bash ../libtool --tag CXX   --mode=link /usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/xgcc -shared-libgcc -B/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc -nostdinc++ -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src/.libs -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include --sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0   -Wl,-O1 -Wl,-z,relro -Wl,--gc-sections  -fPIC -DPIC  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi  -fdiagnostics-show-location=once   -ffunction-sections -fdata-sections  -frandom-seed=libstdc++.la  -o libstdc++.la -version-info 6:19:0 -Wl,--version-script=libstdc++-symbols.ver -lm -rpath /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib compatibility.lo compatibility-debug_list.lo compatibility-debug_list-2.lo  compatibility-c++0x.lo compatibility-atomic-c++0x.lo compatibility-thread-c++0x.lo compatibility-chrono.lo  ../libsupc++/libsupc++convenience.la ../src/c++98/libc++98convenience.la ../src/c++11/libc++11convenience.la 
libtool: link:  /usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/xgcc -shared-libgcc -B/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc -nostdinc++ -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src/.libs -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include --sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0   -shared -nostdlib /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib/crti.o /usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/crtbeginS.o  .libs/compatibility.o .libs/compatibility-debug_list.o .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o .libs/compatibility-chrono.o  -Wl,--whole-archive ../libsupc++/.libs/libsupc++convenience.a ../src/c++98/.libs/libc++98convenience.a ../src/c++11/.libs/libc++11convenience.a -Wl,--no-whole-archive  -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src/.libs -lm -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc -L/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin -L/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib -L/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib -lc -lgcc_s /usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/crtendS.o /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib/crtn.o  -Wl,-O1 -Wl,-z -Wl,relro -Wl,--gc-sections -Wl,--version-script=libstdc++-symbols.ver   -Wl,-soname -Wl,libstdc++.so.6 -o .libs/libstdc++.so.6
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib/libm.a(e_sinh.o): relocation R_X86_64_32S against `.rodata.cst16' can not be used when making a shared object; recompile with -fPIC
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib/libm.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[5]: *** [libstdc++.la] Error 1
make[5]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir'
make: *** [all] Error 2

how to recompile with -fPIC
HOWTO fix -fPIC errors

===================================================

../configure --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-nls --enable-libssp --enable-gold --enable-ld --target=x86_64-pc-freebsd10.0 --prefix=/usr/x86_64-freebsd --with-gmp=/usr/x86_64-freebsd --with-mpc=/usr/x86_64-freebsd --with-mpfr=/usr/x86_64-freebsd --disable-libgomp --enable-shared --with-sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0
/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/xgcc -B/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include    -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o cpuinfo_s.o sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: cannot find crti.o: No such file or directory
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: cannot find -lc
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[2]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir'
make: *** [all] Error 2

========================================

libtool: compile:  /usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/xgcc -shared-libgcc -B/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc -nostdinc++ -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src/.libs -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include --sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0 -I/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/include/x86_64-pc-freebsd10.0 -I/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/include -I/usr/x86_64-freebsd/src/gcc-4.8.3/libstdc++-v3/libsupc++ -fPIC -DPIC -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=compatibility-thread-c++0x.lo -g -O2 -std=gnu++11 -c ../../../../libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc -o compatibility-thread-c++0x.o >/dev/null 2>&1
/bin/bash ../libtool --tag CXX   --mode=link /usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/xgcc -shared-libgcc -B/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc -nostdinc++ -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src/.libs -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include --sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0   -Wl,-O1 -Wl,-z,relro -Wl,--gc-sections  -fPIC -DPIC  -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi  -fdiagnostics-show-location=once   -ffunction-sections -fdata-sections  -frandom-seed=libstdc++.la  -o libstdc++.la -version-info 6:19:0 -Wl,--version-script=libstdc++-symbols.ver -lm -rpath /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib compatibility.lo compatibility-debug_list.lo compatibility-debug_list-2.lo  compatibility-c++0x.lo compatibility-atomic-c++0x.lo compatibility-thread-c++0x.lo compatibility-chrono.lo  ../libsupc++/libsupc++convenience.la ../src/c++98/libc++98convenience.la ../src/c++11/libc++11convenience.la 
libtool: link:  /usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/xgcc -shared-libgcc -B/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc -nostdinc++ -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src/.libs -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include --sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0   -shared -nostdlib /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib/crti.o /usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/crtbeginS.o  .libs/compatibility.o .libs/compatibility-debug_list.o .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o .libs/compatibility-chrono.o  -Wl,--whole-archive ../libsupc++/.libs/libsupc++convenience.a ../src/c++98/.libs/libc++98convenience.a ../src/c++11/.libs/libc++11convenience.a -Wl,--no-whole-archive  -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src/.libs -lm -L/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc -L/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin -L/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib -L/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib -lc -lgcc_s /usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/crtendS.o /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib/crtn.o  -Wl,-O1 -Wl,-z -Wl,relro -Wl,--gc-sections -Wl,--version-script=libstdc++-symbols.ver   -Wl,-soname -Wl,libstdc++.so.6 -o .libs/libstdc++.so.6
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib/libm.a(e_sinh.o): relocation R_X86_64_32S against `.rodata.cst16' can not be used when making a shared object; recompile with -fPIC
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib/libm.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[5]: *** [libstdc++.la] Error 1
make[5]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir'
make: *** [all] Error 2

============================================

../configure --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-nls --enable-libssp --enable-gold --enable-ld --target=x86_64-pc-freebsd10.0 --prefix=/usr/x86_64-freebsd --with-gmp=/usr/x86_64-freebsd --with-mpc=/usr/x86_64-freebsd --with-mpfr=/usr/x86_64-freebsd --disable-libgomp
/bin/bash ../../../libgcc/../mkinstalldirs .
/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/xgcc -B/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/./gcc/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include    -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o cpuinfo_s.o sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[2]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir/x86_64-pc-freebsd10.0/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.8.3/objdir'
make: *** [all] Error 2

==================

../configure --with-gnu-as --with-gnu-ld --enable-languages=c --disable-nls --enable-libssp --enable-gold --enable-ld --target=x86_64-pc-freebsd10.0 --prefix=/usr/x86_64-freebsd --with-gmp=/usr/x86_64-freebsd --with-mpc=/usr/x86_64-freebsd --with-mpfr=/usr/x86_64-freebsd --disable-libgomp --enable-shared --with-build-sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0
libtool: link: /usr/x86_64-freebsd/src/gcc-4.7.4/objdir/./gcc/xgcc -B/usr/x86_64-freebsd/src/gcc-4.7.4/objdir/./gcc/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/sys-include --sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10.0   -shared  math/.libs/acoshq.o math/.libs/fmodq.o math/.libs/acosq.o math/.libs/frexpq.o math/.libs/rem_pio2q.o math/.libs/asinhq.o math/.libs/hypotq.o math/.libs/remainderq.o math/.libs/asinq.o math/.libs/rintq.o math/.libs/atan2q.o math/.libs/isinfq.o math/.libs/roundq.o math/.libs/atanhq.o math/.libs/isnanq.o math/.libs/scalblnq.o math/.libs/atanq.o math/.libs/j0q.o math/.libs/scalbnq.o math/.libs/cbrtq.o math/.libs/j1q.o math/.libs/signbitq.o math/.libs/ceilq.o math/.libs/jnq.o math/.libs/sincos_table.o math/.libs/complex.o math/.libs/ldexpq.o math/.libs/sincosq.o math/.libs/copysignq.o math/.libs/lgammaq.o math/.libs/sincosq_kernel.o math/.libs/coshq.o math/.libs/llroundq.o math/.libs/sinhq.o math/.libs/cosq.o math/.libs/log10q.o math/.libs/sinq.o math/.libs/cosq_kernel.o math/.libs/log1pq.o math/.libs/sinq_kernel.o math/.libs/erfq.o math/.libs/logq.o math/.libs/sqrtq.o math/.libs/expm1q.o math/.libs/lroundq.o math/.libs/tanhq.o math/.libs/expq.o math/.libs/modfq.o math/.libs/tanq.o math/.libs/fabsq.o math/.libs/nanq.o math/.libs/tgammaq.o math/.libs/finiteq.o math/.libs/nextafterq.o math/.libs/truncq.o math/.libs/floorq.o math/.libs/powq.o math/.libs/fmaq.o math/.libs/cacoshq.o math/.libs/cacosq.o math/.libs/casinhq.o math/.libs/casinq.o math/.libs/catanhq.o math/.libs/catanq.o math/.libs/cimagq.o math/.libs/conjq.o math/.libs/cprojq.o math/.libs/crealq.o math/.libs/fdimq.o math/.libs/fmaxq.o math/.libs/fminq.o math/.libs/ilogbq.o math/.libs/llrintq.o math/.libs/log2q.o math/.libs/lrintq.o math/.libs/nearbyintq.o math/.libs/remquoq.o printf/.libs/addmul_1.o printf/.libs/add_n.o printf/.libs/cmp.o printf/.libs/divrem.o printf/.libs/flt1282mpn.o printf/.libs/fpioconst.o printf/.libs/lshift.o printf/.libs/mul_1.o printf/.libs/mul_n.o printf/.libs/mul.o printf/.libs/printf_fphex.o printf/.libs/printf_fp.o printf/.libs/quadmath-printf.o printf/.libs/rshift.o printf/.libs/submul_1.o printf/.libs/sub_n.o strtod/.libs/strtoflt128.o strtod/.libs/mpn2flt128.o strtod/.libs/tens_in_limb.o   -lm  -Wl,--version-script=../../../libquadmath/quadmath.map   -Wl,-soname -Wl,libquadmath.so.0 -o .libs/libquadmath.so.0
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: /usr/x86_64-freebsd/x86_64-pc-freebsd10.0/usr/lib/libm.a(fenv.o): relocation R_X86_64_PC32 against undefined symbol `__stack_chk_guard@@FBSD_1.0' can not be used when making a shared object; recompile with -fPIC
/usr/x86_64-freebsd/x86_64-pc-freebsd10.0/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[3]: *** [libquadmath.la] Error 1
make[3]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.7.4/objdir/x86_64-pc-freebsd10.0/libquadmath'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.7.4/objdir/x86_64-pc-freebsd10.0/libquadmath'
make[1]: *** [all-target-libquadmath] Error 2
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.7.4/objdir'
make: *** [all] Error 2

================================

binutils

 ./configure \
--enable-libssp \
--enable-gold \
--enable-ld \
--target=x86_64-pc-freebsd10 \
--prefix=/usr/x86_64-freebsd \
--with-sysroot=/usr/x86_64-freebsd/x86_64-pc-freebsd10 \
--enable-static \
--enable-shared
/bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2  -release `cat libtool-soversion`  -static-libstdc++ -static-libgcc  -o libbfd.la -rpath /usr/x86_64-freebsd/i686-pc-linux-gnu/x86_64-pc-freebsd10/lib archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo merge.lo dwarf2.lo simple.lo compress.lo verilog.lo `cat ofiles` -L/usr/x86_64-freebsd/src/binutils-2.24/bfd/../libiberty/pic -liberty -Wl,-lc,--as-needed,-lm,--no-as-needed  -lz 
libtool: link: gcc -shared  .libs/archures.o .libs/targets.o .libs/dwarf2.o   -L/usr/x86_64-freebsd/src/binutils-2.24/bfd/../libiberty/pic -liberty -lz  -Wl,-lc -Wl,--as-needed -Wl,-lm -Wl,--no-as-needed   -Wl,-soname -Wl,libbfd-2.24.so -o .libs/libbfd-2.24.so
/usr/bin/ld: cannot find -liberty
collect2: error: ld returned 1 exit status
make[4]: *** [libbfd.la] Error 1
make[4]: Leaving directory `/usr/x86_64-freebsd/src/binutils-2.24/bfd'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/x86_64-freebsd/src/binutils-2.24/bfd'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/x86_64-freebsd/src/binutils-2.24/bfd'
make[1]: *** [all-bfd] Error 2
make[1]: Leaving directory `/usr/x86_64-freebsd/src/binutils-2.24'
make: *** [all] Error 2
$ pkg search libiberty
gnulibiberty-2.19.1_2

$ pkg install gnulibiberty-2.19.1_2
The following 1 packages will be affected (of 0 checked):
New packages to be INSTALLED:
	gnulibiberty: 2.19.1_2
The process will require 449 KB more space
111 KB to be downloaded
Proceed with this action [y/N]: y
Fetching gnulibiberty-2.19.1_2.txz: 100% of 111 KB
Checking integrity... done (0 conflicting)
[1/1] Installing gnulibiberty-2.19.1_2: 100%

$ find /usr/local -name 'libiberty*'
/usr/local/include/libiberty
/usr/local/include/libiberty/libiberty.h
/usr/local/lib/libiberty.a
# apt-cache search libiberty
libiberty-dev - library of utility functions used by GNU programs

$ sudo apt-get install libiberty-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libiberty-dev
0 upgraded, 1 newly installed, 0 to remove and 21 not upgraded.
Need to get 135 kB of archives.
After this operation, 542 kB of additional disk space will be used.
Get:1 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/main libiberty-dev i386 20131116-1 [135 kB]
Fetched 135 kB in 0s (731 kB/s)   
Selecting previously unselected package libiberty-dev:i386.
(Reading database ... 324870 files and directories currently installed.)
Preparing to unpack .../libiberty-dev_20131116-1_i386.deb ...
Unpacking libiberty-dev:i386 (20131116-1) ...
Setting up libiberty-dev:i386 (20131116-1) ...
/usr/x86_64-freebsd/src/gcc-4.9.1/objdir/./gcc/xgcc
-B/usr/x86_64-freebsd/src/gcc-4.9.1/objdir/./gcc/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10/sys-include -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o cpuinfo_s.o sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/usr/x86_64-freebsd/x86_64-pc-freebsd10/bin/ld: /usr/x86_64-freebsd/x86_64-pc-freebsd10/lib/libc.a(jemalloc_jemalloc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/x86_64-freebsd/x86_64-pc-freebsd10/lib/libc.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status


lrwxrwxrwx 1 root root      17 Aug 31 14:41 libc.a -> ../usr/lib/libc.a
-r--r--r-- 1 root root 1567216 Jan 16  2014 libc.so.7


/usr/x86_64-freebsd/src/gcc-4.9.1/objdir/./gcc/xgcc -B/usr/x86_64-freebsd/src/gcc-4.9.1/objdir/./gcc/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10/bin/ -B/usr/x86_64-freebsd/x86_64-pc-freebsd10/lib/ -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10/include -isystem /usr/x86_64-freebsd/x86_64-pc-freebsd10/sys-include    -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o cpuinfo_s.o sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/usr/x86_64-freebsd/x86_64-pc-freebsd10/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[2]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.9.1/objdir/x86_64-pc-freebsd10/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/usr/x86_64-freebsd/src/gcc-4.9.1/objdir'
make: *** [all] Error 2

packETH

checking for DEPS... no
configure: error: Package requirements (gtk+-2.0 >= 2.4 glib-2.0 >= 2.4 gthread-2.0 >= 2.4) were not met:

No package 'gtk+-2.0' found
No package 'glib-2.0' found
No package 'gthread-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables DEPS_CFLAGS
and DEPS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
$ sudo apt-get install libgtk2.0-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gir1.2-gtk-2.0 libatk1.0-dev libcairo2-dev libexpat1-dev libfontconfig1-dev
  libfreetype6-dev libgdk-pixbuf2.0-dev libglib2.0-dev libharfbuzz-dev
  libharfbuzz-gobject0 libice-dev libpango1.0-dev libpcre3-dev libpcrecpp0
  libpixman-1-dev libpng12-dev libpthread-stubs0-dev libsm-dev libx11-dev
  libx11-doc libxau-dev libxcb-render0-dev libxcb-shm0-dev libxcb1-dev
  libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev
  libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxml2-utils
  libxrandr-dev libxrender-dev x11proto-composite-dev x11proto-core-dev
  x11proto-damage-dev x11proto-fixes-dev x11proto-input-dev x11proto-kb-dev
  x11proto-randr-dev x11proto-render-dev x11proto-xext-dev
  x11proto-xinerama-dev xorg-sgml-doctools xtrans-dev zlib1g-dev
gcc  -g -O2   -o packETH src/main.o src/support.o src/interface.o src/callbacks.o src/function.o src/function_send.o src/loadpacket.o src/savepacket.o  -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lfreetype -lgthread-2.0 -lglib-2.0  
/usr/bin/ld: src/callbacks.o: undefined reference to symbol 'lroundf@@GLIBC_2.1'
//lib/i386-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [packETH] Error 1
make[1]: Leaving directory `/home/ines/src/packETH-1.7.3'
make: *** [all] Error 2

Remote Authentication Dial-In User Service (RADIUS) Authentication, Authorization, and Accounting

Remote Authentication Dial-In User Service (RADIUS) Authentication, Authorization, and Accounting in Windows
Radius GINA Credential Provider OTP Anmeldung an Windows und Terminalserver
Windows XP login using Radius authentication
To set up 802.1x authentication
PEAP Authentication – Configuration example for Windows XP
RADIUS-Server
Radius mit Windows Server – Server, Clients und WLAN richtig konfigurieren
Using Windows 2008 For RADIUS Authentication

LDAP

FreeRADIUS on FreeBSD and OpenLDAP

Radius authentication using LDAP
Setting Up RADIUS To Use LDAP
Steps to Install and Configure OpenLDAP Server and FreeRadius
Setup FreeRadius Authentication with OpenLDAP
FreeRADIUS + 802.1x/WPA + OpenLDAP HOWTO

Raumenergie / Freie Energie

100-days.net: Raumenergie – Die saubere Energie der Zukunft

Dies ist die offizielle Webseite von Prof. Dr. Claus W. Turtur
Profil: . Dr. rer. nat. Claus W. Turtur
Raumenergie Teil 1: Die Energie der Zukunft

Kopp-Verlag: Freie Energie für alle Menschen

Induktiver Raumenergie Resonanz Converter
Die Angst vieler Physiker vor der Raumenergie, eine wissenschaftssoziologische Betrachtung – Teil 2

du sollst nicht wissen: Raumenergie

Raumenergie – Die Energieform der Zukunft!

Wikipedia

Freie Energie
Vakuumenergie

syslog Protocol

RFC – Request for Comments

RFC 3164 – The BSD syslog Protocol, August 2001
RFC 3195 – Reliable Delivery for syslog
RFC 5424 – The Syslog Protocol, March 2009
RFC 5425 – TLS Transport Mapping for Syslog
RFC 5426 – Transmission of Syslog Messages over UDP
RFC 5427 – Textual Conventions for Syslog Management
RFC 5848 – Signed Syslog Messages
RFC 6012 – Datagram Transport Layer Security (DTLS) Transport Mapping for Syslog
RFC 6587 – Transmission of Syslog Messages over TCP, April 2012

glibc

openlog
syslog

#include <stdio.h>
#include <unistd.h>
#include <syslog.h>

int
main(void)
{
   openlog("slog", LOG_PID | LOG_CONS, LOG_USER);
   syslog(LOG_INFO, "A different kind of Hello world ... ");
   closelog();

   return 0;
}

rsyslog

Rsyslog mit MySQL als zentraler Logserver
Fedora: Viewing and Managing Log Files
Centralized RSYSLOG Server Monitoring
How to Setup Centralized Logging Server using Rsyslog
Advanced Unix logging tips
RSyslog on FreeBSD
Rsyslog + MySQL on FreeBSD
gentoo Linux: rsyslog

BSD-Style blocks will go away in rsyslog v7
Filtering by program name

!prog1
 *.* /var/log/prog1.log
 *.* /var/log/prog1again.log
!prog2
 *.* /var/log/prog2.log
 *.* /var/log/prog2again.log
 if $programname == 'prog1' then {
   /var/log/prog1.log
   /var/log/prog1again.log
}
if $programname == 'prog2' then {
   /var/log/prog2.log
   /var/log/prog2again.log
}
<43>1 2015-11-10T17:27:18.354950+01:00 bsd rsyslogd-2304 - - - BSD-style blocks are no longer supported in rsyslog, see http://www.rsyslog.com/g/BSD for details and a solution (Block '!-devd') [try http://www.rsyslog.com/e/2304 ]
<43>1 2015-11-10T17:27:18.356323+01:00 bsd rsyslogd-2184 - - - action '*' treated as ':omusrmsg:*' - please change syntax, '*' will not be supported in the future [try http://www.rsyslog.com/e/2184 ]
<43>1 2015-11-10T17:27:18.356426+01:00 bsd rsyslogd-2207 - - - error during parsing file /usr/local/etc/rsyslog.conf, on or before line 27: warnings occured in file '/usr/local/etc/rsyslog.conf' around line 27 [try http://www.rsyslog.com/e/2207 ]
<43>1 2015-11-10T17:27:18.356455+01:00 bsd rsyslogd-2207 - - - error during parsing file /usr/local/etc/rsyslog.conf, on or before line 27: invalid character ';' - is there an invalid escape sequence somewhere? [try http://www.rsyslog.com/e/2207 ]
<43>1 2015-11-10T17:27:18.356496+01:00 bsd rsyslogd-2184 - - - action 'RSYSLOG_SyslogProtocol23Format' treated as ':omusrmsg:RSYSLOG_SyslogProtocol23Format' - please change syntax, 'RSYSLOG_SyslogProtocol23Format' will not be supported in the future [try http://www.rsyslog.com/e/2184 ]
<43>1 2015-11-10T17:27:18.356512+01:00 bsd rsyslogd-3000 - - - user name 'RSYSLOG_...' too long - ignored
<43>1 2015-11-10T17:27:18.356562+01:00 bsd rsyslogd-2207 - - - error during parsing file /usr/local/etc/rsyslog.conf, on or before line 27: warnings occured in file '/usr/local/etc/rsyslog.conf' around line 27 [try http://www.rsyslog.com/e/2207 ]
<43>1 2015-11-10T17:27:18.356653+01:00 bsd rsyslogd-2304 - - - BSD-style blocks are no longer supported in rsyslog, see http://www.rsyslog.com/g/BSD for details and a solution (Block '!ppp') [try http://www.rsyslog.com/e/2304 ]
<43>1 2015-11-10T17:27:18.356703+01:00 bsd rsyslogd-2304 - - - BSD-style blocks are no longer supported in rsyslog, see http://www.rsyslog.com/g/BSD for details and a solution (Block '!*') [try http://www.rsyslog.com/e/2304 ]

<27>1 2015-11-10T17:27:19.482482+01:00 bsd nmbd 1737 - -  [2015/11/10 17:27:19.481957,  0] ../lib/util/become_daemon.c:136(daemon_ready)
<27>1 2015-11-10T17:27:21.750548+01:00 bsd smbd 1740 - -  [2015/11/10 17:27:21.749661,  0] ../lib/util/become_daemon.c:136(daemon_ready)
<27>1 2015-11-10T17:27:21.760813+01:00 bsd smbd 1740 - -    STATUS=daemon 'smbd' finished starting up and ready to serve connectionsFailed to fetch record!
<27>1 2015-11-10T17:27:21.819782+01:00 bsd winbindd 1744 - -  [2015/11/10 17:27:21.819054,  0] ../source3/winbindd/winbindd_cache.c:3196(initialize_winbindd_cache)
<27>1 2015-11-10T17:27:21.820014+01:00 bsd winbindd 1744 - -    initialize_winbindd_cache: clearing cache and re-creating with version number 2
<27>1 2015-11-10T17:27:21.838248+01:00 bsd winbindd 1744 - -  [2015/11/10 17:27:21.838055,  0] ../lib/util/become_daemon.c:136(daemon_ready)

<11>1 2015-11-10T17:27:22.099952+01:00 bsd freevrrpd 1796 - -  cannot create a netgraph socket: No such file or directory
<10>1 2015-11-10T17:27:22.100123+01:00 bsd freevrrpd 1796 - -  cannot create a bridge device: No such file or directory
<10>1 2015-11-10T17:27:22.100257+01:00 bsd freevrrpd 1796 - -  aborting...

Protocol

Wikipedia Syslog Facility Levels
Unix – System Logging

#define LOG_EMERG       0       /* system is unusable */
#define LOG_ALERT       1       /* action must be taken immediately */
#define LOG_CRIT        2       /* critical conditions */
#define LOG_ERR         3       /* error conditions */
#define LOG_WARNING     4       /* warning conditions */
#define LOG_NOTICE      5       /* normal but significant condition */
#define LOG_INFO        6       /* informational */
#define LOG_DEBUG       7       /* debug-level messages */
#define LOG_KERN        (0<<3)  /* kernel messages */
#define LOG_USER        (1<<3)  /* random user-level messages */
#define LOG_MAIL        (2<<3)  /* mail system */
#define LOG_DAEMON      (3<<3)  /* system daemons */
#define LOG_AUTH        (4<<3)  /* security/authorization messages */
#define LOG_SYSLOG      (5<<3)  /* messages generated internally by syslogd */
#define LOG_LPR         (6<<3)  /* line printer subsystem */
#define LOG_NEWS        (7<<3)  /* network news subsystem */
#define LOG_UUCP        (8<<3)  /* UUCP subsystem */
#define LOG_CRON        (9<<3)  /* clock daemon */
#define LOG_AUTHPRIV    (10<<3) /* security/authorization messages (private) */
#define LOG_FTP         (11<<3) /* ftp daemon */
#define LOG_LOCAL0      (16<<3) /* reserved for local use */
#define LOG_LOCAL1      (17<<3) /* reserved for local use */
#define LOG_LOCAL2      (18<<3) /* reserved for local use */
#define LOG_LOCAL3      (19<<3) /* reserved for local use */
#define LOG_LOCAL4      (20<<3) /* reserved for local use */
#define LOG_LOCAL5      (21<<3) /* reserved for local use */
#define LOG_LOCAL6      (22<<3) /* reserved for local use */
#define LOG_LOCAL7      (23<<3) /* reserved for local use */
#define LOG_FAC_INVLD   24
#define LOG_INVLD       (LOG_FAC_INVLD<<3)      /* invalid facility/PRI code */
syslogName_t    syslogFacNames[] = {
        {"auth",         LOG_AUTH},
        {"authpriv",     LOG_AUTHPRIV},
        {"cron",         LOG_CRON},
        {"daemon",       LOG_DAEMON},
        {"kern",         LOG_KERN},
        {"lpr",          LOG_LPR},
        {"mail",         LOG_MAIL},
        {"mark",         LOG_MARK},             /* INTERNAL */
        {"news",         LOG_NEWS},
        {"security",     LOG_AUTH},             /* DEPRECATED */
        {"bsd_security", (13<<3) },             /* BSD-specific, unfortunatly with duplicate name... */
        {"syslog",       LOG_SYSLOG},
        {"user",         LOG_USER},
        {"uucp",         LOG_UUCP},
        {"ftp",          LOG_FTP},
        {"audit",        LOG_AUDIT},
        {"console",      (14 << 3)},            /* BSD-specific priority */
        {"local0",       LOG_LOCAL0},
        {"local1",       LOG_LOCAL1},
        {"local2",       LOG_LOCAL2},
        {"local3",       LOG_LOCAL3},
        {"local4",       LOG_LOCAL4},
        {"local5",       LOG_LOCAL5},
        {"local6",       LOG_LOCAL6},
        {"local7",       LOG_LOCAL7},
        {"invld",        LOG_INVLD},
        {NULL,           -1},
};

Wikipedia

Syslog (de)
Syslog (en)

Other Resources

RFC Base: The Syslog Protocol
Introduction to Syslog Protocol

Other implementations

loggy

FreeBSD as a Wireless Access Point (WAP)

FreeBSD Handbook: 30.3. Wireless Networking
FreeBSD Handbuch: 32.3. Drahtlose Netzwerke

FreeBSD 10.0-RELEASE Hardware Notes

Quick Wireless Setup On FreeBSD
Howto create a FreeBSD wireless router/access point
How To Set Up A FreeBSD Wireless Access Point
My home firewall router with FreeBSD—A year retrospective
Building my own wireless point

hostapd

hostapd(8) – authenticator for IEEE 802.11 networks
hostapd.conf(5) – configuration file for hostapd(8) utility

interface=wlan0
debug=1
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
ssid=Test Wifi
hw_mode=g
macaddr_acl=0
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=*****
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP

802.11n

ath(4) = Atheros Cardbus and PCI cards (AR5416, AR5418, AR9130,AR9160, AR9220, AR9280, AR9285, AR9227, AR9287
ipw(4) = Intel PRO/Wireless 2100 MiniPCI network adapter
iwi(4) = Intel PRO/Wireless 2200BG/2915ABG MiniPCI and 2225BG PCI network adapters
iwn(4) = Intel Wireless WiFi Link 4965AGN IEEE 802.11n PCI network adapters
wpi(4) = Intel 3945ABG Wireless LAN IEEE 802.11 driver

802.11n support for the ath(4) NICs
iwn(4) Intel 802.11n series NICs
ath and 802.11n on FreeBSD 10.0
WiFi configuration in FreeBSD (including WPA/WPA2)

# wlandebug
net.wlan.0.debug: 0x0

# wlandebug +11n 
net.wlan.0.debug: 0x0 => 0x80000000<11n>
wlan0: Ethernet address: 04:f0:21:0c:2b:a6
wlan0: [f8:01:13:05:ef:1f] ieee80211_ht_node_init: called
wlan0: [f8:01:13:05:ef:1f] switch station to HT20 channel 2412/0x10480
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 1 sta, 1 ht, 0 ht40, HT protmode now 0x2
wlan0: [f8:01:13:05:ef:1f] recv ADDBA request: dialogtoken 98 baparamset 0x402 (tid 0 bufsiz 16) batimeout 0 baseqctl 5:0
wlan0: [f8:01:13:05:ef:1f] send ADDBA response: dialogtoken 98 status 0 baparamset 0x402 (tid 0) batimeout 0x0 baseqctl 0x0
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 0 sta, 0 ht, 0 ht40, HT protmode now 0x0
wlan0: [f8:01:13:05:ef:1f] ieee80211_ht_node_cleanup: called
wlan0: [f8:01:13:05:ef:1f] ieee80211_ht_node_init: called
wlan0: [f8:01:13:05:ef:1f] switch station to HT20 channel 2412/0x10480
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 1 sta, 1 ht, 0 ht40, HT protmode now 0x2
wlan0: [f8:01:13:05:ef:1f] recv ADDBA request: dialogtoken 173 baparamset 0x402 (tid 0 bufsiz 16) batimeout 0 baseqctl 5:0
wlan0: [f8:01:13:05:ef:1f] send ADDBA response: dialogtoken 173 status 0 baparamset 0x402 (tid 0) batimeout 0x0 baseqctl 0x0
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 0 sta, 0 ht, 0 ht40, HT protmode now 0x0
wlan0: [f8:01:13:05:ef:1f] ieee80211_ht_node_cleanup: called
wlan0: [f8:01:13:05:ef:1f] ieee80211_ht_node_init: called
wlan0: [f8:01:13:05:ef:1f] switch station to HT20 channel 2412/0x10480
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 1 sta, 1 ht, 0 ht40, HT protmode now 0x2
wlan0: [f8:01:13:05:ef:1f] recv ADDBA request: dialogtoken 248 baparamset 0x402 (tid 0 bufsiz 16) batimeout 0 baseqctl 5:0
wlan0: [f8:01:13:05:ef:1f] send ADDBA response: dialogtoken 248 status 0 baparamset 0x402 (tid 0) batimeout 0x0 baseqctl 0x0
wlan0: [f8:01:13:05:ef:1f] discard MPDU frame, BA win <6:21> (0 frames) rxseq 5 tid 0 (retransmit)
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 0 sta, 0 ht, 0 ht40, HT protmode now 0x0
wlan0: [f8:01:13:05:ef:1f] ieee80211_ht_node_cleanup: called
wlan0: [38:0b:40:23:88:53] ieee80211_ht_node_init: called
wlan0: [38:0b:40:23:88:53] switch station to HT20 channel 2412/0x10480
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 1 sta, 1 ht, 0 ht40, HT protmode now 0x2
wlan0: [38:0b:40:23:88:53] recv ADDBA request: dialogtoken 120 baparamset 0x802 (tid 0 bufsiz 32) batimeout 0 baseqctl 0:0
wlan0: [38:0b:40:23:88:53] send ADDBA response: dialogtoken 120 status 0 baparamset 0x802 (tid 0) batimeout 0x0 baseqctl 0x0
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 0 sta, 0 ht, 0 ht40, HT protmode now 0x0
wlan0: [38:0b:40:23:88:53] ieee80211_ht_node_cleanup: called
wlan0: [38:0b:40:23:88:53] ieee80211_ht_node_init: called
wlan0: [38:0b:40:23:88:53] switch station to HT20 channel 2412/0x10480
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 1 sta, 1 ht, 0 ht40, HT protmode now 0x2
wlan0: [38:0b:40:23:88:53] recv ADDBA request: dialogtoken 203 baparamset 0x802 (tid 0 bufsiz 32) batimeout 0 baseqctl 0:0
wlan0: [38:0b:40:23:88:53] send ADDBA response: dialogtoken 203 status 0 baparamset 0x802 (tid 0) batimeout 0x0 baseqctl 0x0
wlan0: [38:0b:40:23:88:53] discard MPDU frame, BA win <7:38> (0 frames) rxseq 6 tid 0 (retransmit)
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 0 sta, 0 ht, 0 ht40, HT protmode now 0x0
wlan0: [38:0b:40:23:88:53] ieee80211_ht_node_cleanup: called
wlan0: [38:0b:40:23:88:53] ieee80211_ht_node_init: called
wlan0: [38:0b:40:23:88:53] switch station to HT20 channel 2412/0x10480
wlan0: [04:f0:21:0c:2b:a6] HT bss occupancy change: 1 sta, 1 ht, 0 ht40, HT protmode now 0x2
wlan0: [38:0b:40:23:88:53] recv ADDBA request: dialogtoken 26 baparamset 0x802 (tid 0 bufsiz 32) batimeout 0 baseqctl 0:0
wlan0: [38:0b:40:23:88:53] send ADDBA response: dialogtoken 26 status 0 baparamset 0x802 (tid 0) batimeout 0x0 baseqctl 0x0
ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether 04:f0:21:0c:2b:a6
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng <hostap>
	status: running
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 04:f0:21:0c:2b:a6
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng <hostap>
	status: running

Open:	ssid BACHI.NET channel 1 (2412 MHz 11g ht/40+) bssid 04:f0:21:0c:2b:a6
	country US ecm authmode OPEN privacy OFF txpower 27 scanvalid 60
	protmode CTS ampdulimit 64k ampdudensity 8 shortgi wme burst
	dtimperiod 1 -dfs

WPA US: ssid BACHI.NET channel 1 (2412 MHz 11g ht/40+) bssid 04:f0:21:0c:2b:a6
        country US ecm authmode WPA privacy MIXED deftxkey 2 TKIP 2:128-bit
        txpower 27 scanvalid 60 protmode CTS ampdulimit 64k ampdudensity 8
        shortgi wme burst dtimperiod 1 -dfs

WPA CH: ssid BACHI.NET channel 1 (2412 MHz 11g ht/40+) bssid 04:f0:21:0c:2b:a6
        regdomain ETSI country CH ecm authmode WPA privacy MIXED deftxkey 3
        TKIP 2:128-bit TKIP 3:128-bit txpower 30 scanvalid 60 protmode CTS
        ampdulimit 64k ampdudensity 8 shortgi wme burst dtimperiod 1 -dfs
# ifconfig wlan0 list sta
ADDR               AID CHAN RATE RSSI IDLE  TXSEQ  RXSEQ CAPS FLAG   
f8:01:13:05:ef:1f    1    1  21M 17.0    0     24  27152 EPS  AQEPHTR HTCAP WME WPA
38:0b:40:23:88:53    2    1  43M 12.5    0      6  12336 EPS  AQEHTR  HTCAP WPA WME
# bsd-airtools
# wicontrol

Multi-SSID

FreeBSDAccessPoint
FreeBSDOnEmbeddedDevice

# Eudoroam internal wired and wireless
ifconfig_sis0="up"
create_args_wlan0="wlanmode hostap mode 11g ssid eduroam.test up"
ifconfig_bridge0="addm wlan0 addm sis0 up"
ipv4_addrs_bridge0="192.168.42.1/24 192.168.1.2/24"

# Wireless Leiden Hub
ifconfig_sis2="up"
create_args_wlan1="wlanmode hostap bssid mode 11g ssid
ap-raam.snuit.wleiden.net up"
ifconfig_bridge1="addm wlan1 addm sis2 DHCP"

# Authentication enabled on my personal access point (wlan0)
hostapd_enable="YES"
interface=wlan0
driver=bsd

logger_syslog=-1
logger_syslog_level=0
logger_stdout=-1
logger_stdout_level=2
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0

macaddr_acl=0
auth_algs=1

wpa=1
wpa_passphrase=FooBarPass
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
EOF

multi vap Multi-SSID with ath on FreeBSD 10-current
multiple ssid’s over a single physical wireless interface
Trouble setting up multi SSID and 802.1X
Multiple SSIDs with hostapd (Linux)

$ ifconfig wlan0 create wlandev ath0 wlanmode monitor
$ ifconfig wlan0 channel 6
$ ifconfig wlan0 up
$ tcpdump -ni wlan0 -y IEEE802_11_RADIO
$ tcpdump -ni wlan0 -y IEEE802_11_RADIO -s0 -l -v -w output.pcap

WPA-EAP

FreeBSD + Freeradius2 + EAP-TLS + ssl-admin, a WPA2 Enterprise Guide
WPA2 Enterprise using DD-WRT and FreeBSD
hostapd: IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Wpa/WPA2-Radius+EAP-TLS/EAP-PEAP
Setting up WLAN network with EAP-TLS using only PC hardware and free software