Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ldc2 1.5.0 ldc-build-runtime failed at Android-arm preset on windows #2406

Closed
lyrachord opened this issue Nov 12, 2017 · 5 comments
Closed

Comments

@lyrachord
Copy link

lyrachord commented Nov 12, 2017

Follow guides at https://wiki.dlang.org/Build_D_for_Android
cmake 3.9.6/3.10.0-rc5
NDK 16
ninja 1.8.2
ldc2 1.5.0

ldc-build-runtime --reset --ninja --targetPreset=Android-arm failed

LLVM ERROR: Cannot select: 0x1a81f10fb40: f64 = bitcast 0x1a81f10f458
0x1a81f10f458: i64 = build_pair 0x1a81f10f590, 0x1a81f10f250
0x1a81f10f590: i32,ch = CopyFromReg 0x1a81f37dfd8, Register:i32 %vreg16
0x1a81f10fce0: i32 = Register %vreg16
0x1a81f10f250: i32,ch = CopyFromReg 0x1a81f10f590:1, Register:i32 %vreg17
0x1a81f10f5f8: i32 = Register %vreg17
In function: _d_array_init_double

rem set cmake_home=D:\cmake\cmake-3.9.6-win64-x64
set cmake_home=D:\cmake\cmake-3.10.0-rc5-win64-x64
set ldc_home=D:\D2\ldc2-1.5.0-win64-msvc
set NDK=D:\android\SDK\ndk-bundle

set path=%path%;%cmake_home%\bin;%ldc_home%\bin

ldc2 --version

set CC=%NDK%\toolchains\llvm\prebuilt\windows-x86_64\bin\clang

rem --testrunners --reset 

ldc-build-runtime  --ninja --targetPreset=Android-arm
@lyrachord
Copy link
Author

try to add d-flags:

ldc-build-runtime --reset --ninja --targetPreset=Android-arm --DFlags=-float-abi=softfp

then ldc-build-runtime works fine

NOTE: -float-abi=soft not work

#1863 files
@see tests/codegen/attr_targetoptions_fp.d

+// See Github issue #1860
 +
 +// REQUIRES: atleast_llvm307
 +
 +// RUN: %ldc -c -output-ll -of=%t.ll -float-abi=soft   %s && FileCheck --check-prefix=SOFT %s < %t.ll
 +// RUN: %ldc -c -output-ll -of=%t.ll -float-abi=softfp %s && FileCheck --check-prefix=HARD %s < %t.ll
 +
 +// SOFT: define{{.*}} @{{.*}}3fooFZv{{.*}} #[[KEYVALUE:[0-9]+]]
 +// HARD: define{{.*}} @{{.*}}3fooFZv{{.*}} #[[KEYVALUE:[0-9]+]]
 +void foo()
 +{
 +}
 +
 +// SOFT: attributes #[[KEYVALUE]]
 +// SOFT-DAG: "target-features"="{{.*}}+soft-float{{.*}}"
 +// HARD: attributes #[[KEYVALUE]]
 +// HARD-NOT: "target-features"="{{.*}}+soft-float{{.*}}"

@kinke
Copy link
Member

kinke commented Nov 12, 2017

Thanks for the report. I guess -float-abi=softfp is just missing in this line; it's passed to clang for the C parts a few lines up. Pinging @joakim-noah.

@joakim-noah
Copy link
Contributor

joakim-noah commented Nov 12, 2017

I'm surprised that made the difference, what I do is add --dFlags="-w;-mcpu=cortex-a8" (or you can add cortex-a15 or whatever more specific cpu you want), which is needed for llvm 5.0. I've been lazy about updating the wiki with that, as I need to test the Android apks with it and want to rewrite some of those sections.

@joakim-noah
Copy link
Contributor

I've updated the wiki with that flag so that building the stdlib won't fail. I'll test the sample apps too and update the wiki as needed. Let me know if you have any issues after adding that flag.

@lyrachord
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants