This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: uSTL Template
On Fri, Aug 21, 2009 at 11:04:53AM +0200, cetoni GmbH - Uwe Kindler wrote:
> Hi John,
>
> o.k. you are right.
>
> But then it would be good to state somewhere, that the user should start
> from the default package and then add File I/O and uSTL package. I will
> try to provide a little piece of SGML documentation for uSTL package
> that gives some hints for first use and then refers to the online uSTL
> documentation.
>
> Regards, Uwe
Hello
They did break my phone line (=ADSL=internet=mail=ecos-lists) :-) So, I
missed the interesting things which occured these days (ustl, lwip).
Uwe, just now I tried uSTL package on synthetic target using latest CVS.
Unfortunately, I ran in that old linkage issue.
The uSTL's bktrace.cpp has
#if linux
#include <execinfo.h>
#else
...
i.e. for Linux synthetic build gcc includes host's header and then we'll
get a few unresolved externals on the linkage stage. My old proposal was
wrap that check with !__ECOS__ for example and add something like this
-D__ECOS__=1 in the package's CFLAGS, but, in fact, it would enough
scribble '#if 0' for that linux check in bktrace.cpp and do not make a
mess of things in CDL. The choice is yours.
Off-topic. Just curiously enough, why eCos cannot identify itself via
CPP? We know some CPP definitions for other OSes (environments), like
bsd, linux, cygwin, mingw, win32, mingw, djgpp, etc. I grep eCos tree
for __ECOS and found differrent variants of the own-identification :-)
What's about global definition and standard for eCos build? It would
arange a porting style.
Well, the eCos libraries with uSTL were built with i386-elf-gcc (4.3.2)
from eCosCentric. Host: Ubuntu 8.04.3 LTS. eCos: updated CVS tree. The
below is a description of the results.
Appendix
i. Synopsis of my test drive (cut from bash history and commented a bit)
##
# My eCos from scratch
##
echo $ECOS_REPOSITORY
/opt/trunk/devo/ecos/packages
# clean up my ecos repo
rm -r /opt/trunk/devo
# use clean CVS copy
cp -a /opt/trunk/clean /opt/trunk/devo
##
# Build
##
mkdir tests ; cd tests
# configure ecos as
ecosconfig new linux
ecosconfig add fileio ustl
# use stable, well tested toolchain from eCosCentric
ecosconfig import /dev/stdin << EOT
cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX {
user_value i386-elf
};
EOT
ecosconfig tree
make -s headers
# First, check uSTL build itself, I expect to see no warnings
make -s -C language/cxx/ustl/current
I saw 1 warning with GCC 4.3.2.
/opt/trunk/devo/ecos/packages/language/cxx/ustl/current/src/uexception.cpp: In member function 'virtual void ustl::exception::read(ustl::istream&)':
/opt/trunk/devo/ecos/packages/language/cxx/ustl/current/src/uexception.cpp:38: warning: 'stmSize' may be used uninitialized in this function
I attached that uexception.cpp.patch. Well, that's minor thing.
# make libraries
make -s
# workaround for an absent libgcc_eh.a
sed -i 's,libgcc_eh.a,,' install/lib/target.ld
# Try to build bvts
make -s -C language/cxx/ustl/current tests TESTS=tests/bvt00
/opt/home/sg/Desktop/ustl_test/install/lib/libtarget.a(language_cxx_ustl_bktrace.o): In function `ustl::CBacktrace::GetSymbols()':
/opt/trunk/devo/ecos/packages/language/cxx/ustl/current/src/bktrace.cpp:73: undefined reference to `backtrace_symbols'
/opt/home/sg/Desktop/ustl_test/install/lib/libtarget.a(language_cxx_ustl_bktrace.o): In function `CBacktrace':
/opt/trunk/devo/ecos/packages/language/cxx/ustl/current/src/bktrace.cpp:24: undefined reference to `backtrace'
collect2: ld returned 1 exit status
make: *** [/opt/home/sg/Desktop/ustl_test/install/tests/language/cxx/ustl/current/tests/bvt00] Error 1
Ooops, it's that <execinfo.h>'s deal. I applied that attached
bktrace.cpp.patch and repeat all the above from scratch. Then
it was possible to run all without any issues.
##
# Batch
##
# try run bvts, all should pass, but bvt25 (no fs)
for t in install/tests/language/cxx/ustl/current/tests/bvt??
do
echo $t ; $t -nw -io ;
done | tee bvt.log
All passed successfully, but bvt25.
Note: all as the above was repeated from scratch, but, for uSTL build
without fileio
cdl_component CYGCLS_USTL_FSTREAMS {
inferred_value 0
};
i.e.
ecosconfig new linux
ecosconfig add ustl
to be sure that __cxa_pure_virtual issue went away from the infra's
sprintfs tests. I did not observe the issue.
Other issue(s)
I could not link bvt23 using host gcc-4.2.4 (Ubuntu 8.04.3 LTS). I'm
sorry, I cannot investigate in that. I use and used i386-elf-gcc from
eCosCentric for the testing as I do it as well.
Foreigners ;-)
grep -rl '^M' language
language/cxx/ustl/current/README
language/cxx/ustl/current/cdl/ustl.cdl
language/cxx/ustl/current/src/twothreads.cpp
language/cxx/ustl/current/src/ustlecos.cpp
language/cxx/ustl/current/include/config.h
language/cxx/ustl/current/include/ustlecos.h
language/cxx/ustl/current/ChangeLog
Well, Uwe, that was my brief look. Thank you for distribution.
Regards,
Sergei
Index: language/cxx/ustl/current/src/bktrace.cpp
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/cxx/ustl/current/src/bktrace.cpp,v
retrieving revision 1.1
diff -u -5 -p -r1.1 bktrace.cpp
--- language/cxx/ustl/current/src/bktrace.cpp 20 Aug 2009 17:00:31 -0000 1.1
+++ language/cxx/ustl/current/src/bktrace.cpp 21 Aug 2009 11:20:59 -0000
@@ -4,11 +4,11 @@
// This file is free software, distributed under the MIT License.
#include "bktrace.h"
#include "sostream.h"
#include "mistream.h"
-#if linux && __GNUC__
+#if 0 // linux && __GNUC__
#include <execinfo.h>
#else
static inline int backtrace (void**, int) { return (0); }
static inline char** backtrace_symbols (void* const*, int) { return (NULL); }
#endif
Index: language/cxx/ustl/current/src/uexception.cpp
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/cxx/ustl/current/src/uexception.cpp,v
retrieving revision 1.1
diff -u -5 -p -r1.1 uexception.cpp
--- language/cxx/ustl/current/src/uexception.cpp 20 Aug 2009 17:00:31 -0000 1.1
+++ language/cxx/ustl/current/src/uexception.cpp 21 Aug 2009 11:21:20 -0000
@@ -33,11 +33,11 @@ void exception::info (string& msgbuf, co
}
/// Reads the exception from stream \p is.
void exception::read (istream& is)
{
- uint32_t stmSize;
+ uint32_t stmSize = 0;
xfmt_t fmt = xfmt_Exception;
is >> fmt >> stmSize >> m_Backtrace;
assert (fmt == m_Format && "The saved exception is of a different type.");
assert ((stmSize + 8) - exception::stream_size() <= is.remaining() && "The saved exception data is corrupt.");
m_Format = fmt;