Error when building FIX 8 - gcc7

Using gcc 7.1
[idf fix8]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-7/root/usr --mandir=/opt/rh/devtoolset-7/root/usr/share/man --infodir=/opt/rh/devtoolset-7/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --with-default-libstdcxx-abi=gcc4-compatible --with-isl=/builddir/build/BUILD/gcc-7.1.1-20170526/obj-x86_64-redhat-linux/isl-install --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 7.1.1 20170526 (Red Hat 7.1.1-2) (GCC)
[idf fix8]$
when building FIX8 with this ./configure
[idf fix8]$ ./configure --with-mpmc=tbb --enable-tbbmalloc=yes --enable-f8test=no --enable-rawmsgsupport=yes --enable-doxygen=no --with-precision=single --enable-preencode --enable-bufgloblogging=no --enable-gtest=no
when I run make I get these errors (which is weird because I told it not to build tests!)
make all-am
make[3]: Entering directory '/home/idf/Documents/c++/fix8/test'
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -I../include -g -O2 -Wall -MT libhftest_la-Perf_types.lo -MD -MP -MF .deps/libhftest_la-Perf_types.Tpo -c -o libhftest_la-Perf_types.lo `test -f 'Perf_types.cpp' || echo './'`Perf_types.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -I../include -g -O2 -Wall -MT libhftest_la-Perf_types.lo -MD -MP -MF .deps/libhftest_la-Perf_types.Tpo -c Perf_types.cpp -fPIC -DPIC -o .libs/libhftest_la-Perf_types.o
In file included from Perf_types.cpp:77:0:
../include/fix8/logger.hpp:576:30: error: 'function' in namespace 'std' does not name a template type
using logger_function = std::function<bool(const std::string&, Logger::Level, const char *, const unsigned)>;
^~~~~~~~
../include/fix8/logger.hpp:580:2: error: 'logger_function' does not name a type; did you mean '__fortify_function'?
logger_function _logger;
^~~~~~~~~~~~~~~
etc...
I have confirmed that the build also fails with
gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)
I just verified that it does compile with
gcc version 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC)
and it also does compile with
gcc version 6.3.1 20170216 (Red Hat 6.3.1-3) (GCC)
Please advise.

You have to explicitly #include <functional> in logger.hpp.
The reason is stated in https://gcc.gnu.org/gcc-7/porting_to.html:
Several C++ Standard Library headers have been changed to no longer
include the header. As such, C++ programs that used
components defined in without explicitly including that
header will no longer compile.
Previously components such as std::bind and std::function were
implicitly defined after including unrelated headers such as < memory>,
< future>, < mutex>, and < regex>. Correct code should #include
< functional> to define them.

Related

how to install Fortran -dev package using sudo yum install

