Discussion:
[update]: Does linaro toolchain support c++11 ??
zhangwentao (M)
2018-01-10 02:40:52 UTC
Permalink
Hi, all

I have updated my test case:

Compile passed but failed while linking.

***@ubuntu:~/test/lamda$ cat a.cc
#include <iostream>
using namespace std;

int main()
{
auto f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}


***@ubuntu:~/test/lamda$ arm-eabi-g++ --std=gnu++11 a.cc -o arm32
/home/wentao/TeeOS/tools/gcc-linaro-6.3.1-2017.05-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.3.1/../../../../arm-eabi/lib/libstdc++.a(locale.o): In function `get_locale_cache_mutex':
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale.cc:36: undefined reference to `__sync_synchronize'
/home/wentao/TeeOS/tools/gcc-linaro-6.3.1-2017.05-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.3.1/../../../../arm-eabi/lib/libstdc++.a(future.o): In function `__future_category_instance':
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++11/future.cc:64: undefined reference to `__sync_synchronize'
/home/wentao/TeeOS/tools/gcc-linaro-6.3.1-2017.05-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.3.1/../../../../arm-eabi/lib/libstdc++.a(locale_init.o): In function `(anonymous namespace)::get_locale_mutex()':
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale_init.cc:66: undefined reference to `__sync_synchronize'
collect2: error: ld returned 1 exit status
***@ubuntu:~/test/lamda$

·¢ŒþÈË: zhangwentao (M)
·¢ËÍʱŒä: 2018Äê1ÔÂ10ÈÕ 10:22
ÊÕŒþÈË: 'linaro-***@lists.linaro.org'
³­ËÍ: Huangqiang (H); Lizefan; leijitang
Ö÷Ìâ: Does linaro toolchain support c++11 ??

Hi all,

I wonder if my compiler supports C++11? If not, where could I found the compiler supports c++11 (both 32bit and 64bit arm).

THANKS a lot~~~

My compiler information is as below:

***@ubuntu:~/test/lamda$ arm-eabi-g++ -v
Using built-in specs.
COLLECT_GCC=arm-eabi-g++
COLLECT_LTO_WRAPPER=/home/wentao/TeeOS/tools/gcc-linaro-6.3.1-2017.05-x86_64_arm-eabi/bin/../libexec/gcc/arm-eabi/6.3.1/lto-wrapper
Target: arm-eabi
Configured with: '/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/configure' SHELL=/bin/bash --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-lto --enable-shared --without-included-gettext --enable-nls --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id --disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu --enable-libstdcxx-debug --enable-long-long --with-cloog=no --with-ppl=no --with-isl=no --enable-multilib --with-multilib-list=aprofile --enable-threads=no --disable-multiarch --with-newlib --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/sysroots/arm-eabi --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/x86_64-unknown-linux-gnu/arm-eabi/libc --enable-checking=release --disable-bootstrap --enable-languages=c,c++,lto --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=arm-eabi --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/x86_64-unknown-linux-gnu
Thread model: single
gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)
***@ubuntu:~/test/lamda$

===>
And more, I wrote a ¡°hello-world¡± program using c++11, it could work with host g++, but when I change to ¡°arm-eabi-g++¡±, it does not work.
Information as below:

***@ubuntu:~/test/lamda$ cat a.cc
#include <iostream>
using namespace std;

