[LLVM/CLANG] DragonTC ~ The future is now

Search This thread

rpdroky

Senior Member
Nov 13, 2014
713
1,683
Hy @frap129 , i found something that may help against the compiling errors , the google arm_linux_androideabi toolchain cyanogenmod uses doesn't support the -O3 flag you used on dragontc.mk and they create compilation errors even if you include the file in the DISABLE_DTC_arm , so in my point of view the options are 1 we use custom androideabi toolchain with -O3 support like hypertoolchain ( i'm using a older sabermod 4.9 tc for my i9300 compilation because the newer ones crash the camera opening ) or 2 changeing the -O3 flag in dragontc to -O2 til google decide to add -O3 support to theyr toolchain

I may be wrong but this is how my test gone :)

Cheers :highfive:

P.S. When you have the time could you update the prebuilt toolchains? i whould deeply apriciate it :)
 

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,126
Hy @frap129 , i found something that may help against the compiling errors , the google ndroideabi toolchain toolchain cyanogenmod uses doesn't support the -O3 flag you used on dragontc.mk and they create compilation errors even if you include the file in the DISABLE_DTC_arm , so in my point of view the options are 1 we use custom androideabi toolchain with -O3 support like hypertoolchain ( i'm using a older sabermod 4.9 tc for my i9300 compilation because the newer ones crash the camera opening ) or 2 changeing the -O3 flag in dragontc to -O2 til google decide to add -O3 support to theyr toolchain

I may be wrong but this is how my test gone :)

Cheers :highfive:

P.S. When you have the time could you update the prebuilt toolchains? i whould deeply apriciate it :)
A few things.
1) DragonTC and dragontc.mk don't affect arm-linux-androideabi or any other GCC based toolchain. DragonTC is LLVM/Clang ONLY.
2) Polly is only enabled at the -O3 level, so by removing -O3 from dragontc.mk you disable Polly, so there's no point in using DragonTC
 
  • Like
Reactions: rpdroky and spezi77

rpdroky

Senior Member
Nov 13, 2014
713
1,683
A few things.
1) DragonTC and dragontc.mk don't affect arm-linux-androideabi or any other GCC based toolchain. DragonTC is LLVM/Clang ONLY.
2) Polly is only enabled at the -O3 level, so by removing -O3 from dragontc.mk you disable Polly, so there's no point in using DragonTC

I guess i need to do more tests then , thanks allot for the quick replay ;)

Cheers :highfive:
 

rpdroky

Senior Member
Nov 13, 2014
713
1,683
Well i did a new build only with dragontc and this time it worked , i guess there was a sync error with the androideabi and that's why i had those errors :) Thanks again ;)

Cheers :highfive:
 

laperry1

Senior Member
hey guys, running into the following error compiling CM-13.0 for OP3 on LinuxMint-18-sarah kde...
using Clang ver. 3.7....

any help would be greatly appreciated!!!

Code:
target arm C++: libGLESv2_32 <= frameworks/native/opengl/libs/GLES2/gl2.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/Input.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/InputDevice.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/Keyboard.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/KeyCharacterMap.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/KeyLayoutMap.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/VirtualKeyMap.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/IInputFlinger.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/InputTransport.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/VelocityControl.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/VelocityTracker.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/EventHub.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputApplication.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputDispatcher.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputListener.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputManager.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputReader.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputWindow.cpp
target asm: libcrypto_32 <= external/boringssl/linux-arm/crypto/aes/aes-armv4.S
target asm: libcrypto_32 <= external/boringssl/linux-arm/crypto/aes/aesv8-armx.S
clang: error: the clang compiler does not support '-march=armv8-a+crypto'
build/core/binary.mk:886: recipe for target '/home/samadhi/cm13/out/target/product/oneplus3/obj_arm/SHARED_LIBRARIES/libcrypto_intermediates/linux-arm/crypto/aes/aes-armv4.o' failed
make: *** [/home/samadhi/cm13/out/target/product/oneplus3/obj_arm/SHARED_LIBRARIES/libcrypto_intermediates/linux-arm/crypto/aes/aes-armv4.o] Error 1
make: *** Waiting for unfinished jobs....
clang: error: the clang compiler does not support '-march=armv8-a+crypto'
build/core/binary.mk:886: recipe for target '/home/samadhi/cm13/out/target/product/oneplus3/obj_arm/SHARED_LIBRARIES/libcrypto_intermediates/linux-arm/crypto/aes/aesv8-armx.o' failed
make: *** [/home/samadhi/cm13/out/target/product/oneplus3/obj_arm/SHARED_LIBRARIES/libcrypto_intermediates/linux-arm/crypto/aes/aesv8-armx.o] Error 1
make: *** wait: No child processes.  Stop.

