| Summary: | Android builds fail due to -lpthread | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Anthony Pesch <inolen> |
| Component: | build | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | icculus, ivan.perez |
| Version: | HG 2.1 | Keywords: | target-2.0.6 |
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | Avoid appending -lpthread to SDL_LIBS for Android | ||
I'm using SDL for Android (and iOS) and so far I haven't had to change anything to compile it. Does this problem also happen with other NDKs? Ivan, the issue could be many things: a.) some difference in NDKs (however, it seems this has been the case since ndk r8 https://github.com/morningtec/android-ndk-r8d/blob/master/docs/system/libc/OVERVIEW.html#L102) b.) you're not compiling SDL as a static library (which is what would use the SDL_LIBS variable) c.) you are compiling SDL as a static library, but not actually relying on CMake's higher-level targets to link the library, thus SDL_LIBS is not used so on and so forth. (Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.) Tagging a bunch of bugs as target-2.0.6. This means we're in the final stretch for an official SDL 2.0.6 release! These are the bugs we really want to fix before shipping if humanly possible. That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.6 release, and generally be organized about what we're aiming to ship. After some debate, we might just remove this tag again and deal with it for a later release. Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment. Thanks! --ryan. > c.) you are compiling SDL as a static library, but not actually relying on > CMake's higher-level targets to link the library, thus SDL_LIBS is not used d.) most people aren't using the CMake projects on Android (...yet!). This patch is now https://hg.libsdl.org/SDL/rev/3d59240ebfd9, thanks! --ryan. |
Created attachment 2765 [details] Avoid appending -lpthread to SDL_LIBS for Android Android builds fail for me with: /opt/android-ndk-r15/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lpthread collect2: error: ld returned 1 exit status From googling, it appears that Android's libc has pthread support builtin, and doesn't supply an actual pthread library to link to. I've attached a patch which doesn't append -lpthread to SDL_LIBS when building for Android.