I have download and extracted u-boot-1.1.6 on Ubuntu Linux. I just want to compile the source code using GCC (not targeting cross compilation for any embedded platform).
I tried running the provided MAKEALL makefile but "powerpc-linux-gcc : Not Found" is happening.
My understanding is irrespective of platform the source code should compile.
What are the necessary makefile and environment changes I need to do for compilation on x86?
I have taken the recent code. Still facing some issues
I have followed following steps to compile it on x86.
make clean;
make coreboot-x86_config
./MAKEALL -C x86
In step 3 I observed following:
ravitiwari#RAVI-HP-Pavilion-dv2000-GJ175PA-ACJ:~/u-boot-2013.04$ make clean
ravitiwari#RAVI-HP-Pavilion-dv2000-GJ175PA-ACJ:~/u-boot-2013.04$ make coreboot-x86_config
Configuring for coreboot-x86 - Board: coreboot, Options: SYS_TEXT_BASE=0x01110000
ravitiwari#RAVI-HP-Pavilion-dv2000-GJ175PA-ACJ:~/u-boot-2013.04$ ./MAKEALL -C x86
Configuring for coreboot-x86 - Board: coreboot, Options: SYS_TEXT_BASE=0x01110000
make[1]: ** [interrupts.o] Error 127
make: ** [arch/x86/cpu/libx86.o] Error 2
make[1]: ** [coreboot.o] Error 127
make: ** [arch/x86/cpu/coreboot/libcoreboot.o] Error 2
make[1]: ** [bootm.o] Error 127
make: ** [arch/x86/lib/libx86.o] Error 2
size: './u-boot': No such file
/bin/bash: sparse: command not found
make[1]: ** [interrupts.o] Error 127
make: ** [arch/x86/cpu/libx86.o] Error 2
make: ** Waiting for unfinished jobs....
/bin/bash: sparse: command not found
make[1]: ** [coreboot.o] Error 127
make: ** [arch/x86/cpu/coreboot/libcoreboot.o] Error 2
/bin/bash: sparse: command not found
make[1]: ** [bootm.o] Error 127
make: ** [arch/x86/lib/libx86.o] Error 2
make: INTERNAL: Exiting with 4 jobserver tokens available; should be 3!
--------------------- SUMMARY ----------------------------
Boards compiled: 1
Boards with errors: 1( coreboot-x86 )
make clean; make coreboot-x86_config; make
is more likely to be useful to you.
In my experience, u-boot is built for a single specific embedded platform. That would be true even when your host is x86, so you have /usr/bin/gcc already installed.
What you stumbled on (I see it by running ./MAKEALL at top level) wants to build ALL of the embedded platforms available. But it will still build specific platforms, that is inherent to U-Boot mission. It defaulted to using powerpc toolchain (powerpc-linux-gcc) rather than the x86 toolchain. My suggestion instead chooses a specific x86-based platform, and builds it. You will see various compilation outputs at console, showing what's going on.
MAKEALL would build, then throw away build results, for multiple other platforms first. You could do
.MAKEALL -c x86
but that hides compilation outputs. For other CPU you'd need appropriate cross compiler installed.
Related
GOAL: compile samples/bpf, compile bpf/bpftool and use them.
PROBLEM: on a VM with Ubuntu 18.04 bionic with a kernel 4.18.0-25-generic I've installed kernel src code executing apt install linux-source-4.18.0.
Now I cd into /usr/src/linux-source-4.18.0/linux-source-4.18.0/samples/bpf and I run make and the result is
make -C ../../ /usr/src/linux-source-4.18.0/linux-source-4.18.0/samples/bpf/ BPF_SAMPLES_PATH=/usr/src/linux-source-4.18.0/linux-source-4.18.0/samples/bpf
make[1]: Entering directory '/usr/src/linux-source-4.18.0/linux-source-4.18.0'
scripts/kconfig/conf --syncconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
scripts/kconfig/Makefile:40: recipe for target 'syncconfig' failed
make[3]: *** [syncconfig] Error 1
Makefile:562: recipe for target 'syncconfig' failed
make[2]: *** [syncconfig] Error 2
make[1]: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/kernel.release'. Stop.
make[1]: Leaving directory '/usr/src/linux-source-4.18.0/linux-source-4.18.0'
Makefile:203: recipe for target 'all' failed
make: *** [all] Error 2
If I cd into ../samples/bpf and I run sudo make the result is
Auto-detecting system features:
... libbfd: [ OFF ]
... disassembler-four-args: [ OFF ]
CC map_perf_ring.o
CC xlated_dumper.o
CC perf.o
CC cfg.o
CC common.o
CC cgroup.o
CC main.o
main.c:36:10: fatal error: bfd.h: No such file or directory
#include <bfd.h>
^~~~~~~
compilation terminated.
Makefile:92: recipe for target 'main.o' failed
make: *** [main.o] Error 1
QUESTIONS: what am I missing? After I compile them if I want to write a program which, for example, needs to use bpftool I have to write the program inside the source kernel directory or I can write it everywhere?
Build errors
The first case (Makefile:562: recipe for target 'syncconfig' failed) fails because you run make from the top of the linux kernel repository, and before trying to compile the samples, the build system tries to load a config file to use for your system (but does not find one).
Before trying to build the samples (make -C samples/bpf), you can create a .config file from your current kernel configuration like this:
$ cp /usr/src/linux-headers-$(uname -r)/.config <path to repo>/.config
$ make olddefconfig
Or even simply generate a default config file from scratch:
$ make defconfig
See make help from top directory to see the available make options.
Your second error, regarding bfd.h not found, is that you miss a library. Libbfd on Ubuntu comes with binutils-dev, so apt install binutils-dev should do the trick.
Compiling the programs
Finally, regarding your question on compiling the programs:
You can write and build program from the kernel repository, just by creating a new sample and reusing the existing Makefiles.
You can also write and compile programs outside of the kernel tree. The basic clang (v4.0 or above, if possible v6.0 or above) command to compile them usually looks something like this:
$ clang -O2 -emit-llvm -c my_bpf_prog.c -o - | \
llc -march=bpf -filetype=obj -o my_bpf_prog.o
You can find examples of programs compiled out of the kernel tree in that repository (disclaimer: by my company) or in the XDP tutorial repo.
I would like to ask where does this error come from:
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/archlinuxarm/PKGBUILDs/issues> for instructions.
CMakeFiles/supnsa_parser.dir/build.make:77: recipe for target 'CMakeFiles/supnsa_parser.dir/src/helper.cpp.o' failed
make[2]: *** [CMakeFiles/supnsa_parser.dir/src/helper.cpp.o] Error 4
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/supnsa_parser.dir/all' failed
make[1]: *** [CMakeFiles/supnsa_parser.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2
I'm getting this on my raspberry pi when I launch the compilation of my C++ application.
Where does it come from? How can I solve this? Thank you
Usually Killed message during compilation indicates out of memory issue as most of the compilation processes requires higher amount of memory, so you should either increase it (if you can, check with free -m or top command), or another solution is to create a swap file and re-run compilation again.
See also: Out Of Memory Management in Linux Kernel.
I'm trying to compile gcc-code-assist which has the code completion feature in order to use it with emacs. However i have been getting this error message while compilinng
checking for exception model to use... configure: error: unable to detect exception model
make[1]: *** [configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory `/home/dev/workspace/trash/gcc-code-assist-0.1-4.4.4'
make: *** [all] Error 2
I'm running Ubuntu 12.04 64bit
what can i do to overcome this problem
I found the right way to compile it ...
I really didn't have much knowledge of how to compile gcc (my first time)
after reading through the FAQ of building gcc I found the problem.
it turned out that I had to run the configure script and make from outside the source directory
( I called it gcc-build) so the directory list looked like this
gcc-source/
gcc-build/
then everything compiled smoothly
here's the link to the FAQ http://gcc.gnu.org/wiki/FAQ#configure
I am trying to compile GCC for Cygwin with support for targeting i386-elf so I can compile some simple OSes (search Benu, by l30nard0, on Github). I've successfully compiled the binutils for i386-elf, and compiled all of GCC's floating-point numbers dependencies.
Problem is, it says windows.h can not be found. I do have w32api successfully installed, and tried including each of those one at a time in the include path for GCC, but none of them work. If I try any of them, I get so many errors and warnings that not all will show up in the Cygwin console. The dozens upon dozens of warnings are most if not all unused parameter.
Does anyone know where the problem might lie?
I've wasted the last three entire days of my life trying to get Linux Mint set up with everything I want, but for reasons I shan't go into I gave up on that. I'd love to be able to get just one thing to work so I can enjoy my life again. :) Thanks!
BTW: The configure arguments I used were --target=i386-elf --enable-threads=win32 --enable-languages=c,c++ Was I supposed to use --enable-targets instead?
And here's part of the log:
In file included from ../../../gcc/libgcc/gthr.h:150:0,
from ../../../gcc/libgcc/unwind-dw2.c:38:
./gthr-default.h:541:21: fatal error: windows.h: No such file or directory
compilation terminated.
../../../gcc/libgcc/static-object.mk:17: recipe for target 'unwind-dw2.o' failed
make[2]: *** [unwind-dw2.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from ../../../gcc/libgcc/gthr.h:150:0,
from ../../../gcc/libgcc/unwind-dw2-fde.c:38:
./gthr-default.h:541:21: fatal error: windows.h: No such file or directory
compilation terminated.
../../../gcc/libgcc/static-object.mk:17: recipe for target 'unwind-dw2-fde.o' failed
make[2]: *** [unwind-dw2-fde.o] Error 1
make[2]: Leaving directory '/home/Sean/gccbuild/i386-elf/libgcc'
Makefile:10055: recipe for target 'all-target-libgcc' failed
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory '/home/Sean/gccbuild'
Makefile:870: recipe for target 'all' failed
make: *** [all] Error 2
Remove the --enable-threads=win32 flag; it is intended to specify thread support on the target system, not the build system.
everything is in the tittle.
I've made some research on the subject and found this : http://fedoraproject.org/wiki/Features/Windows_cross_compiler.
I've followed the steps one by one, reaching the "How to set" part but when I try to compile (as the Mingw README said make MINGW_HOST=x86_64-w64-mingw32) I obtain this :
...
File "topfind.ml", line 171, characters 4-27:
Error: Unbound module Toploop
make[2]: *** [topfind.cmo] Error 2
make[2]: Leaving directory `/local/aturbin/mingw32-ocaml/build/findlib/src/findlib'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/local/aturbin/mingw32-ocaml/build/findlib'
make: *** [stamp-build-findlib] Error 2
Any ideas about what's going wrong ?
Proper cross-compilation for OCaml currently requires a set of patches which you can find at http://caml.inria.fr/mantis/view.php?id=5737 ; the patches are being integrated in the trunk version of ocaml right now, so I guess that bug report should contain the latest information.