maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   C++11 toolchain for N9/N950 (https://talk.maemo.org/showthread.php?t=89460)

jkt 2013-03-13 22:31

C++11 toolchain for N9/N950
 
I suspect this is a hopeless request, but I'm going to ask anyway -- the toolchain which ships with QtSDK for harmattan is rather old, it doesn't support C++11's lambdas, among other things.

Is there a compiler one could use which has support for more C++11 features (like the lambdas or nullptr) and at the same time doesn't require an extensive update to the libstdc++ installed on device? Basically, either a recent clang or GCC 4.7+.

sapochule 2013-05-13 19:53

Re: C++11 toolchain for N9/N950
 
Would love to hear if this is possible as well, lambdas are a great feature :)

jkt 2013-08-13 02:48

Re: C++11 toolchain for N9/N950
 
OK, after some fiddling, I've managed to get Madde working with clang 3.3. They key was to make sure that clang is built with support for appropriate targets (it is by default), and that there's a faked "c++" binary in the $TARGET/bin. The following works for me:

Code:

#!/bin/bash

# Compiler wrapper for using clang within a cmake-based buildsystem for producing MeeGo Harmattan packages
# Written by Jan Kundrát <jkt@flaska.net> during a sleepless night
# Licensed under a three-clause BSD license
#
#
# 1) Create a new Madde target, i.e. "clang-rm680", a blank directory within ~/QtSDK/Madde/targets/
#
# 2) Set up the following directory structure:
# jkt@svist ~/QtSDK/Madde/targets/clang-rm680 $ tree
# .
# |-- bin
# |  |-- addr2line -> ../../harmattan_10.2011.34-1_rt1.2/bin/addr2line
# |  |-- ar -> ../../harmattan_10.2011.34-1_rt1.2/bin/ar
# |  |-- as -> ../../harmattan_10.2011.34-1_rt1.2/bin/as
# |  |-- c++
# |  |-- c++filt -> ../../harmattan_10.2011.34-1_rt1.2/bin/c++filt
# |  |-- cc -> ../../harmattan_10.2011.34-1_rt1.2/bin/cc
# |  |-- cpp -> ../../harmattan_10.2011.34-1_rt1.2/bin/cpp
# |  |-- g++ -> ../../harmattan_10.2011.34-1_rt1.2/bin/g++
# |  |-- gcc -> ../../harmattan_10.2011.34-1_rt1.2/bin/gcc
# |  |-- gccbug -> ../../harmattan_10.2011.34-1_rt1.2/bin/gccbug
# |  |-- gcov -> ../../harmattan_10.2011.34-1_rt1.2/bin/gcov
# |  |-- gdb -> ../../harmattan_10.2011.34-1_rt1.2/bin/gdb
# |  |-- gdbtui -> ../../harmattan_10.2011.34-1_rt1.2/bin/gdbtui
# |  |-- gprof -> ../../harmattan_10.2011.34-1_rt1.2/bin/gprof
# |  |-- ld -> ../../harmattan_10.2011.34-1_rt1.2/bin/ld
# |  |-- lrelease -> ../../harmattan_10.2011.34-1_rt1.2/bin/lrelease
# |  |-- lupdate -> ../../harmattan_10.2011.34-1_rt1.2/bin/lupdate
# |  |-- mgen -> ../../harmattan_10.2011.34-1_rt1.2/bin/mgen
# |  |-- mmoc -> ../../harmattan_10.2011.34-1_rt1.2/bin/mmoc
# |  |-- mmoc.pl -> ../../harmattan_10.2011.34-1_rt1.2/bin/mmoc.pl
# |  |-- moc -> ../../harmattan_10.2011.34-1_rt1.2/bin/moc
# |  |-- nm -> ../../harmattan_10.2011.34-1_rt1.2/bin/nm
# |  |-- objcopy -> ../../harmattan_10.2011.34-1_rt1.2/bin/objcopy
# |  |-- objdump -> ../../harmattan_10.2011.34-1_rt1.2/bin/objdump
# |  |-- qmake -> ../../harmattan_10.2011.34-1_rt1.2/bin/qmake
# |  |-- qt.conf -> ../../harmattan_10.2011.34-1_rt1.2/bin/qt.conf
# |  |-- ranlib -> ../../harmattan_10.2011.34-1_rt1.2/bin/ranlib
# |  |-- rcc -> ../../harmattan_10.2011.34-1_rt1.2/bin/rcc
# |  |-- readelf -> ../../harmattan_10.2011.34-1_rt1.2/bin/readelf
# |  |-- size -> ../../harmattan_10.2011.34-1_rt1.2/bin/size
# |  |-- strings -> ../../harmattan_10.2011.34-1_rt1.2/bin/strings
# |  |-- strip -> ../../harmattan_10.2011.34-1_rt1.2/bin/strip
# |  `-- uic -> ../../harmattan_10.2011.34-1_rt1.2/bin/uic
# |-- config.sh -> ../harmattan_10.2011.34-1_rt1.2/config.sh
# |-- information -> ../harmattan_10.2011.34-1_rt1.2/information
# |-- lib -> ../harmattan_10.2011.34-1_rt1.2/lib
# `-- specs -> ../harmattan_10.2011.34-1_rt1.2/specs
#
# 3) Put this file into the bin/c++
#
# 4) When building, use "clang-rm680" as the Madde target

