Aircrack-ng forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Aircrack-ng 1.7 release

Sorry Guest, you are banned from posting and sending personal messages on this forum.
This ban is not set to expire.
Pages: [1]   Go Down

Author Topic: Another cross-compile question  (Read 6517 times)

bpark

  • Newbie
  • *
  • Offline Offline
  • Posts: 7
Another cross-compile question
« on: May 25, 2017, 05:40:05 pm »

I am a newbie.

Trying to cross compile RC4 running on a PC to a MIPS/Artheros chipset router.

In Makefile, delete CFLAG reference in line that compile aircrack-ng EXE. Did this because otherwise the compile would fail on  ... unrecognized command option '-msse2'.

So on next make attempt I get the following:

/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-gcc  aircrack-ng.o cpuid.o crypto.o common.o sse-intrinsics.o memory.o wpapsk.o uniqueiv.o aircrack-ptw-lib.o liblinecount.a sha1-sse2.S -o aircrack-ng -lpthread -lssl -lcrypto   -lstdc++
/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: aircrack-ng.o: Relocations in generic ELF (EM: 3)
/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: aircrack-ng.o: Relocations in generic ELF (EM: 3)
/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: aircrack-ng.o: Relocations in generic ELF (EM: 3)
/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: aircrack-ng.o: Relocations in generic ELF (EM: 3)
/home/bulzi/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: aircrack-ng.o: Relocations in generic ELF (EM: 3)
/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: aircrack-ng.o: Relocations in generic ELF (EM: 3)
/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: aircrack-ng.o: Relocations in generic ELF (EM: 3)
/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: aircrack-ng.o: Relocations in generic ELF (EM: 3)
/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: aircrack-ng.o: Relocations in generic ELF (EM: 3)
/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: aircrack-ng.o: Relocations in generic ELF (EM: 3)
aircrack-ng.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
Makefile:173: recipe for target 'aircrack-ng' failed
make: *** [aircrack-ng] Error 1

Any input will be appreciated.

Thank you.


Logged

misterx

  • Aircrack-ng Author
  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1955
  • Aircrack-ng Author
    • Aircrack-ng
Re: Another cross-compile question
« Reply #1 on: May 25, 2017, 07:34:26 pm »

I guess the autocfg failed at detecting that there is no SSE2. I just committed a patch to fix it (r2904).

Could you tell me how you passed the cross compiler to the makefile? I think I know what's going on.
I'd say
Code: [Select]
make CC=/dev/openwrt-cc/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-gcc or is there were more arguments to the make command?
Logged

bpark

  • Newbie
  • *
  • Offline Offline
  • Posts: 7
Re: Another cross-compile question
« Reply #2 on: June 29, 2017, 07:24:48 pm »

I will check the patch.

thank you.
Logged

bpark

  • Newbie
  • *
  • Offline Offline
  • Posts: 7
Re: Another cross-compile question
« Reply #3 on: June 29, 2017, 07:34:44 pm »

I was adding an LD= ... argument after the CC= ... when crosscompiling. I'm not sitting at that machine right now.

How do I find that patch?
I'm looking at patches.aircrack-ng.org and don't see anything that looks like r2904.

Thank you.
Logged

misterx

  • Aircrack-ng Author
  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1955
  • Aircrack-ng Author
    • Aircrack-ng
Re: Another cross-compile question
« Reply #4 on: June 29, 2017, 08:01:59 pm »

Get a difference between r2903 and r2904.
Logged

Wamba

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
Re: Another cross-compile question
« Reply #5 on: July 12, 2017, 03:29:53 pm »

Perhaps I'm looking in the wrong place.
Where should I be able to find the patches you mention?

Thank you.
Logged

misterx

  • Aircrack-ng Author
  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1955
  • Aircrack-ng Author
    • Aircrack-ng
Re: Another cross-compile question
« Reply #6 on: July 12, 2017, 04:41:29 pm »

use the code from svn, then make a difference between 2 revisions: r2903 and r2904.

Subversion manual can help you do that.
Logged

Wamba

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
Re: Another cross-compile question
« Reply #7 on: July 19, 2017, 04:26:56 pm »

Got version 2913 (current) from SVN

Make command:
sudo make CC=/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc LD=/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-ld

Console output:
make[1]: Entering directory '/home/dev/openwrt/package/trunk/src'
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc -g -W -Wall -O3  -DOLD_SSE_CORE=1 -pthread -D_FILE_OFFSET_BITS=64 -D_REVISION=2913  -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3 -fstack-protector -Wno-unused-but-set-variable -Wno-array-bounds -Iinclude  aircrack-ng.o cpuid.o crypto.o common.o  uniqueiv.o sha1-sse2.o aircrack-ptw-lib.o liblinecount.a -o aircrack-ng -lpthread -lssl -lcrypto   -lstdc++
mips-openwrt-linux-uclibc-gcc: warning: environment variable 'STAGING_DIR' not defined
mips-openwrt-linux-uclibc-gcc: warning: environment variable 'STAGING_DIR' not defined
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: liblinecount.a(linecount.o): Relocations in generic ELF (EM: 3)
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: liblinecount.a(linecount.o): Relocations in generic ELF (EM: 3)
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: liblinecount.a(linecount.o): Relocations in generic ELF (EM: 3)
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: liblinecount.a(linecount.o): Relocations in generic ELF (EM: 3)
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: liblinecount.a(linecount.o): Relocations in generic ELF (EM: 3)
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: liblinecount.a(linecount.o): Relocations in generic ELF (EM: 3)
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: liblinecount.a(linecount.o): Relocations in generic ELF (EM: 3)
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: liblinecount.a(linecount.o): Relocations in generic ELF (EM: 3)
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: liblinecount.a(linecount.o): Relocations in generic ELF (EM: 3)
/home/dev/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: liblinecount.a(linecount.o): Relocations in generic ELF (EM: 3)
liblinecount.a: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
Makefile:182: recipe for target 'aircrack-ng' failed
make[1]: *** [aircrack-ng] Error 1
make[1]: Leaving directory '/home/dev/openwrt/package/trunk/src'
Makefile:25: recipe for target 'all' failed
make: *** [all] Error 2

Output of echo $STAGING_DIR
/home/dev/openwrt/staging_dir

Output of file *.o:
aircrack-ng.o:      ELF 32-bit MSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped
aircrack-ptw-lib.o: ELF 32-bit MSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped
common.o:           ELF 32-bit MSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped
cpuid.o:            ELF 32-bit MSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped
crypto.o:           ELF 32-bit MSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped
linecount.o:        ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
sha1-sse2.o:        ELF 32-bit MSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped
uniqueiv.o:         ELF 32-bit MSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped

Any suggestions as to what I'm missing would be appreciated.

Thank you.
Logged

misterx

  • Aircrack-ng Author
  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1955
  • Aircrack-ng Author
    • Aircrack-ng
Re: Another cross-compile question
« Reply #8 on: August 01, 2017, 08:40:05 pm »

You forgot to set CXX value before compiling. It used the regular x86/64 and not the cross compiler for C++

More details on https://stackoverflow.com/questions/8168950/cross-compiling-c-project-relocations-in-generic-elf-em-3
Logged
Pages: [1]   Go Up