typedef void(*Func)();
int main()
{
Func f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
***@ubuntu:~/test/lamda$ g++ a.cc -o host
a.cc: In function ¡®int main()¡¯:
a.cc:10:2: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default]
};
^
***@ubuntu:~/test/lamda$ ./host
Hello world
***@ubuntu:~/test/lamda$ arm-eabi-g++ a.cc -o arm32
a.cc: In function ¡®int main()¡¯:
a.cc:10:2: error: cannot convert ¡®main()::<lambda()>¡¯ to ¡®Func {aka void (*)()}¡¯ in initialization
};
^
***@ubuntu:~/test/lamda$ arm-eabi-g++ --std=gnu++11 a.cc -o arm32 # if gives šCstd=c++11 , the error is the same.
a.cc: In function ¡®int main()¡¯:
a.cc:10:2: error: cannot convert ¡®main()::<lambda()>¡¯ to ¡®Func {aka void (*)()}¡¯ in initialization
};
^
***@ubuntu:~/test/lamda$
Christophe Lyon
2018-01-10 10:38:14 UTC
Permalink
Post by zhangwentao (M)
Hi, all
Compile passed but failed while linking.
#include <iostream>
using namespace std;
int main()
{
auto f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale.cc:36: undefined reference to `__sync_synchronize'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++11/future.cc:64: undefined reference to `__sync_synchronize'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale_init.cc:66: undefined reference to `__sync_synchronize'
collect2: error: ld returned 1 exit status
Hi,

This error happens because the arm-eabi compiler defaults to an old
version of the architecture (v4 or v5t). Adding -mcpu=cortex-a9 for
instance should avoid the problem because the compiler will be able to
generate synchronization primitives inline.

Christophe
Post by zhangwentao (M)
发件人: zhangwentao (M)
发送时间: 2018年1月10日 10:22
抄送: Huangqiang (H); Lizefan; leijitang
主题: Does linaro toolchain support c++11 ??
Hi all,
I wonder if my compiler supports C++11? If not, where could I found the compiler supports c++11 (both 32bit and 64bit arm).
THANKS a lot~~~
Using built-in specs.
COLLECT_GCC=arm-eabi-g++
COLLECT_LTO_WRAPPER=/home/wentao/TeeOS/tools/gcc-linaro-6.3.1-2017.05-x86_64_arm-eabi/bin/../libexec/gcc/arm-eabi/6.3.1/lto-wrapper
Target: arm-eabi
Configured with: '/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/configure' SHELL=/bin/bash --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-lto --enable-shared --without-included-gettext --enable-nls --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id --disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu --enable-libstdcxx-debug --enable-long-long --with-cloog=no --with-ppl=no --with-isl=no --enable-multilib --with-multilib-list=aprofile --enable-threads=no --disable-multiarch --with-newlib --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/sysroots/arm-eabi --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/x86_64-unknown-linux-gnu/arm-eabi/libc --enable-checking=release --disable-bootstrap --enable-languages=c,c++,lto --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=arm-eabi --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/x86_64-unknown-linux-gnu
Thread model: single
gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)
===>
And more, I wrote a “hello-world” program using c++11, it could work with host g++, but when I change to “arm-eabi-g++”, it does not work.
#include <iostream>
using namespace std;
typedef void(*Func)();
int main()
{
Func f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
a.cc:10:2: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default]
};
^
Hello world
a.cc:10:2: error: cannot convert ‘main()::<lambda()>’ to ‘Func {aka void (*)()}’ in initialization
};
^
a.cc:10:2: error: cannot convert ‘main()::<lambda()>’ to ‘Func {aka void (*)()}’ in initialization
};
^
_______________________________________________
linaro-toolchain mailing list
https://lists.linaro.org/mailman/listinfo/linaro-toolchain
zhangwentao (M)
2018-01-14 01:50:26 UTC
Permalink
Hi Christophe,

Thanks for your reply.

Actually I use ' -march=armv8-a ', and 'arm-eabi-arm' complier, after adding this flag, the test case compile passed. (THANKS again)

But, now I am using some third party libs, and added ' -march=armv8-a ' flag whiling compiling and linking, But the compiler say this error:

