Snort cross-compiling - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Snort cross-compiling

topf23topf23 Posts: 2Member
Hey experts,

i'm trying to cross-compile snort for a arm-linux architecture.
i already downloaded a toolchain and tested it with a smal hello-world.c .. the compiling successed and it worked on the arm-arch.

so cross-compiling snort is a way hard, of course.

i tried something stupid, like change the Makefile-entries from gcc to arm-linux-gcc and stuff .. and of course i didnt worked.

so i tried to use the configure script and configure it with the --host-command.
>> ./configure --prefix/.. --host=arm-linux

this works for using the right compiler.

configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for arm-linux-strip... arm-linux-strip
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for arm-linux-gcc... arm-linux-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
.
.

and so on.

but if the configure-script checks for the libs and includes of libpcap and pcrep it fails:

checking for sizeof(unsigned long)... configure: error: cannot run test program while cross compiling
See `config.log' for more details.
32 bits
checking for __FUNCTION__... yes
checking for floor in -lm... yes
checking for pcap_datalink in -lpcap... no
checking pfring.h usability... no
checking pfring.h presence... no
checking for pfring.h... no
checking for pfring_open in -lpfring... no
checking for pfring_open in -lpcap... no

ERROR! Libpcap library/headers (libpcap.a (or .so)/pcap.h)
not found, go get it from http://www.tcpdump.org
or use the --with-libpcap-* options, if you have it installed
in unusual place. Also check if your libpcap depends on another
shared library that may be installed in an unusual place
checking for libpcap version >= 0.9... configure: error: cannot run test program while cross compiling
See `config.log' for more details.

checking pcre.h usability... yes
checking pcre.h presence... yes
checking for pcre.h... yes
checking for pcre_compile in -lpcre... no

ERROR! Libpcre library not found.
Get it from http://www.pcre.org

no

ERROR! Libpcre library version >= 6.0 not found.
Get it from http://www.pcre.org

checking for dlsym in -ldl... yes
checking for u_int8_t... yes
checking for u_int16_t... yes
.
.

the configure-statement was the following:
sudo ./configure --prefix=/tmp/snort/ --host=arm-linux --with-libpcap-libraries=/usr/local/lib/ --with-libpcre-includes=/usr/include/ --with-libpcre-libraries=/usr/lib/ --with-libpcap-includes=/usr/local/include/

i changed some entries in the configure-script to dont exit at this errors.
doing this it will finish. after that i tried to "make".

