Hi,
I have two problems with compiling my program. One is that I cannot get correct output with Genode::printf or sprintf for (unsigend) long long values. Below is my code: #include <base/printf.h> #include <stdio.h> #include <sys/types.h>
int main() { char test_buf[24]; uint64_t llu_var = 1234567801234ULL; sprintf(test_buf, "%llu", llu_var); Genode::printf("result of test_buf:%s\n", test_buf); Genode::printf("llu_var:%llu\n", llu_var); return 0; }
I compiled this with "LIBS += env cxx libc" in target.mk and built it for foc_pbxa9 on QEMU. The result is strange: [init->mytest] result of test_buf:2153943278813471 [init->mytest] llu_var:8212781840017129473
Another one is that I get compilation errors as below:
source codes: #include <base/printf.h> #include <stdio.h> #include <sys/types.h> #include <string.h> #include <sstream>
using namespace std; template <class T> inline string to_string(const T& t) { stringstream ss; ss << t; return ss.str(); }
int main() { int64_t value = 1023456LL; Genode::printf("sstream value:%lld, to_string:%s\n", value, to_string(value).c_str()); return 0; }
in target.mk LIBS += stdcxx env cxx libc CC_OPT += -D_GLIBCXX_HAVE_MBSTATE_T
error message: /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o): In function '__cxa_begin_catch': (.text.__cxa_begin_catch+0xc0): undefined reference to '__Unwind_Complete' /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o): In function '__cxa_end_catch': (.text.__cxa_end_catch+0x30): undefined reference to '__Unwind_DeleteException' /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o): In function '__cxa_end_catch': (.text.__cxa_end_catch+0xdc): undefined reference to '__Unwind_DeleteException' collect2: ld returned 1 exit status make[2]: *** [mytest] Error 1
Does any one know how to fix these? Thanks.
Hello 정복득,
thanks for reporting. I gave both issues a go.
On Tue, Jul 10, 2012 at 11:57:51AM +0000, 정복득 wrote:
I have two problems with compiling my program. One is that I cannot get correct output with Genode::printf or sprintf for (unsigend) long long values.
I could not reproduce this with current Genode master. The code [1] produces the expected output:
[init -> test-ll_var] result of test_buf:1234567801234 [init -> test-ll_var] llu_var:1234567801234
Could you please test again with my test branch/the attached patch?
Another one is that I get compilation errors as below:
error message: /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o): In function '__cxa_begin_catch': (.text.__cxa_begin_catch+0xc0): undefined reference to '__Unwind_Complete' /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o): In function '__cxa_end_catch': (.text.__cxa_end_catch+0x30): undefined reference to '__Unwind_DeleteException' /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o): In function '__cxa_end_catch': (.text.__cxa_end_catch+0xdc): undefined reference to '__Unwind_DeleteException' collect2: ld returned 1 exit status make[2]: *** [mytest] Error 1
This indeed seems to be a bug in Genode and I opened a new issue https://github.com/genodelabs/genode/issues/275 using this code [2]. We will investigate this further and report here.
[1] https://github.com/chelmuth/genode/tree/test-ll_var or attachment test-ll_var.patch [2] https://github.com/chelmuth/genode/tree/test-sstream or attachment test-sstream.patch
Regards
On 10.07.2012 21:34, Christian Helmuth wrote:
Another one is that I get compilation errors as below:
error message: /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o): In function '__cxa_begin_catch': (.text.__cxa_begin_catch+0xc0): undefined reference to '__Unwind_Complete' /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o): In function '__cxa_end_catch': (.text.__cxa_end_catch+0x30): undefined reference to '__Unwind_DeleteException' /usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o): In function '__cxa_end_catch': (.text.__cxa_end_catch+0xdc): undefined reference to '__Unwind_DeleteException' collect2: ld returned 1 exit status make[2]: *** [mytest] Error 1
This indeed seems to be a bug in Genode and I opened a new issue https://github.com/genodelabs/genode/issues/275 using this code [2]. We will investigate this further and report here.
I committed a patch in https://github.com/cproc/genode/commit/277bbd4de8985bb182b222138734b0f0bf3f0...
Christian