We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2586

Summary: SDL update hg:8820(0e935d5b193a) triggers -Wformat-security warning, breaking Android build
Product: SDL_image Reporter: roaldfernandez
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: blocker    
Priority: P2    
Version: unspecified   
Hardware: x86_64   
OS: Android (All)   

Description roaldfernandez 2014-06-15 11:01:03 UTC
SDL update hg:8820(0e935d5b193a) triggers -Wformat-security warning in the SDL_image usage of SDL_SetError. This breaks the android NDK build, as it has a default -Werror=format-security flag set.

The default -Werror=format-security is set by [ANDROID-NDK]/build/core/build-binary.mk

A possible solution is disabling this -Werror flag, by setting LOCAL_DISABLE_FORMAT_STRING_CHECKS=true in a the SDL_image/Android.mk file.

This affects SDL_image, SDL_ttf.

This does not affect SDL, SDL_mixer and SDL_net, as they use SDL_SetError in a way that lets the compiler inspect the passed string content, avoiding this warning.

PS: I'll post a duplicate bug report to SDL_ttf, as this breaks both builds.

Cheers,
Roald Fernandez

Change-diff of fix:
diff -r 175c0200df0a Android.mk
--- a/Android.mk	Sun May 11 11:21:10 2014 -0400
+++ b/Android.mk	Sun Jun 15 12:55:51 2014 +0200
@@ -126,4 +126,6 @@
 
 LOCAL_EXPORT_C_INCLUDES += $(LOCAL_C_INCLUDES)
 
+LOCAL_DISABLE_FORMAT_STRING_CHECKS=true
+
 include $(BUILD_SHARED_LIBRARY)
Comment 1 Sam Lantinga 2014-06-15 20:17:55 UTC
I fixed the code that was triggering the warnings.  Thanks!
https://hg.libsdl.org/SDL_image/rev/48116d511e5d