and of course it doesnt worked.
..
include/ -I/usr/include/ -g -O2 -Wall -DDYNAMIC_PLUGIN -DDETECTION_OPTION_TREE -c ipobj.c
/tmp/ccxGleZM.s: Assembler messages:
/tmp/ccxGleZM.s:2054: Error: bad instruction `rorw $8,r3'
/tmp/ccxGleZM.s:2054: Error: bad instruction `rorl $16,r3'
/tmp/ccxGleZM.s:2054: Error: bad instruction `rorw $8,r3'
/tmp/ccxGleZM.s:2060: Error: bad instruction `rorw $8,r2'
/tmp/ccxGleZM.s:2060: Error: bad instruction `rorl $16,r2'
/tmp/ccxGleZM.s:2060: Error: bad instruction `rorw $8,r2'
/tmp/ccxGleZM.s:2103: Error: bad instruction `rorw $8,r0'
/tmp/ccxGleZM.s:2103: Error: bad instruction `rorl $16,r0'
/tmp/ccxGleZM.s:2103: Error: bad instruction `rorw $8,r0'
/tmp/ccxGleZM.s:2186: Error: bad instruction `rorw $8,r0'
/tmp/ccxGleZM.s:2186: Error: bad instruction `rorl $16,r0'
/tmp/ccxGleZM.s:2186: Error: bad instruction `rorw $8,r0'
make[3]: *** [ipobj.o] Error 1
make[3]: Leaving directory `/home/snortsensor/Desktop/setups/snortixp/src/sfutil'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/snortsensor/Desktop/setups/snortixp/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/snortsensor/Desktop/setups/snortixp'
make: *** [all] Error 2

..

im sure i have the right libpcap and pcre libs installed, because it works fine, if i compile snort without the --host-command.

honestly im not very familiar with linux, yet. so if i did some stupid mistakes it depends on my dumbness with linux.
im using ubuntu 8.10

so is there anybody who could help? this would be grateful.

thx a lot

topf










Comments

  • topf23topf23 Posts: 2Member
    im a step closer.
    i cross-compiled libpcap and pcre and set the include-paths to the configure.
    the configure finishs fine. but "make" exits with the following:

    ....
    nsl -ldl
    mkdir .libs
    arm-linux-gcc -I/usr/include/ -I/usr/local/arm-linux/include/ -Wall -DDYNAMIC_PLUGIN -DDETECTION_OPTION_TREE -o snort codes.o debug.o decode.o log.o mstring.o parser.o profiler.o plugbase.o snort.o snprintf.o strlcatu.o strlcpyu.o tag.o ubi_BinTree.o ubi_SplayTree.o util.o detect.o signature.o mempool.o sf_sdlist.o fpcreate.o fpdetect.o pcrm.o byte_extract.o sfthreshold.o packet_time.o event_wrapper.o event_queue.o inline.o ppm.o log_text.o -L/tmp/libpcap/lib/ -L/tmp/pcre/lib/ output-plugins/libspo.a detection-plugins/libspd.a dynamic-plugins/libdynamic.a preprocessors/libspp.a preprocessors/flow/portscan/libportscan.a preprocessors/flow/libflow.a parser/libparser.a target-based/libtarget_based.a preprocessors/HttpInspect/libhttp_inspect.a preprocessors/Stream5/libstream5.a sfutil/libsfutil.a /tmp/pcre/lib/libpcre.so -lpcap -lm -lnsl -ldl -Wl,--rpath -Wl,/tmp/pcre/lib -Wl,--rpath -Wl,/tmp/pcre/lib
    mstring.o(.text+0xc4): In function `mSplit':
    : undefined reference to `__ctype_b_loc'
    mstring.o(.text+0x27c): In function `mSplit':
    : undefined reference to `__ctype_b_loc'
    parser.o(.text+0x1690): In function `ContinuationCheck':
    : undefined reference to `__ctype_b_loc'
    parser.o(.text+0x1754): In function `CheckRule':
    : undefined reference to `__ctype_b_loc'
    parser.o(.text+0x17dc): In function `CheckRule':
    : undefined reference to `__ctype_b_loc'
    parser.o(.text+0x4c94): more undefined references to `__ctype_b_loc' follow
    util.o(.text+0x1454): In function `CreatePidFile':
    : undefined reference to `__xpg_strerror_r'
    signature.o(.text+0x1e4): In function `ParseReference':
    : undefined reference to `__ctype_b_loc'
    signature.o(.text+0x23c): In function `ParseReference':
    : undefined reference to `__ctype_b_loc'
    signature.o(.text+0x500): In function `ParseReferenceSystemConfig':
    : undefined reference to `__ctype_b_loc'
    signature.o(.text+0x5a4): In function `ParseSID':
    : undefined reference to `__ctype_b_loc'
    signature.o(.text+0x5e8): In function `ParseSID':
    : undefined reference to `__ctype_b_loc'
    signature.o(.text+0x6b4): more undefined references to `__ctype_b_loc' follow
    collect2: ld returned 1 exit status
    make[3]: *** [snort] Error 1
    make[3]: Leaving directory `/home/snortsensor/Desktop/setups/snortixp/src'
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory `/home/snortsensor/Desktop/setups/snortixp/src'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/snortsensor/Desktop/setups/snortixp'
    make: *** [all] Error 2

    configure:

    sudo CFLAGS="-I/usr/include/ -I/usr/local/arm-linux/include/" ./configure --prefix=/tmp/snort/ --host=arm-linux --with-libpcap-libraries=/tmp/libpcap/lib/ --with-libpcre-includes=/tmp/pcre/include/ --with-libpcre-libraries=/tmp/pcre/lib/ --with-libpcap-includes=/tmp/libpcap/include/


  • kumawat10kumawat10 Posts: 3Member
    Hey did u solve the error and get a crosscompiled snort?? I too m stuck there so pls help if u got it solved..

    Thanks
  • kumawat10kumawat10 Posts: 3Member
    Hey did u solve the error and get a crosscompiled snort?? I too m stuck there so pls help if u got it solved..

    Thanks
  • kumawat10kumawat10 Posts: 3Member
    Hey did u solve the error and get a crosscompiled snort?? I too m stuck there so pls help if u got it solved..

    Thanks
Sign In or Register to comment.