#### make failed to build some targets (18:04 (mm:ss)) ####
 

Surge1223

Recognized Contributor
Nov 6, 2012
2,622
7,466
Florida
Google Pixel 6 Pro
hey guys, running into the following error compiling CM-13.0 for OP3 on LinuxMint-18-sarah kde...
using Clang ver. 3.7....

any help would be greatly appreciated!!!

Code:
target arm C++: libGLESv2_32 <= frameworks/native/opengl/libs/GLES2/gl2.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/Input.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/InputDevice.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/Keyboard.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/KeyCharacterMap.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/KeyLayoutMap.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/VirtualKeyMap.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/IInputFlinger.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/InputTransport.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/VelocityControl.cpp
target thumb C++: libinput_32 <= frameworks/native/libs/input/VelocityTracker.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/EventHub.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputApplication.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputDispatcher.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputListener.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputManager.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputReader.cpp
target thumb C++: libinputflinger_32 <= frameworks/native/services/inputflinger/InputWindow.cpp
target asm: libcrypto_32 <= external/boringssl/linux-arm/crypto/aes/aes-armv4.S
target asm: libcrypto_32 <= external/boringssl/linux-arm/crypto/aes/aesv8-armx.S
clang: error: the clang compiler does not support '-march=armv8-a+crypto'
build/core/binary.mk:886: recipe for target '/home/samadhi/cm13/out/target/product/oneplus3/obj_arm/SHARED_LIBRARIES/libcrypto_intermediates/linux-arm/crypto/aes/aes-armv4.o' failed
make: *** [/home/samadhi/cm13/out/target/product/oneplus3/obj_arm/SHARED_LIBRARIES/libcrypto_intermediates/linux-arm/crypto/aes/aes-armv4.o] Error 1
make: *** Waiting for unfinished jobs....
clang: error: the clang compiler does not support '-march=armv8-a+crypto'
build/core/binary.mk:886: recipe for target '/home/samadhi/cm13/out/target/product/oneplus3/obj_arm/SHARED_LIBRARIES/libcrypto_intermediates/linux-arm/crypto/aes/aesv8-armx.o' failed
make: *** [/home/samadhi/cm13/out/target/product/oneplus3/obj_arm/SHARED_LIBRARIES/libcrypto_intermediates/linux-arm/crypto/aes/aesv8-armx.o] Error 1
make: *** wait: No child processes.  Stop.

#### make failed to build some targets (18:04 (mm:ss)) ####
Did you read the Android.mk file in external/openssl or external/boringssl? I haven't made the switch to clang yet but just from reading the Android.mk in the crypto dirs and from reading the build/core/combo Android.mk file for clang and what flags need to be set etc I'm going to guess it's only one a few things compiler flags withstanding

Might be able to help, but first, What have you tried so far?

Sent from my Nexus 6P using XDA-Developers mobile app
 
  • Like
Reactions: laperry1

laperry1

Senior Member
Did you read the Android.mk file in external/openssl or external/boringssl? I haven't made the switch to clang yet but just from reading the Android.mk in the crypto dirs and from reading the build/core/combo Android.mk file for clang and what flags need to be set etc I'm going to guess it's only one a few things compiler flags withstanding

Might be able to help, but first, What have you tried so far?

Sent from my Nexus 6P using XDA-Developers mobile app

hey, thanks for your response! just added the following to dragontc.mk:

