-
Notifications
You must be signed in to change notification settings - Fork 258
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
[BUG] ld.lld.exe: error: zlib is not available #888
Comments
@stephenhines I don't see a libz.dll anywhere in the toolchain prebuilts. Is this something you want to statically link? |
No, there is no any place where I try to link |
If I'm not mistaken the error here is that lld itself depends on libz. That's true of the binaries I have on Linux, but the typical linux system has libz so that isn't a problem. I think this is just a dependency that needed to be shipped but wasn't. |
I've added a KI to the changelog, FWIW. Linux is better tested, and Darwin should work (I'll verify once I have a mac in front of me, but we are using it to build AOSP from Darwin; we just don't build AOSP from Windows so that is only covered by the NDK, and apparently inadequately so). As much as I don't really want to double our test time, I'll get our test runner to build and run every test twice (once with the default linker and once with lld) for better coverage. |
This may only be broken if you are linking something that has compressed sections. It is very likely that libsamba.so is doing that. In that case, the Decompressor in LLVM doesn't know how to unzip it. We're talking about how to build libz.dll even, since it is not provided by our build at all. |
My Linux lld is linked directly to libz. Is windows using it via dlopen? |
The libLLVMSupport library implements and exports zlib compression functionality. If libz is detected at build time, the library builds/links against it (which is the case in Linux). If libz is not detected, the library has stubs that always return false or throw an error (which is the case in our build of Windows). This surfaces to the user only if a functionality that requires libz is requested - in this case the ability to read compressed sections in DWARF (lib/DebugInfo/DWARF/DWARFContext.cpp). |
Ah, I did wonder about that custom-looking error message... That explains it. |
Ah, so this is something that only comes up when that feature is encountered then. That's much better than I'd feared. I'm going to redo some Windows LLD testing (that is, run our test suite with LLD forced) just in case, but assuming that comes back fine I'll tone down the wording of the KI in the changelog. |
Ok, is there any fix for now or I need to wait for the next version of the NDK? |
To use compressed symbols with LLD yes, you'll need an update. You might be able to avoid the compressed symbols. Not sure if there's an easy way to tell where they're coming from. Presumably readelf, but I'm not sure what to look for. |
Ok, thanks! I'll disable LLD for now. |
@pirama-arumuga-nainar says he's going to be looking in to this soon. |
No, the same error |
I had similar. Try this: |
This is not working on Windows |
I just merged https://android-review.googlesource.com/q/topic:%22windows-clang-libz%22+(status:open%20OR%20status:merged). This will be part of an AOSP Clang toolchain soon but no idea which NDK release it'll be part of. |
It'll most likely be r20. It's a non-trivial update from what's currently in r19 so that could be quite disruptive. |
I have recompiled NDK r19 with this patch and now there is no any |
Ok, I found the root cause of hang - it is LLD multithread. It is the same problem as this issue. After I set |
Filed #897 to fix the defaults that we control and mark the KI, since that probably deserves a better callout than a bug report most people won't see. |
Test: None Bug: android/ndk#888 Change-Id: Ib45af91458e3334afb4180731f869d7698d7f6e4
Seems this issue is still present in R20?
As a side note the ARM v8 .so when linked via lld have nearly doubled size Is this a known/documented issue or should I open a new one? |
(i can't answer the "is the new lld in r20?" question, so someone else will have to address that...) |
Ok so I must admit I'm not a master at all at NDK build chain and adding a space after the comma in the Android.mk generated the issue. With --gc-sections the .so is still way bigger But in all cases without Windows support can't use in release build for now. |
try https://github.com/google/bloaty to see what the differences are? (or just readelf as a quick first pass if you've only got one .so.) |
Don't have a linux machine nearby, since it seems not known / wanted, will look into that tool and make proper report in the next couple of weeks. Anything else I should prepare for that report? |
The toolchain that is in r20 came from about a week before the fix was merged. The fix is in r21. |
@Tolriq as for the size issue, I assume by armv8 you mean arm64? If so, that's probably fixed by https://reviews.llvm.org/D55029, which is also too old for r20 but is in r21. Try the canary build if you want to be sure. |
Thanks @DanAlbert tested last canary 5641003 and can confirm both issues are fixed. |
@Tolriq thanks for confirming! |
* Update ndk from branch 'ndk-release-r19' to dd1888c38d8824cbca4f5cd3bb83a6d94ee7beee - Merge changes I82b47e65,Ib45af914 into ndk-release-r19 * changes: Tone down the lld KI in the r19 changelog. Mark KI for Windows LLD. - Tone down the lld KI in the r19 changelog. The LLD bug here is an extreme edge case, so clarify that this should otherwise be fine for Windows. Test: None Bug: None Change-Id: I82b47e65ca1af9524325426d1de1aa5483664d40 - Mark KI for Windows LLD. Test: None Bug: android/ndk#888 Change-Id: Ib45af91458e3334afb4180731f869d7698d7f6e4
Description
NDK changelog is asking for people to start testing with LLD, but I can not compile my modules after this change (using LLD).
What I was done:
libsamba.so
) that I am linking into my libset(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
If I'm not using
-fuse-ld=lld
- everything worksEnvironment Details
Android Studio 3.3
NDK r19
Windows 10
The text was updated successfully, but these errors were encountered: