skip to Main Content

I’m trying to develop with the new Telegram source code, but when debugging, I got this error. I have put API, Hockey API, and have tried by following https://stackoverflow.com/a/34323758/7531970, but I am not finding any luck. Please help. Thank You

Information:Gradle tasks [:TMessagesProj:assembleArmv7Debug]
Information:(Unknown) In file included
Information:(Unknown)
Information:(Unknown)
Error:error: redefinition of 'struct r_debug'
Information:(Unknown) In file included
Error:error: redefinition of 'struct link_map'
Error:error: redefinition of 'struct r_debug'
Error:error: redefinition of 'struct link_map'
E:ANDROIDPROJECTSAndroidAndroidSDKndk-bundlesysrootusrincludelink.h
Error:(77, 8) error: previous definition of 'struct r_debug'
Error:(68, 8) error: previous definition of 'struct link_map'
Error:(77, 8) error: previous definition of 'struct r_debug'
Error:(68, 8) error: previous definition of 'struct link_map'
Information:BUILD FAILED
Information:Total time: 4 mins 43.334 secs
Information:8 errors
Information:0 warnings
Information:See complete output in console

Console Output

In file included from ./jni/breakpad/client/linux/minidump_writer/linux_dumper.h:43:0,
from ./jni/breakpad/client/linux/minidump_writer/minidump_writer.h:41,
from E:/Telegram/TMessagesProj/jni/./breakpad/client/linux/handler/exception_handler.h:42,
from E:/Telegram/TMessagesProj/jni/./NativeLoader.cpp:3:
./jni/breakpad/common/android/include/link.h:46:8: error: redefinition of 'struct r_debug'
struct r_debug {
^
In file included from ./jni/breakpad/common/android/include/link.h:35:0,
from ./jni/breakpad/client/linux/minidump_writer/linux_dumper.h:43,
from ./jni/breakpad/client/linux/minidump_writer/minidump_writer.h:41,
from E:/Telegram/TMessagesProj/jni/./breakpad/client/linux/handler/exception_handler.h:42,
from E:/Telegram/TMessagesProj/jni/./NativeLoader.cpp:3:
e:androidprojectsandroidandroidsdkndk-bundlesysrootusrincludelink.h:77:8: error: previous definition of 'struct r_debug'
struct r_debug {
^
In file included from ./jni/breakpad/client/linux/minidump_writer/linux_dumper.h:43:0,
from ./jni/breakpad/client/linux/minidump_writer/minidump_writer.h:41,
from E:/Telegram/TMessagesProj/jni/./breakpad/client/linux/handler/exception_handler.h:42,
from E:/Telegram/TMessagesProj/jni/./NativeLoader.cpp:3:
./jni/breakpad/common/android/include/link.h:57:8: error: redefinition of 'struct link_map'
struct link_map {
^
In file included from ./jni/breakpad/common/android/include/link.h:35:0,
from ./jni/breakpad/client/linux/minidump_writer/linux_dumper.h:43,
from ./jni/breakpad/client/linux/minidump_writer/minidump_writer.h:41,
from E:/Telegram/TMessagesProj/jni/./breakpad/client/linux/handler/exception_handler.h:42,
from E:/Telegram/TMessagesProj/jni/./NativeLoader.cpp:3:
e:androidprojectsandroidandroidsdkndk-bundlesysrootusrincludelink.h:68:8: error: previous definition of 'struct link_map'
struct link_map {
^
make: *** [E:/Telegram/TMessagesProj/build/intermediates/ndkBuild/armv7/debug/obj/local/armeabi-v7a/objs-debug/tmessages.26/./NativeLoader.o] Error 1
:TMessagesProj:externalNativeBuildArmv7Debug FAILED

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':TMessagesProj:externalNativeBuildArmv7Debug'.
Build command failed.
Error while executing process E:ANDROIDPROJECTSAndroidAndroidSDKndk-bundlendk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=E:TelegramTMessagesProjjniAndroid.mk NDK_APPLICATION_MK=E:TelegramTMessagesProjjniApplication.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-14 NDK_OUT=E:/Telegram/TMessagesProj/build/intermediates/ndkBuild/armv7/debug/obj NDK_LIBS_OUT=E:TelegramTMessagesProjbuildintermediatesndkBuildarmv7debuglib NDK_APPLICATION_MK:=jni/Application.mk APP_PLATFORM:=android-14 E:/Telegram/TMessagesProj/build/intermediates/ndkBuild/armv7/debug/obj/local/armeabi-v7a/libtmessages.26.so}
[armeabi-v7a] Compile arm : tmessages.26 <= opus.c
[armeabi-v7a] Compile arm : tmessages.26 <= opus_decoder.c
[armeabi-v7a] Compile arm : tmessages.26 <= opus_encoder.c
[armeabi-v7a] Compile arm : tmessages.26 <= opus_multistream.c
[armeabi-v7a] Compile arm : tmessages.26 <= opus_multistream_encoder.c
[armeabi-v7a] Compile arm : tmessages.26 <= opus_multistream_decoder.c
[armeabi-v7a] Compile arm : tmessages.26 <= repacketizer.c
[armeabi-v7a] Compile arm : tmessages.26 <= analysis.c
[armeabi-v7a] Compile arm : tmessages.26 <= mlp.c
[armeabi-v7a] Compile arm : tmessages.26 <= mlp_data.c
[armeabi-v7a] Compile arm : tmessages.26 <= CNG.c
[armeabi-v7a] Compile arm : tmessages.26 <= code_signs.c
[armeabi-v7a] Compile arm : tmessages.26 <= init_decoder.c
[armeabi-v7a] Compile arm : tmessages.26 <= decode_core.c
[armeabi-v7a] Compile arm : tmessages.26 <= decode_frame.c
[armeabi-v7a] Compile arm : tmessages.26 <= decode_parameters.c
[armeabi-v7a] Compile arm : tmessages.26 <= decode_indices.c
[armeabi-v7a] Compile arm : tmessages.26 <= decode_pulses.c
[armeabi-v7a] Compile arm : tmessages.26 <= decoder_set_fs.c
[armeabi-v7a] Compile arm : tmessages.26 <= dec_API.c
[armeabi-v7a] Compile arm : tmessages.26 <= enc_API.c
[armeabi-v7a] Compile arm : tmessages.26 <= encode_indices.c
[armeabi-v7a] Compile arm : tmessages.26 <= encode_pulses.c
[armeabi-v7a] Compile arm : tmessages.26 <= gain_quant.c
[armeabi-v7a] Compile arm : tmessages.26 <= interpolate.c
[armeabi-v7a] Compile arm : tmessages.26 <= LP_variable_cutoff.c
[armeabi-v7a] Compile arm : tmessages.26 <= NLSF_decode.c
[armeabi-v7a] Compile arm : tmessages.26 <= NSQ.c
[armeabi-v7a] Compile arm : tmessages.26 <= NSQ_del_dec.c
[armeabi-v7a] Compile arm : tmessages.26 <= PLC.c
[armeabi-v7a] Compile arm : tmessages.26 <= shell_coder.c
[armeabi-v7a] Compile arm : tmessages.26 <= tables_gain.c
[armeabi-v7a] Compile arm : tmessages.26 <= tables_LTP.c
[armeabi-v7a] Compile arm : tmessages.26 <= tables_NLSF_CB_NB_MB.c
[armeabi-v7a] Compile arm : tmessages.26 <= tables_NLSF_CB_WB.c
[armeabi-v7a] Compile arm : tmessages.26 <= tables_other.c
[armeabi-v7a] Compile arm : tmessages.26 <= tables_pitch_lag.c
[armeabi-v7a] Compile arm : tmessages.26 <= tables_pulses_per_block.c
[armeabi-v7a] Compile arm : tmessages.26 <= VAD.c
[armeabi-v7a] Compile arm : tmessages.26 <= control_audio_bandwidth.c
[armeabi-v7a] Compile arm : tmessages.26 <= quant_LTP_gains.c
[armeabi-v7a] Compile arm : tmessages.26 <= VQ_WMat_EC.c
[armeabi-v7a] Compile arm : tmessages.26 <= HP_variable_cutoff.c
[armeabi-v7a] Compile arm : tmessages.26 <= NLSF_encode.c
[armeabi-v7a] Compile arm : tmessages.26 <= NLSF_VQ.c
[armeabi-v7a] Compile arm : tmessages.26 <= NLSF_unpack.c
[armeabi-v7a] Compile arm : tmessages.26 <= NLSF_del_dec_quant.c
[armeabi-v7a] Compile arm : tmessages.26 <= process_NLSFs.c
[armeabi-v7a] Compile arm : tmessages.26 <= stereo_LR_to_MS.c
[armeabi-v7a] Compile arm : tmessages.26 <= stereo_MS_to_LR.c
[armeabi-v7a] Compile arm : tmessages.26 <= check_control_input.c
[armeabi-v7a] Compile arm : tmessages.26 <= control_SNR.c
[armeabi-v7a] Compile arm : tmessages.26 <= init_encoder.c
[armeabi-v7a] Compile arm : tmessages.26 <= control_codec.c
[armeabi-v7a] Compile arm : tmessages.26 <= A2NLSF.c
[armeabi-v7a] Compile arm : tmessages.26 <= ana_filt_bank_1.c
[armeabi-v7a] Compile arm : tmessages.26 <= biquad_alt.c
[armeabi-v7a] Compile arm : tmessages.26 <= bwexpander_32.c
[armeabi-v7a] Compile arm : tmessages.26 <= bwexpander.c
[armeabi-v7a] Compile arm : tmessages.26 <= debug.c
[armeabi-v7a] Compile arm : tmessages.26 <= decode_pitch.c
[armeabi-v7a] Compile arm : tmessages.26 <= inner_prod_aligned.c
[armeabi-v7a] Compile arm : tmessages.26 <= lin2log.c
[armeabi-v7a] Compile arm : tmessages.26 <= log2lin.c
[armeabi-v7a] Compile arm : tmessages.26 <= LPC_analysis_filter.c
[armeabi-v7a] Compile arm : tmessages.26 <= LPC_inv_pred_gain.c
[armeabi-v7a] Compile arm : tmessages.26 <= table_LSF_cos.c
[armeabi-v7a] Compile arm : tmessages.26 <= NLSF2A.c
[armeabi-v7a] Compile arm : tmessages.26 <= NLSF_stabilize.c
[armeabi-v7a] Compile arm : tmessages.26 <= NLSF_VQ_weights_laroia.c
[armeabi-v7a] Compile arm : tmessages.26 <= pitch_est_tables.c
[armeabi-v7a] Compile arm : tmessages.26 <= resampler.c
[armeabi-v7a] Compile arm : tmessages.26 <= resampler_down2_3.c
[armeabi-v7a] Compile arm : tmessages.26 <= resampler_down2.c
[armeabi-v7a] Compile arm : tmessages.26 <= resampler_private_AR2.c
[armeabi-v7a] Compile arm : tmessages.26 <= resampler_private_down_FIR.c
[armeabi-v7a] Compile arm : tmessages.26 <= resampler_private_IIR_FIR.c
[armeabi-v7a] Compile arm : tmessages.26 <= resampler_private_up2_HQ.c
[armeabi-v7a] Compile arm : tmessages.26 <= resampler_rom.c
[armeabi-v7a] Compile arm : tmessages.26 <= sigm_Q15.c
[armeabi-v7a] Compile arm : tmessages.26 <= sort.c
[armeabi-v7a] Compile arm : tmessages.26 <= sum_sqr_shift.c
[armeabi-v7a] Compile arm : tmessages.26 <= stereo_decode_pred.c
[armeabi-v7a] Compile arm : tmessages.26 <= stereo_encode_pred.c
[armeabi-v7a] Compile arm : tmessages.26 <= stereo_find_predictor.c
[armeabi-v7a] Compile arm : tmessages.26 <= stereo_quant_pred.c
[armeabi-v7a] Compile arm : tmessages.26 <= LPC_fit.c
[armeabi-v7a] Compile arm : tmessages.26 <= LTP_analysis_filter_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= LTP_scale_ctrl_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= corrMatrix_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= encode_frame_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= find_LPC_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= find_LTP_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= find_pitch_lags_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= find_pred_coefs_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= noise_shape_analysis_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= process_gains_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= regularize_correlations_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= residual_energy16_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= residual_energy_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= warped_autocorrelation_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= apply_sine_window_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= autocorr_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= burg_modified_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= k2a_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= k2a_Q16_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= pitch_analysis_core_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= vector_ops_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= schur64_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= schur_FIX.c
[armeabi-v7a] Compile arm : tmessages.26 <= bands.c
[armeabi-v7a] Compile arm : tmessages.26 <= celt.c
[armeabi-v7a] Compile arm : tmessages.26 <= celt_encoder.c
[armeabi-v7a] Compile arm : tmessages.26 <= celt_decoder.c
[armeabi-v7a] Compile arm : tmessages.26 <= cwrs.c
[armeabi-v7a] Compile arm : tmessages.26 <= entcode.c
[armeabi-v7a] Compile arm : tmessages.26 <= entdec.c
[armeabi-v7a] Compile arm : tmessages.26 <= entenc.c
[armeabi-v7a] Compile arm : tmessages.26 <= kiss_fft.c
[armeabi-v7a] Compile arm : tmessages.26 <= laplace.c
[armeabi-v7a] Compile arm : tmessages.26 <= mathops.c
[armeabi-v7a] Compile arm : tmessages.26 <= mdct.c
[armeabi-v7a] Compile arm : tmessages.26 <= modes.c
[armeabi-v7a] Compile arm : tmessages.26 <= pitch.c
[armeabi-v7a] Compile arm : tmessages.26 <= celt_lpc.c
[armeabi-v7a] Compile arm : tmessages.26 <= quant_bands.c
[armeabi-v7a] Compile arm : tmessages.26 <= rate.c
[armeabi-v7a] Compile arm : tmessages.26 <= vq.c
[armeabi-v7a] Compile arm : tmessages.26 <= armcpu.c
[armeabi-v7a] Compile arm : tmessages.26 <= arm_celt_map.c
[armeabi-v7a] Compile arm : tmessages.26 <= bitwise.c
[armeabi-v7a] Compile arm : tmessages.26 <= framing.c
[armeabi-v7a] Compile arm : tmessages.26 <= info.c
[armeabi-v7a] Compile arm : tmessages.26 <= internal.c
[armeabi-v7a] Compile arm : tmessages.26 <= opusfile.c
[armeabi-v7a] Compile arm : tmessages.26 <= stream.c
[armeabi-v7a] Compile++ arm : tmessages.26 <= compare_common.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= compare_gcc.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= compare_neon64.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= compare_win.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= compare.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= convert_argb.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= convert_from_argb.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= convert_from.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= convert_jpeg.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= convert_to_argb.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= convert_to_i420.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= convert.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= cpu_id.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= mjpeg_decoder.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= mjpeg_validate.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= planar_functions.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= rotate_any.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= rotate_argb.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= rotate_common.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= rotate_gcc.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= rotate_mips.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= rotate_neon64.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= rotate_win.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= rotate.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= row_any.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= row_common.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= row_gcc.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= row_mips.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= row_neon64.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= row_win.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= scale_any.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= scale_argb.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= scale_common.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= scale_gcc.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= scale_mips.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= scale_neon64.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= scale_win.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= scale.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= video_common.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= compare_neon.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= rotate_neon.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= row_neon.cc
[armeabi-v7a] Compile++ arm : tmessages.26 <= scale_neon.cc
[armeabi-v7a] Compile arm : tmessages.26 <= jni.c
[armeabi-v7a] Compile arm : tmessages.26 <= audio.c
[armeabi-v7a] Compile arm : tmessages.26 <= utils.c
[armeabi-v7a] Compile arm : tmessages.26 <= image.c
[armeabi-v7a] Compile arm : tmessages.26 <= video.c
[armeabi-v7a] Compile++ arm : tmessages.26 <= gifvideo.cpp
[armeabi-v7a] Compile++ arm : tmessages.26 <= SqliteWrapper.cpp
[armeabi-v7a] Compile++ arm : tmessages.26 <= TgNetWrapper.cpp
[armeabi-v7a] Compile++ arm : tmessages.26 <= NativeLoader.cpp
In file included from ./jni/breakpad/client/linux/minidump_writer/linux_dumper.h:43:0,
from ./jni/breakpad/client/linux/minidump_writer/minidump_writer.h:41,
from E:/Telegram/TMessagesProj/jni/./breakpad/client/linux/handler/exception_handler.h:42,
from E:/Telegram/TMessagesProj/jni/./NativeLoader.cpp:3:
./jni/breakpad/common/android/include/link.h:46:8: error: redefinition of 'struct r_debug'
struct r_debug {
^
In file included from ./jni/breakpad/common/android/include/link.h:35:0,
from ./jni/breakpad/client/linux/minidump_writer/linux_dumper.h:43,
from ./jni/breakpad/client/linux/minidump_writer/minidump_writer.h:41,
from E:/Telegram/TMessagesProj/jni/./breakpad/client/linux/handler/exception_handler.h:42,
from E:/Telegram/TMessagesProj/jni/./NativeLoader.cpp:3:
e:androidprojectsandroidandroidsdkndk-bundlesysrootusrincludelink.h:77:8: error: previous definition of 'struct r_debug'
struct r_debug {
^
In file included from ./jni/breakpad/client/linux/minidump_writer/linux_dumper.h:43:0,
from ./jni/breakpad/client/linux/minidump_writer/minidump_writer.h:41,
from E:/Telegram/TMessagesProj/jni/./breakpad/client/linux/handler/exception_handler.h:42,
from E:/Telegram/TMessagesProj/jni/./NativeLoader.cpp:3:
./jni/breakpad/common/android/include/link.h:57:8: error: redefinition of 'struct link_map'
struct link_map {
^
In file included from ./jni/breakpad/common/android/include/link.h:35:0,
from ./jni/breakpad/client/linux/minidump_writer/linux_dumper.h:43,
from ./jni/breakpad/client/linux/minidump_writer/minidump_writer.h:41,
from E:/Telegram/TMessagesProj/jni/./breakpad/client/linux/handler/exception_handler.h:42,
from E:/Telegram/TMessagesProj/jni/./NativeLoader.cpp:3:
e:androidprojectsandroidandroidsdkndk-bundlesysrootusrincludelink.h:68:8: error: previous definition of 'struct link_map'
struct link_map {
^
make: *** [E:/Telegram/TMessagesProj/build/intermediates/ndkBuild/armv7/debug/obj/local/armeabi-v7a/objs-debug/tmessages.26/./NativeLoader.o] Error 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

2

Answers


  1. the problem comes from redefinition of 'struct'
    try to change NDK version to r14b

    go to NDK Archives and download the r14b version then extract it,

    go to file> Project Structure> SDK location > android NDK location 
    

    and change it to the ndk-bundle folder you downloaded

    Login or Signup to reply.
  2. It seems you have multiple includes (link.h in at least two places; and linux_dumper.h) trying to define structs that are already defined.

    If you’re okay with modifying the code, I recommend you try adding #ifndef guards around r_debug and link_map struct definitions. Like so:

    #ifndef R_DEBUG
    #define R_DEBUG
      struct r_debug {
        ...
      }
    #endif
    
    #ifndef LINK_MAP
    #define LINK_MAP
      struct link_map {
        ...
      }
    #endif
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search