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

Build failed on Windows when path more than MAX_PATH #711

Closed
imReker opened this issue Jun 4, 2018 · 6 comments
Closed

Build failed on Windows when path more than MAX_PATH #711

imReker opened this issue Jun 4, 2018 · 6 comments
Assignees
Milestone

Comments

@imReker
Copy link

imReker commented Jun 4, 2018

Description

Issue #478 fixed the bug of handling long path in clang, but same problem still exists in arm-linux-androideabi-ar (and maybe in other tools too).

Environment Details

[armeabi-v7a] Compile thumb  : ancillary <= fd_recv.c
[armeabi-v7a] StaticLibrary  : libancillary.a
D:/android-sdk/ndk-bundle/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ar: E:/AndroidStudioProjects/Project/Client-Android-Demo/core/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/ancillary/E_/AndroidStudioProjects/Project/Client-Android-Demo/core/src/main/jni/android/Tester/__/libancillary/__/__/depends/libancillary/fd_recv.o: No such file or directory
make: *** [E:/AndroidStudioProjects/Project/Client-Android-Demo/core/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libancillary.a] Error 1

The fd_recv.o exist in correct place, but arm-linux-androideabi-ar can't find it.

  • Pkg.Revision = 17.0.4754217
  • Build sytem: ndk-build
  • Host OS: Windows 10 64bit
  • Compiler: Clang
@enh
Copy link
Contributor

enh commented Jun 5, 2018

(not sure if pirama or chh, so adding both...)

@pirama-arumuga-nainar
Copy link
Collaborator

@imReker Did you enable long-path support? https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx. In particular:

Tip Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior.
A registry key allows you to enable or disable the new long path behavior. To enable long path behavior set the registry key at HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled (Type: REG_DWORD). The key's value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (list follows). The registry key will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value of the key, a reboot might be required because some processes may have started before the key was set.

If that doesn't help, we should attempt to fix the binutils tools to do prepend long paths with \\?\. Not sure about the scope of that fix.

I am hoping using llvm-ar will also fix this. @DanAlbert are there instructions on how to use llvm-ar in the NDK?

@imReker
Copy link
Author

imReker commented Jun 6, 2018

@pirama-arumuga-nainar I'll try enable it on my Windows 10.
But I think it won't help people who use Window 7 or 8, so the problem is still there.

@halx99
Copy link

halx99 commented Sep 14, 2018

@imReker
please see here: cocos2d/cocos2d-x#18867
and the long path support patch for ndk: https://github.com/halx99/wsLongPaths

@DanAlbert DanAlbert added this to the unplanned milestone Oct 19, 2018
@halx99
Copy link

halx99 commented Aug 12, 2020

Update: recently, I improve wsLongPaths patch and update to v3.4, now the patch support all of ndk:
support os: win7/win10
support ndk: r14b~r21d (x64)
support build system: ndk-build, cmake
https://github.com/simdsoft/wsLongPaths/releases

@DanAlbert
Copy link
Member

GNU ar is no longer used. Let us know if llvm-ar has this problem.

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

6 participants