DISABLE_DTC_arm := v8_mksnapshot.arm64 v8_mksnapshot.arm
DISABLE_DTC_arm64 := v8_mksnapshot.arm64 v8_mksnapshot.arm libm libblasV8 libperfprofdcore libperfprofdutils perfprofd libjavacrypto libscrypt_static libcrypto

...got past the previous error, now dealing w/Polly conflicts so, i guess i'll be adding a bunch of modules to DISABLE_POLLY...
 

laperry1

Senior Member
anyone run into the following:

external/p7zip/CPP/Windows/ErrorMsg.cpp:24:10: error: case value evaluates to -2147024809, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
case E_INVALIDARG : txt = "E_INVALIDARG"; break ;
^
external/p7zip/CPP/Common/MyWindows.h:89:22: note: expanded from macro 'E_INVALIDARG'
#define E_INVALIDARG ((HRESULT)0x80070057L)
^
external/p7zip/CPP/Windows/ErrorMsg.cpp:23:10: error: case value evaluates to -2147024882, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
case E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ;
^
external/p7zip/CPP/Common/MyWindows.h:88:23: note: expanded from macro 'E_OUTOFMEMORY'
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
^
external/p7zip/CPP/Windows/ErrorMsg.cpp:22:10: error: case value evaluates to -2147287039, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
^
external/p7zip/CPP/Common/MyWindows.h:87:31: note: expanded from macro 'STG_E_INVALIDFUNCTION'
#define STG_E_INVALIDFUNCTION ((HRESULT)0x80030001L)
^
external/p7zip/CPP/Windows/ErrorMsg.cpp:21:10: error: case value evaluates to -2147467259, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
case E_FAIL : txt = "E_FAIL"; break ;
^
external/p7zip/CPP/Common/MyWindows.h:86:16: note: expanded from macro 'E_FAIL'
#define E_FAIL ((HRESULT)0x80004005L)
^
external/p7zip/CPP/Windows/ErrorMsg.cpp:20:10: error: case value evaluates to -2147467260, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
case E_ABORT : txt = "E_ABORT"; break ;
^
external/p7zip/CPP/Common/MyWindows.h:85:17: note: expanded from macro 'E_ABORT'
#define E_ABORT ((HRESULT)0x80004004L)
^
external/p7zip/CPP/Windows/ErrorMsg.cpp:19:10: error: case value evaluates to -2147467262, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
case E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
^
external/p7zip/CPP/Common/MyWindows.h:84:23: note: expanded from macro 'E_NOINTERFACE'
#define E_NOINTERFACE ((HRESULT)0x80004002L)
^
external/p7zip/CPP/Windows/ErrorMsg.cpp:18:10: error: case value evaluates to -2147467263, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
case E_NOTIMPL : txt = "E_NOTIMPL"; break ;
^
external/p7zip/CPP/Common/MyWindows.h:83:19: note: expanded from macro 'E_NOTIMPL'
#define E_NOTIMPL ((HRESULT)0x80004001L)
^
7 errors generated.
build/core/binary.mk:735: recipe for target '/home/samadhi/cm13/out/target/product/oneplus3/obj/EXECUTABLES/7z_intermediates/CPP/Windows/ErrorMsg.o' failed
make: *** [/home/samadhi/cm13/out/target/product/oneplus3/obj/EXECUTABLES/7z_intermediates/CPP/Windows/ErrorMsg.o] Error 1
make: *** Waiting for unfinished jobs....
target C++: 7z make: *** wait: No child processes. Stop.

#### make failed to build some targets (01:01:00 (hh:mm:ss)) ####
 

HaoZeke

Senior Member
Aug 16, 2009
860
655
Kanpur
rgoswami.me
Redmi Note 10 Pro
Prebuilts are arch independent. Clang uses one prebuilt for all architectures
That sounds reasonable but the aosp build keeps looking for a lib64 folder which is missing in the prebuilts but is there in the stock clang

---------- Post added at 11:33 PM ---------- Previous post was at 11:33 PM ----------

Prebuilts are arch independent. Clang uses one prebuilt for all architectures
Plus there's also the matter of a different sanitizer
 

Top Liked Posts

  • There are no posts matching your filters.
  • 51
    gFcFcZ7.png

    DragonTC is a build system for compiling custom clang toolchains. These toolchains contain some AOSP patches(where applicable) and things not included in AOSP clang, such as LTO and Gold plugins, and OpenMP, Polly compiled and automatically linked into tools, improved krait optimizations (-mcpu=krait2), and annoying flags such as -Werror, -Wfatal-errors, and -Weverything internally disabled for non-default parameters. DragonTC compilers are also built with -O3, -pthread, and -fopenmp in order to reduce compile time when used for ROMs. DragonTC has been around for a few months now, but now that some testers have helped me work out the bugs and make it close to stable, I've decided to make an XDA thread.

    Why use custom Clang?
    Google has been slowly moving away from GCC for a while now, so we believe that we should get ahead of the toolchain game and start now! Furthermore, AOSP modules that are compiled with clang can easily be optimized with the new LTO and Polly options.

    How do I build DragonTC?
    It's simple! Run the following commands in bash to get set up:
    Code:
    $ mkdir dtc
    $ cd dtc
    $ repo init -u https://github.com/dragon-tc/DragonTC -b master
    $ repo sync -j(# of cores) -c -f

    For Debian and Ubuntu:
    Code:
    sudo aptitude install build-essential git git-svn bc binfmt-support libllvm-3.6-ocaml-dev llvm-3.6 llvm-3.6-dev llvm-3.6-runtime cmake automake autogen autoconf autotools-dev libtool shtool python m4 gcc libtool zlib1g-dev

    And run the following to build your desired toolchain:
    Code:
    $ cd build
    $ ./version
    Where "version" is 3.6. 3.7, 3.8, or 3.9.

    To optimize the toolchain for your local system, run with the 'opt' argument. Example:
    Code:
    $ ./3.7 opt

    How do use DragonTC in AOSP?
    • Either clone a prebuilt or build your own toolchain and place it in prebuilts/clang/linux-x86/host/your_version (3.7 is the prefered version)
    • Change the version in build/core/clang/config.mk to reflect the directory you placed it in.
    • Either clone ours, or cherry-pick our changes to prebuilts/ndk and frameworks/rs.
    • Cherry-pick our DragonTC support commit in build.
    • Edit build/core/clang/config.mk and set "TARGET_DRAGONTC_VERSION := " to the name of the folder you placed the toolchain in (your_version is the example used above)

    How can I fix module issues when compiling with Polly?
    It's simple. Just take the module name (ex. "target C++: module_name_here <= some/path/to/code") and add it to the DISABLE_POLLY list. You can also disable Clang all together, use AOSP clang, or force GCC modules to use Clang.

    Why call it DragonTC?
    The LLVM logo/mascot is a dragon, so in homage to the developers of LLVM and Clang, I used DragonTC as the name.

    Credits
    A huge thanks to all of the people who helped:
    xboxfanj for recreating the Snapdragon Compiler optimizations
    xanaxdroid for maintenance, bug fixes, and testing
    The LLVM developers for the great work and continuous improvement
    All of the great devs/rom builders that helped test
    and anyone that I missed!

    XDA:DevDB Information
    DragonTC, Tool/Utility for the Android General

    Contributors
    frap129, xanaxdroid
    Source Code: https://github.com/dragon-tc


    Version Information
    Status: Beta

    Created 2016-02-19
    Last Updated 2016-05-21
    6
    This sounds interesting. Thanks for sharing your work. I might try it, but as a bloody beginner, can you maybe give a bit more detail on how it affects building / the result?

    Once I get a bit more time, I'll edit the op to have more information. In short, Clang is a compiler (like GCC) that is rapidly growing. Google is currently using Clang 3.6 which produces binaries that perform slower than GCC compiled binaries, but they choose to use Clang because it takes less time to compile overall. DragonTC allows you to use the latest Clang toolchains (3.6, 3.7, 3.8, or 3.9) with extra functionality that Google doesn't have, such as LTO, Polly, OpenMP, and Snapdragon Krait optimizations. These make your rom (or anything you compile with it) perform better than if you were to use the stock AOSP clang.