g++-arm-linux-gnueabi cannot compile a C++ program with --sysroot
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-defaults-armel-cross (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned | ||
gcc-defaults-armhf-cross (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
g++-arm-
The rest of the report just dumps information. But to summarize the dump...
We need the paths:
A) /usr/arm-
B) /usr/arm-
But the built-in paths tries to use:
C) /usr/arm-
D) /usr/arm-
E) /usr/arm-
Notice the built-in paths use an extra "/usr/arm-
*****
Ubuntu 14.04 (x64), fully patched. gcc-arm-
$ uname -sm
Linux x86_64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
*****
$ /usr/bin/
arm-linux-
Copyright (C) 2012 Free Software Foundation, Inc.
And:
$ ls /usr/arm-
bin include lib
And:
$ cat embedded.cpp
#include <iostream>
int main(int argc, char* argv[])
{
std::cout << "Hello World" << std::endl;
return 0;
}
*****
$ /usr/bin/
embedded.cpp:1:20: fatal error: iostream: No such file or directory
compilation terminated.
*****
It appears the C++ headers are not included with SYSROOT. If I add the C++ header paths, then the compile is successful:
$ /usr/bin/
$
And:
$ /usr/bin/
readelf: Error: 'readelf': No such file
Class: ELF32
Machine: ARM
*****
From http://
$ /usr/bin/
/usr/lib/
/usr/lib/
/usr/lib/
/usr/include
*****
However, there's actually more to the paths than shown on ToolChain wiki, and this shows the incorrect C++ lookups. There's an extra '/usr/arm-
$ /usr/bin/
Using built-in specs.
COLLECT_
...
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-
ignoring nonexistent directory "/usr/arm-
ignoring nonexistent directory "/usr/arm-
ignoring nonexistent directory "/usr/arm-
ignoring nonexistent directory "/usr/arm-
ignoring nonexistent directory "/usr/arm-
ignoring nonexistent directory "/usr/arm-
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/
/usr/lib/
/usr/lib/
End of search list.
...
*****
$ /usr/bin/
Using built-in specs.
COLLECT_
COLLECT_
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1)
Just in case... Both of these produced the error (so it was not the "=" sign after SYSROOT):
/usr/bin/ arm-linux- gnueabi- g++ --sysroot= /usr/arm- linux-gnueabi embedded.cpp -o embedded.exe
/usr/bin/ arm-linux- gnueabi- g++ --sysroot /usr/arm- linux-gnueabi embedded.cpp -o embedded.exe