undefined reference to `__sync_fetch_and_add_4' ----> I think the compiler should supply all the atomic family functions with -march=xxx flags.

Does the compiler supply this functions?


Best Regard.


-----邮件原件-----
发件人: Christophe Lyon [mailto:***@linaro.org]
发送时间: 2018年1月10日 18:38
收件人: zhangwentao (M)
抄送: linaro-***@lists.linaro.org; Lizefan; leijitang; Huangqiang (H)
主题: Re: [update]: Does linaro toolchain support c++11 ??
Post by zhangwentao (M)
Hi, all
Compile passed but failed while linking.
#include <iostream>
using namespace std;
int main()
{
auto f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale.cc:36: undefined reference to `__sync_synchronize'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++11/future.cc:64: undefined reference to `__sync_synchronize'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale_init.cc:66: undefined reference to `__sync_synchronize'
Hi,

This error happens because the arm-eabi compiler defaults to an old version of the architecture (v4 or v5t). Adding -mcpu=cortex-a9 for instance should avoid the problem because the compiler will be able to generate synchronization primitives inline.

Christophe
Post by zhangwentao (M)
发件人: zhangwentao (M)
发送时间: 2018年1月10日 10:22
抄送: Huangqiang (H); Lizefan; leijitang
主题: Does linaro toolchain support c++11 ??
Hi all,
I wonder if my compiler supports C++11? If not, where could I found the compiler supports c++11 (both 32bit and 64bit arm).
THANKS a lot~~~
COLLECT_GCC=arm-eabi-g++
COLLECT_LTO_WRAPPER=/home/wentao/TeeOS/tools/gcc-linaro-6.3.1-2017.05-
x86_64_arm-eabi/bin/../libexec/gcc/arm-eabi/6.3.1/lto-wrapper
Target: arm-eabi
'/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/
label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2
017.05/configure' SHELL=/bin/bash
--with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_a
rch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdi
r/x86_64-unknown-linux-gnu
--with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_
arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destd
ir/x86_64-unknown-linux-gnu
--with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_a
rch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdi
r/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld
--disable-libmudflap --enable-lto --enable-shared
--without-included-gettext --enable-nls --disable-sjlj-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu
--enable-libstdcxx-debug --enable-long-long --with-cloog=no
--with-ppl=no --with-isl=no --enable-multilib
--with-multilib-list=aprofile --enable-threads=no --disable-multiarch
--with-newlib
--with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release
/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/sys
roots/arm-eabi
--with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/build
er_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/de
stdir/x86_64-unknown-linux-gnu/arm-eabi/libc --enable-checking=release
--disable-bootstrap --enable-languages=c,c++,lto
--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu
--target=arm-eabi
--prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arc
h/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/
x86_64-unknown-linux-gnu
Thread model: single
gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)
===>
And more, I wrote a “hello-world” program using c++11, it could work with host g++, but when I change to “arm-eabi-g++”, it does not work.
#include <iostream>
using namespace std;
typedef void(*Func)();
int main()
{
Func f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
a.cc:10:2: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default]
};
^
Hello world
a.cc:10:2: error: cannot convert ‘main()::<lambda()>’ to ‘Func {aka void (*)()}’ in initialization
};
^
a.cc:10:2: error: cannot convert ‘main()::<lambda()>’ to ‘Func {aka void (*)()}’ in initialization
};
^
_______________________________________________
linaro-toolchain mailing list
https://lists.linaro.org/mailman/listinfo/linaro-toolchain
Christophe Lyon
2018-01-15 09:28:03 UTC
Permalink
Post by zhangwentao (M)
Hi Christophe,
Thanks for your reply.
Actually I use ' -march=armv8-a ', and 'arm-eabi-arm' complier, after adding this flag, the test case compile passed. (THANKS again)
Are you using pre-built third party libs, or do you compile them yourself?
Post by zhangwentao (M)
undefined reference to `__sync_fetch_and_add_4' ----> I think the compiler should supply all the atomic family functions with -march=xxx flags.
Does the compiler supply this functions?
I think it should, but if you use pre-compiled libs, maybe they were
not compiled with all the flags you need.

Christophe
Post by zhangwentao (M)
Best Regard.
-----邮件原件-----
发送时间: 2018年1月10日 18:38
收件人: zhangwentao (M)
主题: Re: [update]: Does linaro toolchain support c++11 ??
Post by zhangwentao (M)
Hi, all
Compile passed but failed while linking.
#include <iostream>
using namespace std;
int main()
{
auto f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale.cc:36: undefined reference to `__sync_synchronize'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++11/future.cc:64: undefined reference to `__sync_synchronize'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale_init.cc:66: undefined reference to `__sync_synchronize'
Hi,
This error happens because the arm-eabi compiler defaults to an old version of the architecture (v4 or v5t). Adding -mcpu=cortex-a9 for instance should avoid the problem because the compiler will be able to generate synchronization primitives inline.
Christophe
Post by zhangwentao (M)
发件人: zhangwentao (M)
发送时间: 2018年1月10日 10:22
抄送: Huangqiang (H); Lizefan; leijitang
主题: Does linaro toolchain support c++11 ??
Hi all,
I wonder if my compiler supports C++11? If not, where could I found the compiler supports c++11 (both 32bit and 64bit arm).
THANKS a lot~~~
COLLECT_GCC=arm-eabi-g++
COLLECT_LTO_WRAPPER=/home/wentao/TeeOS/tools/gcc-linaro-6.3.1-2017.05-
x86_64_arm-eabi/bin/../libexec/gcc/arm-eabi/6.3.1/lto-wrapper
Target: arm-eabi
'/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/
label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2
017.05/configure' SHELL=/bin/bash
--with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_a
rch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdi
r/x86_64-unknown-linux-gnu
--with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_
arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destd
ir/x86_64-unknown-linux-gnu
--with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_a
rch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdi
r/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld
--disable-libmudflap --enable-lto --enable-shared
--without-included-gettext --enable-nls --disable-sjlj-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu
--enable-libstdcxx-debug --enable-long-long --with-cloog=no
--with-ppl=no --with-isl=no --enable-multilib
--with-multilib-list=aprofile --enable-threads=no --disable-multiarch
--with-newlib
--with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release
/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/sys
roots/arm-eabi
--with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/build
er_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/de
stdir/x86_64-unknown-linux-gnu/arm-eabi/libc --enable-checking=release
--disable-bootstrap --enable-languages=c,c++,lto
--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu
--target=arm-eabi
--prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arc
h/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir/
x86_64-unknown-linux-gnu
Thread model: single
gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)
===>
And more, I wrote a “hello-world” program using c++11, it could work with host g++, but when I change to “arm-eabi-g++”, it does not work.
#include <iostream>
using namespace std;
typedef void(*Func)();
int main()
{
Func f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
a.cc:10:2: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default]
};
^
Hello world
a.cc:10:2: error: cannot convert ‘main()::<lambda()>’ to ‘Func {aka void (*)()}’ in initialization
};
^
a.cc:10:2: error: cannot convert ‘main()::<lambda()>’ to ‘Func {aka void (*)()}’ in initialization
};
^
_______________________________________________
linaro-toolchain mailing list
https://lists.linaro.org/mailman/listinfo/linaro-toolchain
zhangwentao (M)
2018-01-16 01:49:32 UTC
Permalink
Hi Christophe
I compile my APP with Android NDK (c++ 11) and linking libs from NDK packet. I don't know what's does it mean by "pre-built" third party build.


And more:
I found that our compiler provide __sync_val_compare_and_swap . should I use " __sync_val_compare_and_swap" to implement `__sync_fetch_and_add_4` Or __sync_fetch_and_add ?


Best regard.

