u-boot cross compile, fatal error: stdint.h - u-boot

There is a strange error here, trying to cross compile for ARM on Linux Mint. I used:
make ARCH=arm CROSS_COMPILE=${CC} distclean
make ARCH=arm CROSS_COMPILE=${CC} am335x_evm_config
make ARCH=arm CROSS_COMPILE=${CC}
make[1]: Leaving directory `/root/bbb/u-boot/arch/arm/cpu/armv7'
make[1]: Entering directory `/root/bbb/u-boot/board/ti/am335x'
make[1]: Nothing to be done for `_depend'.
make[1]: Leaving directory `/root/bbb/u-boot/board/ti/am335x'
make -C tools all
make[1]: Entering directory `/root/bbb/u-boot/tools'
gcc -g -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -include /root/bbb/u-boot/include/libfdt_env.h -idirafter /root/bbb/u-boot/include -idirafter /root/bbb/u-boot/include2 -idirafter /root/bbb/u-boot/include -I /root/bbb/u-boot/lib/libfdt -I /root/bbb/u-boot/tools -DCONFIG_SYS_TEXT_BASE=0x80800000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -D_GNU_SOURCE -pedantic -c -o crc32.o /root/bbb/u-boot/lib/crc32.c
In file included from /root/bbb/u-boot/include/compiler.h:19:0,
from /root/bbb/u-boot/include/libfdt_env.h:12,
from <command-line>:0:
/usr/lib/gcc/i686-linux-gnu/4.8/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
# include_next <stdint.h>
^
compilation terminated.
I also have exported ARCH and CROSS_COMPILE but I compiled u_boot without last week on other machine without a problem Seems to be a cross compiler problem but it is the same Linaro un-tar-ed in some location.
Any idea? Thanks very much.

Why is your u-boot source tree in /root/ ? Are you logged as root when executing make?
Are you sure you want to compile u-boot as a root ? because you don't need to.
As I was trying to understand what is going wrong here, I recognized some lines here http://eewiki.net/display/linuxonarm/BeagleBone#BeagleBone-ARMCrossCompiler:GCC
I hope you understood each line you executed because you need to execute them one after the other to have the compilation working.
Regarding the wiki, try this way :
export CROSS_COMPILE=/path/to/the/directory/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-
Then you can just :
make ARCH=arm distclean
make ARCH=arm am335x_evm_config
make ARCH=arm
Note that you will have to export the CROSS_COMPILE variable each time you open a new console.
I hope I helped you.

Try installing libc6-dev with all dependency. It solved the problem for me.
$ sudo apt-get install libc6-dev

sudo apt-get install libnewlib-arm-none-eabi

Related

"fatal error: bits/libc-header-start.h: No such file or directory" while compiling HTK

I'm getting the following issue when trying to run make on the HTK library:
(cd HTKLib && make HTKLib.a) \
|| case "" in *k*) fail=yes;; *) exit 1;; esac;
make[1]: Entering directory '/home/william/speech/htk/HTK-3.4.1/htk/HTKLib'
gcc -m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH="x86_64"' -Wall -Wno-switch -g -O2 -I. -DPHNALG -c -o HGraf.o HGraf.c
In file included from HShell.h:40:0,
from HGraf.c:54:
/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
#include <bits/libc-header-start.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
<builtin>: recipe for target 'HGraf.o' failed
make[1]: *** [HGraf.o] Error 1
make[1]: Leaving directory '/home/william/speech/htk/HTK-3.4.1/htk/HTKLib'
Makefile:96: recipe for target 'HTKLib/HTKLib.a' failed
make: *** [HTKLib/HTKLib.a] Error 1
I'm unsure what to do about this error. The libc-header-start.h file is present on my system:
$ find /usr -name libc-header-start.h
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h
Running gcc -H -fsyntax-only /usr/include/stdio.h appropriately returns
. /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
.. /usr/include/features.h
... /usr/include/x86_64-linux-gnu/sys/cdefs.h
etc.
Also, compiling and running a sanity-check C file works fine (simply executing printf("hello!"); in its main method).
Apologies if this is a well-known error - my experience with C libraries stops at compiling and installing them using make.
UPDATE
Per the accepted answer below I executed sudo apt-get install gcc-multilib to install the missing 32 bit libraries.
Afterwards I got an error with a similar cause: "/usr/bin/ld: cannot find -lX11" error when installing htk. I resolved this by executing sudo apt-get install libx11-dev:i386 libx11-dev to retrieve the missing 32 bit library.
The -m32 is telling gcc to compile for a 32-bit platform. On a 64-bit machine, gcc normally only comes with 64-bit libraries. You have two options:
Install 32-bit headers and libraries. Here's how you'd do this on Ubuntu.
Run this command:
sudo apt-get install gcc-multilib
Compile for 64-bit instead. Modify this line in the file named configure:
CFLAGS="-m32 -ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH=\"$host_cpu\"' $CFLAGS"
Delete -m32, giving you:
CFLAGS="-ansi -D_SVID_SOURCE -DOSS_AUDIO -D'ARCH=\"$host_cpu\"' $CFLAGS"
Run ./configure, then make clean, then make
However, I would recommend against this approach. The library authors went out of their way to make this build for 32 bits on a 64 bit system, and I can't guarantee that it will work correctly if you do this. (It does compile, though.)
Below is one way to debug and fix this issue. Since most linux installations differ in one way or another, YMMV.
Find which package installed libc-header-start.h.
$ dpkg -S libc-header-start.h
libc6-dev:amd64: /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
On a working system, /usr/include/bits is a symlink to /usr/include/x86_64-linux-gnu/bits. Running dpkg search gives us:
$ dpkg -S /usr/include/bits
libc6-dev-i386: /usr/include/bits
Installing libc6-dev-i386 creates the symlink and the error is addressed.
However, subsequently I ran into a linker error with the linker not being able to find libgcc (-lgcc). Apparently Linux default linker needs libgcc in most cases. Further debugging the issue with linker verbosity enabled lead me to missing lib32gcc-10-dev package.
In short, unless a very controlled build environment is desired, just install gcc-multilib package when using -m32 (needed for gcc or clang). For C++, g++-multilib is also required.

HAWQ installation on Redhat

I am installing HAWQ on RedHat servers provisioned on Amazon EC2. I already have HDP 2.3 setup on the cluster.
I have cloned HAWQ from Github.
First I run ./configure --prefix=/opt/hawq.
In the second step, I run make.
The dependencies are compiling correctly when I run make from the root folder of incubator-hawq. The following error occours when make moves to compiling from src folder in the root directory (incubator-hawq):
make[2]: Entering directory `/root/incubator-hawq/src/port'
gcc -O3 -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -I/usr/include/libxml2 -I../../src/port -DFRONTEND -I../../src/include -D_GNU_SOURCE -I/root/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include -I/root/incubator-hawq/depends/libyarn/build/install/usr/local/hawq/include -c -o copydir.o copydir.c
In file included from copydir.c:25:0:
../../src/include/storage/fd.h:61:23: fatal error: hdfs/hdfs.h: No such file or directory
#include "hdfs/hdfs.h"
^
compilation terminated.
make[2]: *** [copydir.o] Error 1
make[2]: Leaving directory `/root/incubator-hawq/src/port'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/incubator-hawq/src'
make: *** [all] Error 2
I know the compiler cannot find hdfs/hdfs.h, but as the dependencies (libhdfs3) compiled successfully, I don't understand why the particular file isn't found. Please help if somebody has come across the same problem as I am pretty much stuck here.
Could you check file /root/incubator-hawq/depends/libhdfs3/build/install/usr/local/hawq/include/hdfs/hdfs.h exists?
If not, then it should be build defect, please open defect to hawq team or email to: dev#hawq.incubator.apache.org. Thanks.
Do you have a folder in incubator-hawq/depends/libhdfs3/build/installafter make?
The problem seems that libhdfs3 dependency is not successfully built. There are some possible reasons for that: using a old version gcc(<4.7), configuration error of libhdfs3.
To test my words, you could try this:
cd incubator-hawq/depends/libhdfs3
mkdir build_debug && cd build_debug
cmake ..
make
If you could successfully do that, I think there is another reason for your problem. In this case, could you paste the information with more building lines?
Another possible reason is that you use different configuration prefix. In this case, you should run make distclean before another configuration.

Compiling Apache Lucy

I am trying to compile Apache Lucy. Here are the steps I followed:
Downloaded Lucy and Clownfish
Compiled Clownfish runtime and compiler
Configured Lucy
Started Lucy Make
The compilation of the files in the core directory works fine but when it gets to the modules it throws an error:
$ make
gcc -pedantic -Wall -Wextra -Wno-variadic-macros -std=gnu99 -D_GNU_SOURCE -D CFP_LUCY -D CFP_TESTLUCY -fvisibility=hidden -O2 -g -fno-strict-aliasing -fPIC -I . -I ../core -I autogen/include -I ../modules/analysis/snowstem/source/include -I ../modules/unicode/ucd -I ../modules/unicode/utf8proc -c ../modules/analysis/snowstem/source/libstemmer/libstemmer_utf8.c -o ../modules/analysis/snowstem/source/libstemmer/libstemmer_utf8.o
../modules/analysis/snowstem/source/libstemmer/libstemmer_utf8.c:4:35: fatal error: ../include/libstemmer.h: No such file or directory
#include "../include/libstemmer.h"
^
compilation terminated.
make: *** [../modules/analysis/snowstem/source/libstemmer/libstemmer_utf8.o] Error 1
The problem seems to be that the code files in the modules include the include files with a relative path like #include "../include/libstemmer.h". Even though the resulting directory is included in the include files directory i.e. -I ../modules/analysis/snowstem/source/include but it does not work
I started modifying the source files to remove the relative path but more started cropping up. I think there must be a better way. Any help on how I can fix this would be really helpful.
If you do only cpan Lucy::Simple it should be enough
It seems to me there is not a C library available yet.
Above link is old (2012) but explains why it is not obvious.
http://grokbase.com/t/lucy/user/12bp9rw0g7/lucy-user-using-lucy-directly-from-c
https://github.com/cancerberoSgx/lucy.js/blob/master/scripts/build-lucy-c.sh
that's a shell script that will clone lucy .git and dependencies, compile lucy c and clownfish C them and then compile and run one of the lucy/samples/c
It does it all locally in a folder, so you don't have to install anything globally as root. you need linux buildtools like gcc, make, configure, etc. Good luck

pkg-config: command not found during compile, but pkg-config installed

Update: I got it working, the problem has something to do with the fact that I was running it through emacs. I ran the makefile from the command line instead, and pkg-config ran. After adding the path to guile-2.0.pc with export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig everything compiled and ran OK. Still won't compile through emacs but I don't want to deal with that.
I am trying to compile a C program but received a "pkg-config: command not found" error, but am pretty sure pkg-config is installed.
Below is the MAKEFILE
# Use GCC, if you have it installed.
CC=gcc
# Tell the C compiler where to find <libguile.h>
CFLAGS=`pkg-config --cflags guile-2.0`
# Tell the linker what libraries to use and where to find them.
LIBS=`pkg-config --libs guile-2.0`
simple-guile: simple-guile.o
${CC} simple-guile.o ${LIBS} -o simple-guile
simple-guile.o: test.c
${CC} -c ${CFLAGS} test.c
Below is the error message (re: second error, I think if I can resolve this issue the libguile.h file will be found)
make
gcc -c `pkg-config --cflags guile-2.0` test.c
/bin/sh: pkg-config: command not found
test.c:2:11: fatal error: 'libguile.h' file not found
#include <libguile.h>
^
1 error generated.
make: *** [simple-guile.o] Error 1
I installed pkg-config by
brew install pkg-config
Installation appears successful?...
Jeffs-iMac:~ Jeff$ which pkg-config
/opt/local/bin/pkg-config
If it's relevant, this should be the same directory in which guile is located:
Jeffs-iMac:~ Jeff$ which guile
/opt/local/bin/guile
Am using OS X 10.11.3
I tried uninstalling and reinstalling pkg-config per: Can't install rmagick, pkg-config: command not found
I'm a novice programmer, any help would be greatly appreciated.

Simple Make File Error

I am trying to create a simple make file and using it to build a simple c program. The environment is in virtual box using the newest version of ubuntu. I have already downloaded the linux headers for ubuntu but still getting the error.
Hello.c
#include <linux/init.h>
#include <linux/module.h>
static int hello_init(void) {
printk(KERN_ALERT "TEST: Hello world, this is soliducode\n");
return 0;
}
static void hello_exit(void) {
printk(KERN_ALERT "TEST: Good byte, from soliduscode");
}
module_init(hello_init);
module_exit(hello_exit);
Makefile
obj-m += Hello.o
KDIR = /usr/src/linux-headers-4.2.0-16-generic
all:
$(MAKE) -C $(KDIR) SUBSIRS=$ modules
clean:
rm -rf *.o *.ko *.mod.* *.symvers *.order
Error
make -C /usr/src/linux-headers-4.2.0-16-generic SUBSIRS=modules
make[1]: Entering directory '/usr/src/linux-headers-4.2.0-16-generic'
arch/x86/Makefile:138: CONFIG_X86_X32 enabled but no binutils support
Makefile:669: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
HOSTCC scripts/basic/fixdep
scripts/basic/fixdep.c:462:1: fatal error: opening dependency file scripts/basic/.fixdep.d: Permission denied
}
^
compilation terminated.
scripts/Makefile.host:91: recipe for target 'scripts/basic/fixdep' failed
make[3]: *** [scripts/basic/fixdep] Error 1
Makefile:449: recipe for target 'scripts_basic' failed
make[2]: *** [scripts_basic] Error 2
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h'. Stop.
arch/x86/Makefile:184: recipe for target 'archheaders' failed
make[1]: *** [archheaders] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.2.0-16-generic'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2
It looks like your kernel config is invalid.
There is documentation how to build your own kernel on Ubuntu, e.g.
https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
Try using in M=${PWD} option in your Makefile.
Command:
make -C /lib/modules/`uname -r`/build M=${PWD} modules
#Manish Dharanenthiran solved the problem for me.
I was on this problem for about 2 days.
compiled a new kernel, download another one from https://www.kali.org/downloads/, and still got those errors.
To help with that kind of problem I suggest the path below -
first check the kernel you running on with
uname -r
check if you got your current kernel linux-headers inside /usr/src
ls -a /usr/src
if you don't, you need to install them but old version of linux-headers doesn't available by apt-get check if yours available in the list that received by
apt-cache search linux-headers
if your current version is there jump to 3.
if your current version doesn't available you need to: apt-get update & apt-get upgrade / install a newer machine / compile a new kernel
NOTICE - from my experience (I did them all) the update & upgrade is the fastest.
apt-get update
apt-get upgrade
reboot
When booting choose the new kernel in the grub menu
You can edit this file with bigger GRUB_TIMEOUT value if you can't see/catch the menu in boot time
Download the needed linux-headers
apt-get install linux-headers-$(uname -r)
If the problem didn't solve yet, try using in M=${PWD} instead of M=$(PWD) in your Makefile as mentioned by #Manish Dharanenthiran.

Resources