# crude hack for detecting whether to forward this to GCC's c++ in case it's about linking...
echo "${@}" | grep -q -E -- '-rdynamic|-soname'
if [[ $? -eq 1 ]]; then
    # Funny fact: clang 3.3 doesn't do exceptions on ARM by default
    # See http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-February/059015.html
    # and the rest of the thread
    clang++ -target armv7l-linux-gnueabi -mfloat-abi=hard \
        -mllvm -arm-enable-ehabi -mllvm -arm-enable-ehabi-descriptors \
        --sysroot ${SYSROOT_DIR} -integrated-as $@
    # Theoretically, we could perhaps pass the -B $(dirname "${BASH_SOURCE[0]}")
    # but that should not be needed as we really want to delegate the linking to
    # the GNU toolchain.
    # This delegation is required because I have no idea how to persuade clang++
    # to not strip the resulting ELFs
else
    $(dirname $(readlink -f $(dirname "${BASH_SOURCE[0]}")/ld))/c++ $@
fi


gdelca5 2014-09-19 03:15

Re: C++11 toolchain for N9/N950
 
Thanks!!
now madde & clang 3.5:

Code:

#!/bin/bash

# Compiler wrapper for using clang within a cmake-based buildsystem for producing MeeGo Harmattan packages
# Written by Jan Kundrát <jkt@flaska.net> during a sleepless night
# Licensed under a three-clause BSD license
#
#
# 1) Create a new Madde target, i.e. "clang-rm680", a blank directory within ~/QtSDK/Madde/targets/
#
# 2) Set up the following directory structure:
# jkt@svist ~/QtSDK/Madde/targets/clang-rm680 $ tree
# .
# |-- bin
# |  |-- addr2line -> ../../harmattan_10.2011.34-1_rt1.2/bin/addr2line
# |  |-- ar -> ../../harmattan_10.2011.34-1_rt1.2/bin/ar
# |  |-- as -> ../../harmattan_10.2011.34-1_rt1.2/bin/as
# |  |-- c++
# |  |-- c++filt -> ../../harmattan_10.2011.34-1_rt1.2/bin/c++filt
# |  |-- cc -> ../../harmattan_10.2011.34-1_rt1.2/bin/cc
# |  |-- cpp -> ../../harmattan_10.2011.34-1_rt1.2/bin/cpp
# |  |-- g++ -> ../../harmattan_10.2011.34-1_rt1.2/bin/g++
# |  |-- gcc -> ../../harmattan_10.2011.34-1_rt1.2/bin/gcc
# |  |-- gccbug -> ../../harmattan_10.2011.34-1_rt1.2/bin/gccbug
# |  |-- gcov -> ../../harmattan_10.2011.34-1_rt1.2/bin/gcov
# |  |-- gdb -> ../../harmattan_10.2011.34-1_rt1.2/bin/gdb
# |  |-- gdbtui -> ../../harmattan_10.2011.34-1_rt1.2/bin/gdbtui
# |  |-- gprof -> ../../harmattan_10.2011.34-1_rt1.2/bin/gprof
# |  |-- ld -> ../../harmattan_10.2011.34-1_rt1.2/bin/ld
# |  |-- lrelease -> ../../harmattan_10.2011.34-1_rt1.2/bin/lrelease
# |  |-- lupdate -> ../../harmattan_10.2011.34-1_rt1.2/bin/lupdate
# |  |-- mgen -> ../../harmattan_10.2011.34-1_rt1.2/bin/mgen
# |  |-- mmoc -> ../../harmattan_10.2011.34-1_rt1.2/bin/mmoc
# |  |-- mmoc.pl -> ../../harmattan_10.2011.34-1_rt1.2/bin/mmoc.pl
# |  |-- moc -> ../../harmattan_10.2011.34-1_rt1.2/bin/moc
# |  |-- nm -> ../../harmattan_10.2011.34-1_rt1.2/bin/nm
# |  |-- objcopy -> ../../harmattan_10.2011.34-1_rt1.2/bin/objcopy
# |  |-- objdump -> ../../harmattan_10.2011.34-1_rt1.2/bin/objdump
# |  |-- qmake -> ../../harmattan_10.2011.34-1_rt1.2/bin/qmake
# |  |-- qt.conf -> ../../harmattan_10.2011.34-1_rt1.2/bin/qt.conf
# |  |-- ranlib -> ../../harmattan_10.2011.34-1_rt1.2/bin/ranlib
# |  |-- rcc -> ../../harmattan_10.2011.34-1_rt1.2/bin/rcc
# |  |-- readelf -> ../../harmattan_10.2011.34-1_rt1.2/bin/readelf
# |  |-- size -> ../../harmattan_10.2011.34-1_rt1.2/bin/size
# |  |-- strings -> ../../harmattan_10.2011.34-1_rt1.2/bin/strings
# |  |-- strip -> ../../harmattan_10.2011.34-1_rt1.2/bin/strip
# |  `-- uic -> ../../harmattan_10.2011.34-1_rt1.2/bin/uic
# |-- config.sh -> ../harmattan_10.2011.34-1_rt1.2/config.sh
# |-- information -> ../harmattan_10.2011.34-1_rt1.2/information
# |-- lib -> ../harmattan_10.2011.34-1_rt1.2/lib
# `-- specs -> ../harmattan_10.2011.34-1_rt1.2/specs
#
# 3) Put this file into the bin/c++
#
# 4) When building, use "clang-rm680" as the Madde target

# crude hack for detecting whether to forward this to GCC's c++ in case it's about linking...
echo "${@}" | grep -q -E -- '-rdynamic|-soname'
if [[ $? -eq 1 ]]; then
    # Funny fact: clang 3.3 doesn't do exceptions on ARM by default   
    # See http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-February/059015.html
    # and the rest of the thread   
    clang++ -target armv7l-linux-gnueabi -mfloat-abi=hard --sysroot=${SYSROOT_DIR} -integrated-as $@

    #-mllvm -arm-enable-ehabi -mllvm -arm-enable-ehabi-descriptors no need in 3.5.0 http://llvm.org/releases/3.5.0/docs/ReleaseNotes.html
    # resource http://clang.llvm.org/docs/CrossCompilation.html   
    # Theoretically, we could perhaps pass the -B $(dirname "${BASH_SOURCE[0]}")
    # but that should not be needed as we really want to delegate the linking to
    # the GNU toolchain.
    # This delegation is required because I have no idea how to persuade clang++
    # to not strip the resulting ELFs
else
    $(dirname $(readlink -f $(dirname "${BASH_SOURCE[0]}")/ld))/c++ $@
fi



All times are GMT. The time now is 07:17.

vBulletin® Version 3.8.8