I have installed (GCC) 4.7.2 20121015 (Red Hat 4.7.2-5) already and jave also installed yum install gcc-gfortran . (Package gcc-gfortran-4.4.7-18.el6.x86_64)
But I'm getting error like :
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [quadprog.so] Error 1
Please help me in installing -lgfortran. It seems like I need to install "Fortran -dev package providing the Fortran library". I do not know how to do that in RedHat/CentOS. Please help. I'm facing hard time in doing this.
I have tried installing libgfortran using:
yum install libgfortran
But it says:
Package libgfortran-4.4.7-18.el6.x86_64 already installed and latest version
Nothing to do
(Running in an interactive session, skipping clean step.)
More Info:
I tried installing package quadprog for R and below are the logs:
install.packages('https://cran.cnr.berkeley.edu/src/contrib/quadprog_1.5-5.tar.gz',dependencies = TRUE,repos = NULL,type ="source")
Installing package into '/usr/lib64/R/library'
(as 'lib' is unspecified)
trying URL 'https://cran.cnr.berkeley.edu/src/contrib/quadprog_1.5-5.tar.gz'
Content type 'application/x-gzip' length 33651 bytes (32 KB)
==================================================
downloaded 32 KB
* installing *source* package 'quadprog' ...
** package 'quadprog' successfully unpacked and MD5 sums checked
** libs
gfortran -m64 -fvisibility=hidden -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/lib64/gfortran/modules -c aind.f -o aind.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -c init.c -o init.o
gfortran -m64 -fvisibility=hidden -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/lib64/gfortran/modules -ffloat-store -c -o solve.QP.compact.o solve.QP.compact.f
solve.QP.compact.f:254.3:
72 if (nvl .EQ. 0) then
1
Warning: Label 72 at (1) defined but not used
solve.QP.compact.f:302.2:
7 t1inf = .FALSE.
1
Warning: Label 7 at (1) defined but not used
solve.QP.compact.f: In function 'qpgen1':
solve.QP.compact.f:94: warning: 'it1' may be used uninitialized in this function
solve.QP.compact.f:98: warning: 't1' may be used uninitialized in this function
gfortran -m64 -fvisibility=hidden -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/lib64/gfortran/modules -ffloat-store -c -o solve.QP.o solve.QP.f
solve.QP.f:245.3:
72 if (nvl .EQ. 0) then
1
Warning: Label 72 at (1) defined but not used
solve.QP.f:293.2:
7 t1inf = .FALSE.
1
Warning: Label 7 at (1) defined but not used
solve.QP.f: In function 'qpgen2':
solve.QP.f:85: warning: 'it1' may be used uninitialized in this function
solve.QP.f:89: warning: 't1' may be used uninitialized in this function
gfortran -m64 -fvisibility=hidden -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/lib64/gfortran/modules -c util.f -o util.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -o quadprog.so aind.o init.o solve.QP.compact.o solve.QP.o util.o -L/usr/lib64/R/lib -lRblas -lgfortran -lm -lgfortran -lm -L/usr/lib64/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [quadprog.so] Error 1
ERROR: compilation failed for package 'quadprog'
* removing '/usr/lib64/R/library/quadprog'
Warning message:
In install.packages("https://cran.cnr.berkeley.edu/src/contrib/quadprog_1.5-5.tar.gz", :
installation of package '/tmp/Rtmpry5XTG/downloaded_packages/quadprog_1.5-5.tar.gz' had non-zero exit status
Edits :
bash-4.1# rpm -ql libgfortran
/usr/lib64/libgfortran.so.3
/usr/lib64/libgfortran.so.3.0.0
You showed us this:
# type -a gcc
gcc is /opt/centos/devtoolset-1.1/root/usr/bin/gcc
gcc is /usr/bin/gcc'
It means that you have installed Red Hat Developer Toolset and enabled it for this shell, using scl enable or a similar command. Do you still need it? If not, I suggest to disable it.
If you need DTS, you will have to install the Fortran compiler from DTS 1.1, using:
yum install devtoolset-1.1-gcc-gfortran
(Or download it directly from here, which seems to be the repository from where you got your DTS compiler.)
This will install the Fortran compiler which is compatible with the gcc compiler you have configured. Without that, the system Fortran compiler and the DTS gcc are used together, which does not work because the DTS gcc command (used for linking in the build process you quoted) is not able to locate the libgfortran.so library from the system Fortran compiler.
Alternatively, you can bring the two compilers into sync by deinstalling the DTS compiler:
yum install devtoolset-1.1-gcc-gfortran
The following compile line was looking for libgfortran at /usr/lib64/R/lib but the library is not there. Hence, the linker error.
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -o quadprog.so aind.o init.o solve.QP.compact.o solve.QP.o util.o -L/usr/lib64/R/lib -lRblas -lgfortran -lm -lgfortran -lm -L/usr/lib64/R/lib -lR
As we could not locate and modify the makefile. We created a symbolic link /usr/lib64/R/lib/libgfortran.so to /usr/lib64/libgfortran.so.3 and rerun the installation steps and it resolves the linker error.
This is a work around that we follow which resolves the issue

"fatal error: asm/early_ioremap.h: No such file or directory"

why am I getting "fatal error: asm/early_ioremap.h: No such file or directory" while building simple hello world kernel driver for x86_64 with Linux 4.4.15 libraries using gcc-4.8.5? gcc is searching for asm/early_ioremap.h which is not available in Linux 4.4.15.
any idea how can i fix this?
/opt/gcc-4.8.5-glibc-2.21-p8/x86_64-linux-gnu/bin/x86_64-linux-gnu-gcc -M -MP -MT '/home/obj/src/kernel/hello_world/hello.o' -MT '/home/obj/src/kernel/hello_world/hello.d' -MT 'hello.E' -MT 'hello.S' -I/home/src/kernel/hello_world -I/home/obj/src/kernel/linux-4.4.15/include -I/home/src/inc -I/home/obj/src/kernel/linux-4.4.15/arch/x86/include -D__KERNEL__ -DMODULE -DPACKET_LEAK_TRACING -DSIZEOF_CPU_REGISTER=8 -DNUM_DEV_CF=0 -DNUM_DEV_USB=0 -mtune=nocona -march=nocona -m64 -pipe -std=gnu89 -g -nostdinc -isystem /opt/gcc-4.8.5-glibc-2.21-p8/x86_64-linux-gnu/lib/gcc/x86_64-linux-gnu/4.8.5/include -O2 -fno-strict-aliasing -fno-common -ffreestanding -Wall -Wstrict-prototypes -Wno-trigraphs -Wmissing-format-attribute -Wdisabled-optimization -Wwrite-strings -Wimplicit-int -Wmissing-braces -Wmissing-noreturn -Wundef -Wmissing-field-initializers -Wmissing-declarations -Wmissing-prototypes -Wno-unused-parameter -Winline -mcmodel=kernel -fno-omit-frame-pointer -fno-stack-protector -mno-red-zone -fno-asynchronous-unwind-tables -imacros generated/autoconf.h hello.c -I/home/obj/src/kernel/linux-4.4.15/include/uapi/ -I/home/obj/src/kernel/linux-4.4.15/arch/x86/include/uapi/
In file included from /home/obj/src/kernel/linux-4.4.15/arch/x86/include/asm/realmode.h:5:0,
from /home/obj/src/kernel/linux-4.4.15/arch/x86/include/asm/acpi.h:33,
from /home/obj/src/kernel/linux-4.4.15/arch/x86/include/asm/fixmap.h:19,
from /home/obj/src/kernel/linux-4.4.15/arch/x86/include/asm/apic.h:12,
from /home/obj/src/kernel/linux-4.4.15/arch/x86/include/asm/smp.h:12,
from /home/obj/src/kernel/linux-4.4.15/arch/x86/include/asm/mmzone_64.h:10,
from /home/obj/src/kernel/linux-4.4.15/arch/x86/include/asm/mmzone.h:4,
from /home/obj/src/kernel/linux-4.4.15/include/linux/mmzone.h:856,
from /home/obj/src/kernel/linux-4.4.15/include/linux/gfp.h:5,
from /home/obj/src/kernel/linux-4.4.15/include/linux/kmod.h:22,
from /home/obj/src/kernel/linux-4.4.15/include/linux/module.h:13,
from hello.c:1:
/home/obj/src/kernel/linux-4.4.15/arch/x86/include/asm/io.h:43:31: fatal error: asm/early_ioremap.h: No such file or directory
#include <asm/early_ioremap.h>
^
compilation terminated.
gcc is searching for asm/early_ioremap.h which is not available in Linux 4.4.15.
any idea how can i fix this?
I think you've answered your own question; either you figure out where the functionality contained in that header file has moved, or with what it has been replaced, or you use a Linux 4.4.15-compatible hello world module, or you use an older kernel.
Personally, I'd go for trying out another example that is supposed to work with recent versions of Linux.
I've faced a very similar error just recently trying to build a module from the kernel to an out-of-tree output by specifying the O= flag.
It seems to be that this is the part causing the failure for me
make \
-j1 \
-C /lib/modules/4.17.9-041709-generic/build \
M=/home/kbingham/sources/linux/drivers/media/usb/uvc \
O=/tmp/build-uvc \
V=1 \
modules
fails,
with the error:
/usr/src/linux-headers-4.17.9-041709-generic/arch/x86/include/asm/io.h:44:10: fatal error: asm/early_ioremap.h: No such file or directory
#include <asm/early_ioremap.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
whilst
make \
-j1 \
-C /lib/modules/4.17.9-041709-generic/build \
M=/home/kbingham/sources/linux/drivers/media/usb/uvc \
V=1 \
modules
suceeds.

Cannot link libsqlite3.so in gcc

I'm trying to compile the following program with gcc 4.8.2 on Ubuntu 14.04.1
with the package libsqlite3-dev installed:
#include <sqlite3.h>
int main(int argc, char *argv[])
{
struct sqlite3 *s3;
char *filename = ":memory:";
sqlite3_open(filename, &s3);
return 0;
}
When running gcc -L/usr/lib/x86_64-linux-gnu -lsqlite3 program.c I get
the error:
/tmp/ccjvJqkW.o: In function `main':
program.c:(.text+0x26): undefined reference to `sqlite3_open'
collect2: error: ld returned 1 exit status
It looks to me like I have the correct library installed:
autobound#Calcium:~$ locate libsqlite3.so
/usr/lib/i386-linux-gnu/libsqlite3.so.0
/usr/lib/i386-linux-gnu/libsqlite3.so.0.8.6
/usr/lib/x86_64-linux-gnu/libsqlite3.so
/usr/lib/x86_64-linux-gnu/libsqlite3.so.0
/usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
autobound#Calcium:~$ readelf -a /usr/lib/x86_64-linux-gnu/libsqlite3.so | grep sqlite3_open
71: 00000000000947b0 5 FUNC GLOBAL DEFAULT 11 sqlite3_open_v2
157: 00000000000947a0 12 FUNC GLOBAL DEFAULT 11 sqlite3_open
194: 00000000000947c0 181 FUNC GLOBAL DEFAULT 11 sqlite3_open16
Running clang with the same arguments (clang -L/usr/lib/x86_64-linux-gnu -lsqlite3 program.c)
builds the executable just fine. In fact, the -L argument isn't even
needed for clang to build it.
The verbose output of gcc is:
autobound#Calcium:~/src/c/sqlitetest (master)$ gcc --verbose -L/usr/lib/x86_64-linux-gnu -lsqlite3 program.c
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
COLLECT_GCC_OPTIONS='-v' '-L/usr/lib/x86_64-linux-gnu' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/4.8/cc1 -quiet -v -imultiarch x86_64-linux-gnu program.c -quiet -dumpbase program.c -mtune=generic -march=x86-64 -auxbase program -version -fstack-protector -Wformat -Wformat-security -o /tmp/ccIBEqw6.s
GNU C (Ubuntu 4.8.2-19ubuntu1) version 4.8.2 (x86_64-linux-gnu)
compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/4.8/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C (Ubuntu 4.8.2-19ubuntu1) version 4.8.2 (x86_64-linux-gnu)
compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: dc75e0628c9356affcec059d0c81cc01
COLLECT_GCC_OPTIONS='-v' '-L/usr/lib/x86_64-linux-gnu' '-mtune=generic' '-march=x86-64'
as -v --64 -o /tmp/cca2r2gq.o /tmp/ccIBEqw6.s
GNU assembler version 2.24 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.24
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-L/usr/lib/x86_64-linux-gnu' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/4.8/collect2 --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -lsqlite3 /tmp/cca2r2gq.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
/tmp/cca2r2gq.o: In function `main':
program.c:(.text+0x26): undefined reference to `sqlite3_open'
collect2: error: ld returned 1 exit status
Try to change order of parameters
gcc program.c -L/usr/lib/x86_64-linux-gnu -lsqlite3

Some headers in PWD are skipped by arm-linux-gnueabi?

I'm trying to compile a library on Ubuntu 14.04 with packages gcc-arm-linux-gnueabi and g++-arm-linux-gnueabi installed.
The compile fails on the first source file it encounters:
/usr/bin/arm-linux-gnueabi-g++ -DNDEBUG -g2 -Os -pipe -fPIC -I. -DCRYPTOPP_DISABLE_ASM
-mcpu=cortex-m3 -mthumb --sysroot=/usr/arm-linux-gnueabi -c 3way.cpp
In file included from cryptlib.h:83:0,
from seckey.h:8,
from 3way.h:7,
from 3way.cpp:5:
stdcpp.h:14:18: fatal error: memory: No such file or directory
compilation terminated.
Here's what the include line looks like in cryptlib.h:
#ifndef CRYPTOPP_CRYPTLIB_H
#define CRYPTOPP_CRYPTLIB_H
#include "config.h"
#include "stdcpp.h"
...
Obviously, stdcpp.h exists:
$ pwd
/home/jwalton/cryptopp-embedded
$ ls 3way.h cryptlib.h stdcpp.h
3way.h cryptlib.h stdcpp.h
Adding -v shows:
...
ignoring nonexistent directory "/usr/arm-linux-gnueabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
.
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/include
...
End of search list.
I've cross compiled the library on other platforms (like Android, iOS and Windows Phone), so I have a good idea of what needs to be done. This is my first time with arm-linux-gnueabi, however.
Why is arm-linux-gnueabi skipping the header in the present working directory? How can I resolve the issue?
Full output from arm-linux-gnueabi-g++ -v:
/usr/bin/arm-linux-gnueabi-g++ -v -DNDEBUG -g2 -Os -pipe -fPIC -I. -DCRYPTOPP_DISABLE_ASM
-mcpu=cortex-m3 -mthumb --sysroot=/usr/arm-linux-gnueabi -c 3way.cpp
Using built-in specs.
COLLECT_GCC=/usr/bin/arm-linux-gnueabi-g++
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.3-12ubuntu1'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++
--prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.7.3
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-gnu-unique-object
--disable-libmudflap --disable-libitm --enable-plugin --with-system-zlib --enable-objc-gc --with-cloog
--enable-cloog-backend=ppl --disable-cloog-version-check --disable-ppl-version-check --enable-multiarch --enable-multilib
--disable-sjlj-exceptions --with-arch=armv5t --with-float=soft --disable-werror --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueab --program-prefix=arm-linux-gnueabi-
--includedir=/usr/arm-linux-gnueabi/include
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1)
COLLECT_GCC_OPTIONS='-v' '-D' 'NDEBUG' '-g2' '-Os' '-pipe' '-fPIC' '-I' '.' '-D' 'CRYPTOPP_DISABLE_ASM'
'-mcpu=cortex-m3' '-mthumb' '-c' '-shared-libgcc' '-mfloat-abi=soft' '-mtls-dialect=gnu'
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/cc1plus -quiet -v -I . -imultilib sf -imultiarch
arm-linux-gnueabi
-isysroot /usr/arm-linux-gnueabi -D_GNU_SOURCE -D NDEBUG -D CRYPTOPP_DISABLE_ASM
3way.cpp -quiet
-dumpbase 3way.cpp -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -mtls-dialect=gnu -auxbase 3way
-g2 -Os -version -fPIC -fstack-protector -o - |
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/as -v -I . -mcpu=cortex-m3
-mfloat-abi=soft -meabi=5 -o 3way.o
GNU assembler version 2.24 (arm-linux-gnueabi) using BFD version (GNU Binutils for Ubuntu) 2.24
GNU C++ (Ubuntu/Linaro 4.7.3-12ubuntu1) version 4.7.3 (arm-linux-gnueabi)
compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/arm-linux-gnueabi/usr/arm-linux-gnueabi/include/c++/4.7.3"
ignoring nonexistent directory "/usr/arm-linux-gnueabi/usr/arm-linux-gnueabi/include/c++/4.7.3/arm-linux-gnueabi/sf"
ignoring nonexistent directory "/usr/arm-linux-gnueabi/usr/arm-linux-gnueabi/include/c++/4.7.3/backward"
ignoring nonexistent directory "/usr/arm-linux-gnueabi/usr/local/include/arm-linux-gnueabi"
ignoring nonexistent directory "/usr/arm-linux-gnueabi/usr/include/arm-linux-gnueabi"
ignoring nonexistent directory "/usr/arm-linux-gnueabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
.
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/include
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/include-fixed
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/include
End of search list.
GNU C++ (Ubuntu/Linaro 4.7.3-12ubuntu1) version 4.7.3 (arm-linux-gnueabi)
compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: dd2bb0d8e9ec09589fb3eaca028d0191
In file included from cryptlib.h:83:0,
from seckey.h:8,
from 3way.h:7,
from 3way.cpp:5:
stdcpp.h:14:18: fatal error: memory: No such file or directory
compilation terminated.
make: *** [3way.o] Error 1
stdcpp.h:14:18: fatal error: memory: No such file or directory
Arg... The missing header is memory, and not stdcpp.h. (Damn C++ header names...).
And the un-found <memory> appears to be a bug in Ubuntu's g++arm-linux-gnueabi: g++-arm-linux-gnueabi cannot compile a C++ program with --sysroot.

