EmbDev.net

Forum: ARM programming with GCC/GNU tools Errors compiling with arm-elf-g++


von Juke J. (jjohnson)


Rate this post
useful
not useful
I was attempting to build a very simple example using arm-elf-g++ and
got a bunch of compliation errors that look like this:

--------------- BEGIN ERROR ---------------------

Building file: ../vector1.cpp
Invoking: Cygwin C++ Compiler
arm-elf-g++ -I"C:\cppLibs\mtl4" -I"C:\cppLibs\boost_1_34_1"
-I"C:\cygwin\opt\ecos\ecos-cvs\tmp\install\include" -O0 -g3 -Wall -c -MD
-MMD -MP -MF"vector1.d" -MT"vector1.d" -o"vector1.o" "../vector1.cpp"
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:46:
error: '_U' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:47:
error: '_L' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:48:
error: '_U' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:48:
error: '_L' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:49:
error: '_N' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:50:
error: '_X' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:50:
error: '_N' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:51:
error: '_S' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:52:
error: '_P' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:52:
error: '_U' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:52:
error: '_L' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:52:
error: '_N' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:52:
error: '_B' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:53:
error: '_P' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:53:
error: '_U' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:53:
error: '_L' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:53:
error: '_N' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:54:
error: '_C' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:55:
error: '_P' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:56:
error: '_U' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:56:
error: '_L' was not declared in this scope
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/arm-elf/bits/ctype_base.h:56:
error: '_N' was not declared in this scope
make: *** [vector1.o] Error 1

-------------- END ERROR ------------------------------

The source code doesn't do anything but simply including <iostream> is
all that is needed to generate the error.

I'm new to all this so any assistance is greatly appreciated.  Thank
you.

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
Maybe a namespace-problem. Did you check if a simple compiles with the
native compiler/toolchain of your host (typically just named, not the
cross-compiler arm-*-gcc)?

von Juke J. (jjohnson)


Rate this post
useful
not useful
Martin Thomas wrote:
> Maybe a namespace-problem. Did you check if a simple compiles with the
> native compiler/toolchain of your host (typically just named, not the
> cross-compiler arm-*-gcc)?

Thanks for the reply Martin.

I was able to successfully compile my code using the standard g++ rather
than arm-elf-g++.  I'm not clear on how this would be indicative of a
namespace problem.

As a quick experiment I edited ctype_base.h to remove the references to
the undeclared variables and it compiled successfully but I got the
following error while linking:

------------- BEGIN ERROR -----------------
arm-elf-g++ -nostartfiles -nostdlib
-L"C:\cygwin\opt\ecos\ecos-cvs\tmp\install\lib" -Ttarget.ld
-Wl,-Map=map.txt -mcpu=arm9tdmi -Wl,--gc-sections -g -o"vector1.exe"
./vector1.o
./vector1.o: In function `__static_initialization_and_destruction_0':
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/iostream:76:
undefined reference to `std::ios_base::Init::Init()'
c:\cygwin\opt\winarm\bin\../lib/gcc/arm-elf/4.1.1/../../../../include/c+ 
+/4.1.1/iostream:76:
undefined reference to `std::ios_base::Init::~Init()'
----------------- END ------------------------

Any thoughts?  I was optimistically hoping it would be fairly
straight-forward to get this simple example working.  I guess I was a
little naive. :-)

von Clifford S. (clifford)


Rate this post
useful
not useful
Juke Johnson wrote:
> As a quick experiment I edited ctype_base.h to remove the references to
> the undeclared variables and it compiled successfully but I got the
> following error while linking:

I am sure you realise that that is not a solution (although such things
are often useful in finding the cause). The standard headers work. If
they fail, something else is wrong.

I note that you are using Cygwin but have a folder called 'winarm'.
Would I be right to assume that you have WinARM installed under Cygwin?
WinARM does not need Cygwin (in my opinion its greatest asset Cygwin
causes more problems than it solves in my opinion especially if you use
more than one tool that relies upon it to work). Moreover, even if not
working in a Bash shell, if the Windows environment has references to
the native toolchain it may use that (or worse - parts of that) when you
did not intend it to. The GCC toolchain will use a number of environment
variables to affect where it gets files from. If your Cygwin environment
is set up for native compilation on the host, those environment
variables may cause GCC to access the host target files rather than the
ARM target files.

The 'missing' constants are #define'ed in
..\WinARM\arm-elf\include\ctype.h. I grep'ed on
"[^_0-9a-zA-Z]_U[^_0-9a-zA-Z]" to find that. Actually grep is too
hardcore for me ;-), I used an editor that had a regular expression file
search facility.

If you have any other ctype.h anywhere on your system that does not
define _U (or any of the other masks), then that is likely what you have
picked up and your environment is not correctly configured for
cross-compilation. The alternative is that you just have the wrong
version of ctype.h perhaps.


Clifford

von Redgis (Guest)


Rate this post
useful
not useful
For the information of others experiencing this issue :

I experienced a similar issue (http://pastebin.com/4DAbYB8T). In my case 
it seemed that the problem was caused by environment variables, namely 
"CPLUS_INCLUDE_PATH" and maybe "C_INCLUDE_PATH". These variables 
contained paths to my system C++ includes which, I guess, were 
interfering with the armabi platform includes.

I simply unset those two env. variables.

Redgis

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.