-----邮件原件-----
发件人: Christophe Lyon [mailto:***@linaro.org]
发送时间: 2018年1月15日 17:28
收件人: zhangwentao (M)
抄送: linaro-***@lists.linaro.org; Lizefan; leijitang; Huangqiang (H)
主题: Re: About "__sync_fetch_and_add_4"//Re: [update]: Does linaro toolchain support c++11 ??
Post by zhangwentao (M)
Hi Christophe,
Thanks for your reply.
Actually I use ' -march=armv8-a ', and 'arm-eabi-arm' complier,
after adding this flag, the test case compile passed. (THANKS again)
Are you using pre-built third party libs, or do you compile them yourself?
Post by zhangwentao (M)
undefined reference to `__sync_fetch_and_add_4' ----> I think the compiler should supply all the atomic family functions with -march=xxx flags.
Does the compiler supply this functions?
I think it should, but if you use pre-compiled libs, maybe they were not compiled with all the flags you need.

Christophe
Post by zhangwentao (M)
Best Regard.
-----邮件原件-----
发送时间: 2018年1月10日 18:38
收件人: zhangwentao (M)
主题: Re: [update]: Does linaro toolchain support c++11 ??
Post by zhangwentao (M)
Hi, all
Compile passed but failed while linking.
#include <iostream>
using namespace std;
int main()
{
auto f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale.cc:36: undefined reference to `__sync_synchronize'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++11/future.cc:64: undefined reference to `__sync_synchronize'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale_init.cc:66: undefined reference to `__sync_synchronize'
collect2: error: ld returned 1 exit status
Hi,
This error happens because the arm-eabi compiler defaults to an old version of the architecture (v4 or v5t). Adding -mcpu=cortex-a9 for instance should avoid the problem because the compiler will be able to generate synchronization primitives inline.
Christophe
Post by zhangwentao (M)
发件人: zhangwentao (M)
发送时间: 2018年1月10日 10:22
抄送: Huangqiang (H); Lizefan; leijitang
主题: Does linaro toolchain support c++11 ??
Hi all,
I wonder if my compiler supports C++11? If not, where could I found the compiler supports c++11 (both 32bit and 64bit arm).
THANKS a lot~~~
COLLECT_GCC=arm-eabi-g++
COLLECT_LTO_WRAPPER=/home/wentao/TeeOS/tools/gcc-linaro-6.3.1-2017.05
- x86_64_arm-eabi/bin/../libexec/gcc/arm-eabi/6.3.1/lto-wrapper
Target: arm-eabi
'/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64
/
label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-
2
017.05/configure' SHELL=/bin/bash
--with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_
a
rch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destd
i
r/x86_64-unknown-linux-gnu
--with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/builder
_
arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/dest
d
ir/x86_64-unknown-linux-gnu
--with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_
a
rch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destd
i r/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld
--disable-libmudflap --enable-lto --enable-shared
--without-included-gettext --enable-nls --disable-sjlj-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu
--enable-libstdcxx-debug --enable-long-long --with-cloog=no
--with-ppl=no --with-isl=no --enable-multilib
--with-multilib-list=aprofile --enable-threads=no --disable-multiarch
--with-newlib
--with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-releas
e
/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/sy
s
roots/arm-eabi
--with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/buil
d
er_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/d
e stdir/x86_64-unknown-linux-gnu/arm-eabi/libc
--enable-checking=release --disable-bootstrap
--enable-languages=c,c++,lto --build=x86_64-unknown-linux-gnu
--host=x86_64-unknown-linux-gnu --target=arm-eabi
--prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_ar
c
h/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir
/
x86_64-unknown-linux-gnu
Thread model: single
gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)
===>
And more, I wrote a “hello-world” program using c++11, it could work with host g++, but when I change to “arm-eabi-g++”, it does not work.
#include <iostream>
using namespace std;
typedef void(*Func)();
int main()
{
Func f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
a.cc:10:2: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default]
};
^
Hello world
a.cc:10:2: error: cannot convert ‘main()::<lambda()>’ to ‘Func {aka void (*)()}’ in initialization
};
^
a.cc:10:2: error: cannot convert ‘main()::<lambda()>’ to ‘Func {aka void (*)()}’ in initialization
};
^
_______________________________________________
linaro-toolchain mailing list
https://lists.linaro.org/mailman/listinfo/linaro-toolchain
Christophe Lyon
2018-01-16 08:51:54 UTC
Permalink
Post by zhangwentao (M)
Hi Christophe
I compile my APP with Android NDK (c++ 11) and linking libs from NDK packet. I don't know what's does it mean by "pre-built" third party build.
Hi,
By "pre-built", I mean you are using libs as ".a" files provided by
the NDK, you are not compiling these libs yourself.
Post by zhangwentao (M)
I found that our compiler provide __sync_val_compare_and_swap . should I use " __sync_val_compare_and_swap" to implement `__sync_fetch_and_add_4` Or __sync_fetch_and_add ?
I don't know, I suggest you contact Linaro support (LDTS).

Thanks,

Christophe
Post by zhangwentao (M)
Best regard.
-----邮件原件-----
发送时间: 2018年1月15日 17:28
收件人: zhangwentao (M)
主题: Re: About "__sync_fetch_and_add_4"//Re: [update]: Does linaro toolchain support c++11 ??
Post by zhangwentao (M)
Hi Christophe,
Thanks for your reply.
Actually I use ' -march=armv8-a ', and 'arm-eabi-arm' complier,
after adding this flag, the test case compile passed. (THANKS again)
Are you using pre-built third party libs, or do you compile them yourself?
Post by zhangwentao (M)
undefined reference to `__sync_fetch_and_add_4' ----> I think the compiler should supply all the atomic family functions with -march=xxx flags.
Does the compiler supply this functions?
I think it should, but if you use pre-compiled libs, maybe they were not compiled with all the flags you need.
Christophe
Post by zhangwentao (M)
Best Regard.
-----邮件原件-----
发送时间: 2018年1月10日 18:38
收件人: zhangwentao (M)
主题: Re: [update]: Does linaro toolchain support c++11 ??
Post by zhangwentao (M)
Hi, all
Compile passed but failed while linking.
#include <iostream>
using namespace std;
int main()
{
auto f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale.cc:36: undefined reference to `__sync_synchronize'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++11/future.cc:64: undefined reference to `__sync_synchronize'
/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-2017.05/libstdc++-v3/src/c++98/locale_init.cc:66: undefined reference to `__sync_synchronize'
collect2: error: ld returned 1 exit status
Hi,
This error happens because the arm-eabi compiler defaults to an old version of the architecture (v4 or v5t). Adding -mcpu=cortex-a9 for instance should avoid the problem because the compiler will be able to generate synchronization primitives inline.
Christophe
Post by zhangwentao (M)
发件人: zhangwentao (M)
发送时间: 2018年1月10日 10:22
抄送: Huangqiang (H); Lizefan; leijitang
主题: Does linaro toolchain support c++11 ??
Hi all,
I wonder if my compiler supports C++11? If not, where could I found the compiler supports c++11 (both 32bit and 64bit arm).
THANKS a lot~~~
COLLECT_GCC=arm-eabi-g++
COLLECT_LTO_WRAPPER=/home/wentao/TeeOS/tools/gcc-linaro-6.3.1-2017.05
- x86_64_arm-eabi/bin/../libexec/gcc/arm-eabi/6.3.1/lto-wrapper
Target: arm-eabi
'/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64
/
label/tcwg-x86_64-build/target/arm-eabi/snapshots/gcc.git~linaro-6.3-
2
017.05/configure' SHELL=/bin/bash
--with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_
a
rch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destd
i
r/x86_64-unknown-linux-gnu
--with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/builder
_
arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/dest
d
ir/x86_64-unknown-linux-gnu
--with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_
a
rch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destd
i r/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld
--disable-libmudflap --enable-lto --enable-shared
--without-included-gettext --enable-nls --disable-sjlj-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu
--enable-libstdcxx-debug --enable-long-long --with-cloog=no
--with-ppl=no --with-isl=no --enable-multilib
--with-multilib-list=aprofile --enable-threads=no --disable-multiarch
--with-newlib
--with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-releas
e
/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/sy
s
roots/arm-eabi
--with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/buil
d
er_arch/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/d
e stdir/x86_64-unknown-linux-gnu/arm-eabi/libc
--enable-checking=release --disable-bootstrap
--enable-languages=c,c++,lto --build=x86_64-unknown-linux-gnu
--host=x86_64-unknown-linux-gnu --target=arm-eabi
--prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_ar
c
h/amd64/label/tcwg-x86_64-build/target/arm-eabi/_build/builds/destdir
/
x86_64-unknown-linux-gnu
Thread model: single
gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)
===>
And more, I wrote a “hello-world” program using c++11, it could work with host g++, but when I change to “arm-eabi-g++”, it does not work.
#include <iostream>
using namespace std;
typedef void(*Func)();
int main()
{
Func f = [=]() {
cout <<"Hello world"<<endl;
};
f();
return 0;
}
a.cc:10:2: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default]
};
^
Hello world
a.cc:10:2: error: cannot convert ‘main()::<lambda()>’ to ‘Func {aka void (*)()}’ in initialization
};
^
a.cc:10:2: error: cannot convert ‘main()::<lambda()>’ to ‘Func {aka void (*)()}’ in initialization
};
^
_______________________________________________
linaro-toolchain mailing list
https://lists.linaro.org/mailman/listinfo/linaro-toolchain
Loading...