Aircrack-ng forum
General Category => Programming => Topic started by: bpark 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.
-
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 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?
-
I will check the patch.
thank you.
-
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.
-
Get a difference between r2903 and r2904.
-
Perhaps I'm looking in the wrong place.
Where should I be able to find the patches you mention?
Thank you.
-
use the code from svn, then make a difference between 2 revisions: r2903 and r2904.
Subversion manual can help you do that.
-
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.
-
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