glibc error while building linux from scratch

The following error came up when i did 'make' of glibc-2.14.1 for LFS 7.1. I am using ubuntu as the host OS.
gcc ../sysdeps/unix/sysv/linux/syslog.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline
-Wwrite-strings -fmerge-all-constants -g -Wstrict-prototypes -mpreferred-stack-
boundary=2 -Wa,-mtune=i686 -fexceptions -I../include -I/mnt/lfs/sources/glibc-
build/misc -I/mnt/lfs/sources/glibc-build -I../sysdeps/i386/elf -
I../nptl/sysdeps/unix/sysv/linux/i386/i686 -I../sysdeps/unix/sysv/linux/i386/i686 -
I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -
I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -
I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -
I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -
I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -
I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu -
I../sysdeps/i386/i686/multiarch -I../nptl/sysdeps/i386/i686 -I../sysdeps/i386/i686 -
I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -
I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -
I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -
I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I.. -
I../libio -I. -nostdinc -isystem /usr/lib/gcc/i686-linux-gnu/4.6/include -isystem
/usr/lib/gcc/i686-linux-gnu/4.6/include-fixed -isystem /tools/include -D_LIBC_REENTRANT
-include ../include/libc-symbols.h -o /mnt/lfs/sources/glibc-build/misc/syslog.o
-MD -MP -MF /mnt/lfs/sources/glibc-build/misc/syslog.o.dt -MT /mnt/lfs/sources/glibc-
build/misc/syslog.o
In file included from ../sysdeps/unix/sysv/linux/syslog.c:10:0:
../misc/syslog.c: In function '__vsyslog_chk':
../misc/syslog.c:144:9: warning: variable 'prioff' set but not used [-Wunused-but-set-
variable]
../misc/syslog.c:123:1: sorry, unimplemented: inlining failed in call to 'syslog':
function body not available
../misc/syslog.c:155:9: sorry, unimplemented: called from here
make[2]: *** [/mnt/lfs/sources/glibc-build/misc/syslog.o] Error 1
make[2]: Leaving directory `/mnt/lfs/sources/glibc-2.14.1/misc'
make[1]: *** [misc/subdir_lib] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/glibc-2.14.1'
make: *** [all] Error 2
Can anyone tell me what to do?
For glibc 2.15, I had to do like ks1322:
$ ../glibc2.15/configure CFLAGS="-O2 -U_FORTIFY_SOURCE -fno-stack-protector"
$ make
The -O2 is required to recover the default optimisation, required to avoid a number of failures.
The -U_FORTIFY_SOURCE is required to avoid failure of gcc ../sysdeps/unix/sysv/linux/syslog.c (In function ‘__vsyslog_chk’: [...] inlining failed in call to ‘syslog’)
The -fno-stack-protector is required to avoid failure of gcc [...] elf/dl-allobjs.os libc_pic.a ((init-first.os):(.data+0x0): multiple definition of '__libc_multiple_libcs').
With these CFLAGS, I get just a warning (errlist.c count 133 inflated to GLIBC_2.12 count 134 (old errno.h?)).
P.S. It is also very important to not use the gold linker (ld.gold, from the binutils-gold package), because libc's config will reject it. This is easily done by changing the /usr/bin/ld symbolic link from ld.gold to ld.bfd.
After make failed, the following worked for me:
make clean
make -j2 CFLAGS="-U_FORTIFY_SOURCE -O2 -fno-stack-protector"
See details in this blog http://www.yonch.com/tech/78-compiling-glibc.
glibc build issues, inlining failed
Need to add -U_FORTIFY_SOURCE to the gcc invocation.
#avinash - try the following ...
1) re-run configure ... CFLAGS="-O2 -U_FORTIFY_SOURCE" ./configure
2) re-run make ... CFLAGS="-O2 -U_FORTIFY_SOURCE" make

Resources