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

NDK 19 - libdl.a dlopen() returns nullptr but dlerror() doesn't have an error #965

Closed
H-G-Hristov opened this issue Apr 22, 2019 · 5 comments
Assignees
Labels

Comments

@H-G-Hristov
Copy link

H-G-Hristov commented Apr 22, 2019

Under what circumstances dlopen() will return nullptr and dlerror() will also return nullptr?

I try to run an SDL2 project, which SDLActivity loads the .so files but due to lack of any errors I am unable to guess what might be wrong.

(That bug label may be inappropriate.)

@enh
Copy link
Contributor

enh commented Apr 22, 2019

Under what circumstances dlopen() will return nullptr and dlerror() will also return nullptr?

if you have a static binary that's using libdl.a (which is a stub) rather than libdl.so.

that's an interesting point though --- we might want to make dlerror() return an error like "libdl.a is a stub".

your specific SDL2 issue is probably related to #929 (which is basically "why am i getting libdl.a instead of libdl.so?").

@enh enh self-assigned this Apr 22, 2019
@enh enh changed the title NDK 19 - dlopen() returns nullptr NDK 19 - libdl.a dlopen() returns nullptr but dlerror() doesn't have an error Apr 22, 2019
@Zingam
Copy link

Zingam commented Apr 22, 2019

Maybe it is just me but "libdl.a is a stub" will be still confusing. Is a more explicit error message possible?

@enh
Copy link
Contributor

enh commented Apr 22, 2019

i went with "libdl.a is a stub --- use libdl.so instead" in https://android-review.googlesource.com/c/platform/bionic/+/948879.

@Zingam
Copy link

Zingam commented Apr 22, 2019

That's better. May I suggest to also add "the linked library" in there?

@enh
Copy link
Contributor

enh commented Apr 22, 2019

where?

@enh enh closed this as completed Apr 23, 2019
rajadeja pushed a commit to PotatoProject-next/bionic that referenced this issue Sep 4, 2019
Seems only logical, given that all the other calls fail.

(Only thing that's weird about this is that calling dlerror() usually
clears the error until you do something else that causes an error, but
that doesn't seem worth the bookkeeping?)

Bug: android/ndk#965
Test: static unit tests still pass
Change-Id: I5e5401e148c5857f1dbab9c5a7f4a6fc43d8d626
sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this issue Apr 22, 2024
Seems only logical, given that all the other calls fail.

(Only thing that's weird about this is that calling dlerror() usually
clears the error until you do something else that causes an error, but
that doesn't seem worth the bookkeeping?)

Bug: android/ndk#965
Test: static unit tests still pass
Change-Id: I5e5401e148c5857f1dbab9c5a7f4a6fc43d8d626
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants