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

Accepts escape sequence in path #1

Open
etcimon opened this issue Feb 26, 2020 · 17 comments
Open

Accepts escape sequence in path #1

etcimon opened this issue Feb 26, 2020 · 17 comments

Comments

@etcimon
Copy link

etcimon commented Feb 26, 2020

On windows, when running with the command: ./android-setup.exe C:\Users\PC\AppData\Local\Android\Sdk

This is copied to the ldc2.conf file as-is and I get errors when building:

line 54: Unexpected escape sequence: \U

@adamdruppe
Copy link
Owner

oh i probably need to .replace(\, \\) don't it.....

would you mind hand-editing the file and seeing if doubling the backslashes works?

@etcimon
Copy link
Author

etcimon commented Feb 26, 2020

The forward slash works, I noticed it also takes the path of the libs-dirs with native slash lib-dirs = [ "A:\development\d_android/runtime_droid_x86", ];

@adamdruppe
Copy link
Owner

ok i'll just replace it all with forward slashes then....

@adamdruppe
Copy link
Owner

committed

@etcimon
Copy link
Author

etcimon commented Feb 26, 2020

Everything being fixed, this is where it fails for me:

PS A:\development\memutils> dub test --arch=armv7a-none-linux-android
Failed to apply the selected architecture armv7a-none-linux-android. Got ["arm"].
Generating test runner configuration 'memutils-test-unittest' for 'unittest' (library).
Performing "unittest" build using C:\D\ldc2\bin\ldc2.exe for arm.
memutils 1.0.4: building configuration "memutils-test-unittest"...
Enhanced memory security is enabled.
Memory debugger enabled
Linking...
Error: C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/armv7a-linux-androideabi21-clang failed with status: -1
Error: message: Couldn't execute program 'C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/armv7a-linux-androideabi21-clang': Unknown error (0xC1)
C:\D\ldc2\bin\ldc2.exe failed with exit code 1.

@etcimon
Copy link
Author

etcimon commented Feb 26, 2020

I think it should be calling clang++.exe on Windows according to the cmd. files under the same path

@adamdruppe
Copy link
Owner

hmmm looks like it is ERROR_BAD_EXE_FORMAT.

does it need .exe added to the end of the config?

(tbh I did most my testing on linux since android studio kept crashing on me on windows. super surprising, usually i find stuff just works on windows and fails on linux!)

@adamdruppe
Copy link
Owner

what's the full path of your thing that runs successfully?

@etcimon
Copy link
Author

etcimon commented Feb 26, 2020

The full path would have to be C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ --target=armv7a-linux-androideabi21 but I don't know how to pass that as an -gcc= switch

@etcimon
Copy link
Author

etcimon commented Feb 26, 2020

Linking...
Error: 'C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/clang --target=armv7a-linux-androideabi21' failed with status: -1
Error: message: program not executable

@etcimon
Copy link
Author

etcimon commented Feb 26, 2020

clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/armv7a-linux-androideabi21-clang.cmd failed with status: 1
C:\D\ldc2\bin\ldc2.exe failed with exit code 1.

@adamdruppe
Copy link
Owner

argh I'll have to come back to this, I'm out of time tonight.

thanks for working with me on it though, i'm sure it is something simple here but i gotta work it again.

@etcimon
Copy link
Author

etcimon commented Feb 26, 2020

There should be some kind of -CFLAGS= argument so that -gcc can stay the path of an executable and so that I can set --target=... for it

@adamdruppe
Copy link
Owner

adamdruppe commented Feb 26, 2020

it might help to just put that ++ at the end of the -gcc=.......clang line. the docs imply that is all it needs there. just on my install both things do the same thing

But the idea of this config is that it is specialized on target already. (my original version of this broke it all out separately but the ldc team told me tis config is supposed to work more generically)

@etcimon
Copy link
Author

etcimon commented Feb 26, 2020

Using clang++.exe without a flag, I also needed to use
"-linker=C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ld.exe",`

and then I'm stuck on:

C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ld.exe: error: cannot open crt2.o: No such file or directory
C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ld.exe: error: cannot open crtbegin.o: No such file or directory
C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ld.exe: error: cannot open crtend.o: No such file or directory
C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ld.exe: internal error in find_view, at /usr/local/google/buildbot/src/android/binutils/toolchain/binutils/binutils-2.27/gold/fileread.cc:336
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Error: C:/Users/PC/AppData/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe failed with status: 1

@adamdruppe
Copy link
Owner

the -gcc option is supposed to give it a root path to find all that stuff

sorry i really do need to get to bed, but here's the doc page i was trying to follow:
https://developer.android.com/ndk/guides/other_build_systems

@adamdruppe
Copy link
Owner

Error: module d_android.hacks from file ....\AppData\Local\dub\packages\d_android-0.0.5\d_android\source\hacks.d is specified twice on the command line

annoying. but after fixing that, otherwise clean system, i am indeed able to reproduce your error.

Simply adding ".cmd" to the end of the -gcc line in the config file got it past this.

Pushed a new commit to fix the problems in android-setup.d. You'll need to grab that rebuild, delete the config it made in ldc2.conf and delete the runtime-* directories so it starts fresh. but now it works. just need to figure out why it thinks hacks is specified twice then i can tag a new version

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

2 participants