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

No libdl.a static library #472

Open
ehem opened this issue Jul 27, 2017 · 6 comments
Open

No libdl.a static library #472

ehem opened this issue Jul 27, 2017 · 6 comments
Milestone

Comments

@ehem
Copy link

ehem commented Jul 27, 2017

SSIA, there is no static version of the libdl library

This makes static builds which attempt to dynamically open other libraries impossible. Missing libz.a or libm.a could be worked around by using dlopen()/dlsym()/dlclose(), but missing libdl.a cannot be worked around (unless one is an expert with writing one's own dynamic linker).

Environment Details

  • NDK Version: 15.1.4119039
  • Build sytem: ndk-build
  • Host OS: Linux
  • Compiler: Clang
  • NDK API level: All (find ${NDK_DIR} -name libdl.a => no results)
@DanAlbert
Copy link
Member

@enh: does our libdl actually work? I know dimitry was working on it, but idk if that got finished.

@ehem: bionic didn't have a libdl.a until very recently. It looks like we do have one now, but there's still the matter that we haven't actually been able to update the static libraries in the NDK for some time. (now that libc++ is in better shape, I should be able to look at this for r16)

@enh
Copy link
Contributor

enh commented Jul 27, 2017

Android doesn't have a real libdl.a, and no one is working on it.

@DanAlbert DanAlbert added this to the unplanned milestone Jul 27, 2017
@ehem
Copy link
Author

ehem commented Jul 27, 2017

I'm unsure whether you meant Android didn't have a real libdl.a, or Android didn't have a real libdl; but for a fake library that no one is working on, libdl.so certainly seems to work pretty well. Guessing this should be straightforward once you've regained the ability to update static libraries.

@enh
Copy link
Contributor

enh commented Jul 27, 2017

no, there's no libdl.a, only libdl.so, and libdl.so is a special case that's intercepted by the dynamic linker. a libdl.a would be a ton of work, and isn't likely to happen any time soon.

@ehem
Copy link
Author

ehem commented Jul 28, 2017

Are you sure about "libdl.so is a special case that's intercepted by the dynamic linker"?

I was under the impression it was a genuine library handling all of the dlopen()/dlsym()/dlclose() functionality internally. dlopen() more or less being an open(, O_RDONLY), followed by a mmap(,, PROT_EXEC|PROT_READ,,,0), then a bit of library initialization and setup a data structures to make dlsym()'s job faster.

One simple refutation is, why is libdl.so present on all the Android devices I have at hand if it wasn't needed at runtime? Sure, the space savings from removing one small shared object isn't huge, but I'd someone to have purged an unnecessary extra library if they could...

For the heck of it, ls -lL /usr/lib/x86_64-linux-gnu/libdl.*

-rw-r--r-- 1 root root 13050 Jun 21 23:35 /usr/lib/x86_64-linux-gnu/libdl.a
-rw-r--r-- 1 root root 14664 Jun 21 23:35 /usr/lib/x86_64-linux-gnu/libdl.so

At that size it can't be all that much work.

@enh
Copy link
Contributor

enh commented Jul 28, 2017

the source is in bionic/libdl/ if you'd care to look. the code that does the real work is all in bionic/linker/ instead.

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