I want to cross-compile rtl8192cu driver targeting ARM Angstrom (BeagleBoard), on x86 Ubuntu 13.04.
Cross-compile prerequisites:
rtl8192cu driver
Cross-toolchain (CodeSourcery / arm-angstrom-linux-gnueabi)
kernel sources
For this reason, I copied kernel sources usr/src directory of BeagleBoard, on Ubuntu machine (they heve been compiled on BeagleBoard, as I needed to rebuild the kernel).
Running make for cross-compile, I get this error:
make ARCH=arm CROSS_COMPILE=/home/demetres/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi- -C /home/demetres/Desktop/ks1 M=/home/demetres/Desktop/rtl3 modules
make[1]: Entering directory `/home/demetres/Desktop/ks1'
CC [M] /home/demetres/Desktop/rtl3/core/rtw_cmd.o
/bin/sh: scripts/basic/fixdep: cannot execute binary file
make[2]: *** [/home/demetres/Desktop/rtl3/core/rtw_cmd.o] Error 126
make[1]: *** [_module_/home/demetres/Desktop/rtl3] Error 2
make[1]: Leaving directory `/home/demetres/Desktop/ks1'
make: *** [modules] Error 2
If I run file fixdep I get:
fixdep: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
This makes sense, as fixdep, is part of kernel sources (compiled on ARM platform).
My query is: Is that procedure correct and how can I fix this error?
EDIT:
Running make V=1:
make ARCH=arm CROSS_COMPILE=/home/demetres/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi- -C /home/demetres/Desktop/ks M=/home/demetres/Desktop/rtl modules
make[1]: Entering directory `/home/demetres/Desktop/ks'
test -e include/linux/autoconf.h -a -e include/config/auto.conf || ( \
echo; \
echo " ERROR: Kernel configuration is invalid."; \
echo " include/linux/autoconf.h or include/config/auto.conf are missing."; \
echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo; \
/bin/false)
mkdir -p /home/demetres/Desktop/rtl/.tmp_versions ; rm -f /home/demetres/Desktop/rtl/.tmp_versions/*
make -f scripts/Makefile.build obj=/home/demetres/Desktop/rtl
/home/demetres/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-gcc -Wp,-MD,/home/demetres/Desktop/rtl/core/.rtw_cmd.o.d -nostdinc -isystem /home/demetres/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/include -Iinclude -I/home/demetres/Desktop/ks/arch/arm/include -include include/linux/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-versatile/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=apcs-gnu -mno-thumb-interwork -D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=arm9tdmi -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -O1 -Wno-unused-variable -Wno-unused-value -Wno-unused-label -Wno-unused-parameter -Wno-unused-function -Wno-unused -Wno-uninitialized -I/home/demetres/Desktop/rtl/include -DCONFIG_POWER_SAVING -DCONFIG_LITTLE_ENDIAN -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(rtw_cmd)" -D"KBUILD_MODNAME=KBUILD_STR(8192cu)" -c -o /home/demetres/Desktop/rtl/core/rtw_cmd.o /home/demetres/Desktop/rtl/core/rtw_cmd.c
/bin/sh: scripts/basic/fixdep: cannot execute binary file
make[2]: *** [/home/demetres/Desktop/rtl/core/rtw_cmd.o] Error 126
make[1]: *** [_module_/home/demetres/Desktop/rtl] Error 2
make[1]: Leaving directory `/home/demetres/Desktop/ks'
make: *** [modules] Error 2
fixdep is an ARM binary and you are trying to run it on x86 machine(intel). You probably have to recompile kernel resources (just make them) and try cross compiling again.
Related
I am trying to build 1.1.1g of OpenSSL.
I have tried under MSYS2 and MinGW64.
How do I resolve ?
MSys2 Build:
cd '${workspace_loc:/${project_name}}'; \
export MSYS=/D/msys64; \
export CC=' \
/D/msys64/mingw32/bin/gcc.exe -D_WIN32 -m32 -static \
-L/usr/lib \
'; \
export PATH=\
:/d/msys64/mingw32/i686-w64-mingw32/bin:\
:/d/msys64/mingw32/bin:\
:/usr/local/bin:\
perl Configure mingw shared no-hw no-asm no-md2 --prefix=`pwd` --openssldir=`pwd`; \
echo make depend; make; \
echo mingw32-make depend; mingw32-make; \
make Makefile openssl.pc libssl.pc libcrypto.pc build_libs build_apps build_tools
Output:
Configuring OpenSSL version 1.1.1g (0x1010107fL) for mingw
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
**********************************************************************
*** ***
*** OpenSSL has been successfully configured ***
*** ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL file first) ***
*** ***
**********************************************************************
make depend
perl "-I." -Mconfigdata "util/dofile.pl" \
"-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
perl "-I." -Mconfigdata "util/dofile.pl" \
"-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
perl "-I." -Mconfigdata "util/dofile.pl" \
"-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
make depend && make _all
make[1]: Entering directory '/d/Develop/WorkspaceCCpp/openssl-1.1.1g'
make[1]: Leaving directory '/d/Develop/WorkspaceCCpp/openssl-1.1.1g'
make[1]: Entering directory '/d/Develop/WorkspaceCCpp/openssl-1.1.1g'
perl util/mkbuildinf.pl " /D/msys64/mingw32/bin/gcc.exe -D_WIN32 -m32 -static -L/usr/lib -m32 -Wall
-O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_PIC -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT
-DOPENSSL_USE_APPLINK -DNDEBUG" "mingw" > crypto/buildinf.h
/D/msys64/mingw32/bin/gcc.exe -D_WIN32 -m32 -static -L/usr/lib -I. -Iinclude -Icrypto -m32 -Wall -
O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/d/Develop/WorkspaceCCpp/openssl-1.
1.1g\"" -DENGINESDIR="\"/d/Develop/WorkspaceCCpp/openssl-1.1.1g/lib/engines-1_1\"" -DUNICODE -D_UNIC
ODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_USE_APPLINK -DNDEBUG -MMD -MF crypto/cversion.d.tmp -MT c
rypto/cversion.o -c -o crypto/cversion.o crypto/cversion.c
In file included from D:/msys64/mingw32/i686-w64-mingw32/include/crtdefs.h:10,
from D:/msys64/mingw32/i686-w64-mingw32/include/stddef.h:7,
from D:/msys64/mingw32/lib/gcc/i686-w64-mingw32/10.1.0/include/stddef.h:1,
from /mingw32/include/stdlib.h:55,
from include/internal/cryptlib.h:13,
from crypto/cversion.c:10:
D:/msys64/mingw32/i686-w64-mingw32/include/corecrt.h:128:18: error: expected ';' before 'typedef'
128 | __MINGW_EXTENSION typedef __int64 __time64_t;
| ^~~~~~~~
| ;
In file included from /mingw32/include/time.h:45,
from include/openssl/crypto.h:15,
from include/internal/cryptlib.h:22,
from crypto/cversion.c:10:
/mingw32/include/sys/types.h:149:23: error: conflicting types for 'time_t'
149 | typedef __time32_t time_t;
| ^~~~~~
...
...
...
D:/msys64/mingw32/i686-w64-mingw32/include/corecrt.h:143:20: note: previous declaration of 'time_t'
was here
143 | typedef __time64_t time_t;
| ^~~~~~
make: *** [Makefile:2406: crypto/cversion.o] Error 1
One solution is to not build under MSys2 and Choose MinGW64 instead.
Then...
\mingw64\mingw32\msys\1.0\bin\bash.exe
Then...
(1)
--login -i -c "
cd '${workspace_loc:/${project_name}}';
export CC='/D/msys64/mingw32/bin/gcc.exe -DWIN32_LEAN_AND_MEAN -D_WIN32 -D_WIN64=0 -m32 -static -D_TIME_T_DEFINED -L/usr/lib';
-L/usr/lib
';
export PATH=
:/C/Perl64/bin:
:/d/msys64/mingw32/i686-w64-mingw32/bin:
:/d/msys64/mingw32/bin:
:/usr/local/bin:
$PATH;
echo PATH is: $PATH;
./Configure mingw no-shared no-asm no-md2 --prefix=pwd --openssldir=pwd;
make depend;
make
"
It then builds to completion.
NOTE: The path prepend for a newer Perl than the in-built MinGW64 Perl.
I got into the book "Beginning STM32" - Warren Gay.
I tried to build the sources under Cygwin, but even if the path to the required files is denoted in the makefile, the required files were not found.The file in the folders libopencm3/cm3/scb.h lays in the path: /home/root/STM32/stm32f103c8t6/libopencm3/include so the correct path should be /home/root/STM32/stm32f103c8t6/libopencm3/include/libopencm3/cm3/scb.h and I checked the presence of the files.
So I tried to change the #include into #include "file.h" with the required header file in the source folder - this worked, but there are a lot of cases in different source files.
Is there any suggestion to get this fixed or to find a way to get out of this?
Thanks a lot!
This is what I got from the terminal.
[~/STM32/stm32f103c8t6]
$ make
make -C rtos/libwwg
make[1]: Entering directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg'
make -w -C ./src
make[2]: Entering directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg/src'
arm-none-eabi-gcc -Os -g -std=c99 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I/home/root/STM32/stm32f103c8t6/libopencm3/include -I/home/root/STM32/stm32f103c8t6//rtos/libwwg/include -I./rtos -I. -MD -Wall -Wundef -DSTM32F1 -I/home/root/STM32/stm32f103c8t6/libopencm3/include -I/home/root/STM32/stm32f103c8t6//rtos/libwwg/include -o usbcdc.o -c usbcdc.c
usbcdc.c:7:10: fatal error: libopencm3/cm3/scb.h: No such file or directory
7 | #include <libopencm3/cm3/scb.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [../../../Makefile.incl:111: usbcdc.o] Error 1
make[2]: Leaving directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg/src'
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg'
make: *** [Makefile:41: libwwg] Error 2
So, I know what is the source of the problem.
There are problems in Cygwin with the path format or rather between the interaction between the Windows and Linux path formats. I could solve the problem by changing the paths in the Makefile from the Linux /home/folder to the Windows D:\home\folder\ format.
more detailed answer beginners:
modifying 2 lines at "Makefile.incl" may solve the problem.
"Makefile.incl" is suppose to be in ~/STM32/stm32f103c8t6 folder in above case.
Following are the lines in "Makefile.incl"
#TOP_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
TOP_DIR := C:\xyz\home\STM32\stm32f103c8t6
#OPENCM3_DIR := $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/libopencm3)
OPENCM3_DIR := c:/xyz/home/STM32/stm32f103c8t6/libopencm3
'\' or '/' in path doesn't matter
We have software that we distributed to a bunch of Pis that have Raspian Wheezy. Recently, we've added in a bit of code that uses C++ standards that aren't integrated until >=gcc-4.8. If I compile on a newer version of Raspian, there are glibc mismatch errors when running on the Wheezy installed Pis.
Can I get >=gcc-4.8 on one of the Wheezy Pis without also having to install a higher version of glibc (which automatically makes any binary compiled refuse to work on the other Pis)?
Side note:
I've been trying to compile gcc-4.8 but I'm having the worst time because it keeps throwing a bits/predefs.h is missing error. Even though I configured it with --disable-multilib:
make[3]: Entering directory '/root/gcc-4.8/gcc-4.8-20150611/armv7l-unknown-linux-gnueabihf/libgcc'
# If this is the top-level multilib, build all the other
# multilibs.
/root/gcc-4.8/gcc-4.8-20150611/host-armv7l-unknown-linux-gnueabihf/gcc/xgcc -B/root/gcc-4.8/gcc-4.8-20150611/host-armv7l-unknown-linux-gnueabihf/gcc/ -B/usr/local/armv7l-unknown-linux-gnueabihf/bin/ -B/usr/local/armv7l-unknown-linux-gnueabihf/lib/ -isystem /usr/local/armv7l-unknown-linux-gnueabihf/include -isystem /usr/local/armv7l-unknown-linux-gnueabihf/sys-include -g -O2 -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fPIC -fno-inline -I. -I. -I../../host-armv7l-unknown-linux-gnueabihf/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 /usr/include/stdio.h:28:0,
from ../.././libgcc/../gcc/tsystem.h:87,
from ../.././libgcc/libgcc2.c:27:
/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
#include <bits/predefs.h>
^
compilation terminated.
Makefile:460: recipe for target '_muldi3.o' failed
make[3]: *** [_muldi3.o] Error 1
make[3]: Leaving directory '/root/gcc-4.8/gcc-4.8-20150611/armv7l-unknown-linux-gnueabihf/libgcc'
Makefile:14787: recipe for target 'all-stage1-target-libgcc' failed
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory '/root/gcc-4.8/gcc-4.8-20150611'
Makefile:18655: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory '/root/gcc-4.8/gcc-4.8-20150611'
Makefile:884: recipe for target 'all' failed
make: *** [all] Error 2
This article (https://superuser.com/questions/762274/error-compiling-gcc-on-raspberry-pi) doesn't fix my issue unfortunately.
I'm working on a project of drone and I'm having an issue with my Raspberry Pi 2 B. When I'm trying to install Fast - Corner Detector I get this on screen
pi#raspberrypi ~/workspace/fast/build $ make
/usr/bin/cmake -H/home/pi/workspace/fast -B/home/pi/workspace/fast/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/pi/workspace/fast/build/CMakeFiles /home/pi/workspace/fast/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/pi/workspace/fast/build'
make -f CMakeFiles/fast.dir/build.make CMakeFiles/fast.dir/depend
make[2]: Entering directory '/home/pi/workspace/fast/build'
cd /home/pi/workspace/fast/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/pi/workspace/fast /home/pi/workspace/fast /home/pi/workspace/fast/build /home/pi/workspace/fast/build /home/pi/workspace/fast/build/CMakeFiles/fast.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/pi/workspace/fast/build'
make -f CMakeFiles/fast.dir/build.make CMakeFiles/fast.dir/build
make[2]: Entering directory '/home/pi/workspace/fast/build'
/usr/bin/cmake -E cmake_progress_report /home/pi/workspace/fast/build/CMakeFiles 1
[ 20%] Building CXX object CMakeFiles/fast.dir/src/fast_10.cpp.o
/usr/bin/c++ -Dfast_EXPORTS -DTEST_DATA_DIR=\"/home/pi/workspace/fast/test/data\" -Wall -Werror -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas -Wall -Werror -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas -O3 -mmmx -msse -msse -msse2 -msse3 -mssse3 -fomit-frame-pointer -fPIC -I/home/pi/workspace/fast/include -I/home/pi/workspace/fast/src -I/usr/local/include/opencv -I/usr/local/include -o CMakeFiles/fast.dir/src/fast_10.cpp.o -c /home/pi/workspace/fast/src/fast_10.cpp
cc1plus: error: unrecognized command line option ‘-mmmx’
cc1plus: error: unrecognized command line option ‘-msse’
cc1plus: error: unrecognized command line option ‘-msse’
cc1plus: error: unrecognized command line option ‘-msse2’
cc1plus: error: unrecognized command line option ‘-msse3’
cc1plus: error: unrecognized command line option ‘-mssse3’
CMakeFiles/fast.dir/build.make:60: recipe for target 'CMakeFiles/fast.dir/src/fast_10.cpp.o' failed
make[2]: *** [CMakeFiles/fast.dir/src/fast_10.cpp.o] Error 1
make[2]: Leaving directory '/home/pi/workspace/fast/build'
CMakeFiles/Makefile2:66: recipe for target 'CMakeFiles/fast.dir/all' failed
make[1]: *** [CMakeFiles/fast.dir/all] Error 2
make[1]: Leaving directory '/home/pi/workspace/fast/build'
Makefile:119: recipe for target 'all' failed
make: *** [all] Error 2
I have Cmake installed (sudo apt-get cmake), Gcc (4.6.3) and OpenCV.
How can I solve the problem?
Raspberry Pi is ARM, -msse* does it apply. Based on the CMakeFile, they detect ARM and disabled SSE flags. Maybe it is not working for you, perhaps due to a different cmake version
Try changing this
IF(DEFINED ENV{ARM_ARCHITECTURE})
to
IF(DEFINED $ENV{ARM_ARCHITECTURE})
This is line 34 in CMakeLists.txt
If the fix does not work, then you could manually enable ARM specified flags by editing CMakeLists.txt
Remove this:
IF(DEFINED ENV{ARM_ARCHITECTURE})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -march=armv7-a")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmmx -msse -msse -msse2 -msse3 -mssse3")
ENDIF()
and replace with this
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -march=armv7-a")
Maybe report an issue on github and tell the authors about it.
EDIT: you want to do these edits in https://github.com/uzh-rpg/fast/blob/master/CMakeLists.txt
Also try setting export ARM_ARCHITECTURE=1 before compiling
Im trying to build GLib-2.4.0 using the makefile.
I get this error:
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -DG_LOG_DOMAIN=\"GLib\" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -pthreads -g -O2 -Wall -MT gatomic.lo -MD -MP -MF .deps/gatomic.Tpo -c gatomic.c
-fno-common -DPIC -o .libs/gatomic.o
/var/tmp//cctTsmw7.s:103:Incorrect register `%rdx' used with `l' suffix
make[3]: *** [gatomic.lo] Error 1
make[2]: *** [install-recursive] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [install] Error 2
Any ideas?
It's likely that a newer version of glib will fix this problem.
However, if you're stuck with 2.4 for some reason, this was discussed in the gtk-devel-list at http://www.mail-archive.com/gtk-devel-list#gnome.org/msg10924.html ... here is the workaround that was reported there.
Here is the workaround that was successful for two users in that thread:
Ah yes, I think I have stumbled on this as well. This is probably
caused because the default jhbuildrc for the Mac forces a build for
the 486:
When building on intel, force build to be 486, since glib won't
enable asm atomic operations otherwise.
try:
_f = os.popen("uname -p")
if _f.read().startswith("i386"):
append_autogenargs("glib", "--build=i486-apple-darwin")
I changed the last line to:
append_autogenargs("glib", "--build=x86_64-apple-darwin")
And that fixed it for me. (If you have a Mac with a Core2 processor,
the user land will be in 64-bit in Snow Leopard).