Incompatible implicit declaration of a built-in function Warning Using NDK with LAME

I am trying to follow the guide located in the following place

http://developer.samsung.com/android/technical-docs/Porting-and-using-LAME-MP3-on-Android-with-JNI

The bottom line is that it allows you to use a LAME MP3 encoder with JNI.

I followed each of the steps mentioned in the lesson. My project is in

C:\workspace\ 

and is called 'LAME_Test'. In the section labeled Compiling with NDK in the tutorial, I went ahead and made a make file called "Android.mk" as indicated below this post.

I am running Windows 7 on a 64 bit machine. I have Cygwin and NDK, and I tested that my setup is working on another project I'm working on. However, when I go to

 /cygdrive/c/workspace/LAME_Test/jni 

in cygwin and run the following command

  /cygdrive/c/Android/android-ndk-r8b/ndk-build 

considering the NDK is in

 C:\Android\android-ndk-r8b 

compilation gives a bunch of warnings like these

 warning: incompatible implicit declaration of built-in function 'memset' [enabled by default] 

I am including a small piece of warnings at the bottom of this post (because the list of warnings is really large and can just add clutter rather than add a value).

I wonder if there is a way to resolve these warnings and get a good, clean compiler.

PS: I will add that I was able to build + run a sample project from the link above (LAME4Android). This required the compilation of native code. So it looks like the project is really building, despite all the warnings. Initially, I thought this was broken due to warnings. However, it would be really great if there was some way to fix the warnings.

Android.mk file contents

 LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libmp3lame LOCAL_SRC_FILES := \ ./libmp3lame/bitstream.c \ ./libmp3lame/encoder.c \ ./libmp3lame/fft.c \ ./libmp3lame/gain_analysis.c \ ./libmp3lame/id3tag.c \ ./libmp3lame/lame.c \ ./libmp3lame/mpglib_interface.c \ ./libmp3lame/newmdct.c \ ./libmp3lame/presets.c \ ./libmp3lame/psymodel.c \ ./libmp3lame/quantize.c \ ./libmp3lame/quantize_pvt.c \ ./libmp3lame/reservoir.c \ ./libmp3lame/set_get.c \ ./libmp3lame/tables.c \ ./libmp3lame/takehiro.c \ ./libmp3lame/util.c \ ./libmp3lame/vbrquantize.c \ ./libmp3lame/VbrTag.c \ ./libmp3lame/version.c LOCAL_LDLIBS := -llog include $(BUILD_SHARED_LIBRARY) 

Incompatible Implicit Declaration of Built-in Function Alerts Log

 $ /cygdrive/c/Android/android-ndk-r8b/ndk-build Cygwin : Generating dependency file converter script Compile thumb : mp3lame <= bitstream.c Compile thumb : mp3lame <= encoder.c C:/workspace/LAME_Test/jni/./libmp3lame/encoder.c: In function 'lame_encode_frame_init': C:/workspace/LAME_Test/jni/./libmp3lame/encoder.c:202:9: warning: incompatible implicit declaration of built-in function 'memset' [enabled by default] C:/workspace/LAME_Test/jni/./libmp3lame/encoder.c: In function 'lame_encode_mp3_frame': C:/workspace/LAME_Test/jni/./libmp3lame/encoder.c:471:17: warning: incompatible implicit declaration of built-in function 'bcopy' [enabled by default] Compile thumb : mp3lame <= fft.c Compile thumb : mp3lame <= gain_analysis.c and so on... 
+4
source share
1 answer

After a long search, it looks like the answer I was looking for was found here.

Compiling Lame MP3 Encoder for Android

The key for me was to add the following line to my Android.mk file

 LOCAL_CFLAGS = -DSTDC_HEADERS 

as James Zhang mentioned.

I am enclosing my complete makefile under this post, so I am saying quite clearly.

The contents of the updated Android.mk file

 LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libmp3lame LOCAL_SRC_FILES := \ ./libmp3lame/bitstream.c \ ./libmp3lame/encoder.c \ ./libmp3lame/fft.c \ ./libmp3lame/gain_analysis.c \ ./libmp3lame/id3tag.c \ ./libmp3lame/lame.c \ ./libmp3lame/mpglib_interface.c \ ./libmp3lame/newmdct.c \ ./libmp3lame/presets.c \ ./libmp3lame/psymodel.c \ ./libmp3lame/quantize.c \ ./libmp3lame/quantize_pvt.c \ ./libmp3lame/reservoir.c \ ./libmp3lame/set_get.c \ ./libmp3lame/tables.c \ ./libmp3lame/takehiro.c \ ./libmp3lame/util.c \ ./libmp3lame/vbrquantize.c \ ./libmp3lame/VbrTag.c \ ./libmp3lame/version.c LOCAL_LDLIBS := -llog LOCAL_CFLAGS = -DSTDC_HEADERS include $(BUILD_SHARED_LIBRARY) 
+10
source

Source: https://habr.com/ru/post/1444996/


All Articles