Problem compiling Juce for Android on Linux


#1

I have created a project that compiles and runs as expected on Windows 8, using Visual Studio 2013. The project is using DocumentWindow for window handling and each window has one view that inherits Component and OpenGLRenderer so that each window has its own OpenGL context.

Now, I want to compile the project for Android on Linux (Ubuntu 14.04, VirtualBox) with the latest NDK (r10d). Compiling the "Demo" project works fine. When compiling my project, however, I get the following errors:

[armebi] Compile++ thumb: juce_jni <= QAWindow.cpp
[armebi] Compile++ thumb: juce_jni <= QAHandler.cpp
[armebi] Compile++ thumb: juce_jni <= QAResultBuilder.cpp
[armebi] Compile++ thumb: juce_jni <= QAView.cpp
[armebi] Compile++ thumb: juce_jni <= Main.cpp
[armebi] Compile++ thumb: juce_jni <= juce_core.cpp
[armebi] Compile++ thumb: juce_jni <= juce_cryptography.cpp
[armebi] Compile++ thumb: juce_jni <= juce_data_structures.cpp
[armebi] Compile++ thumb: juce_jni <= juce_events.cpp
In file included from jni/../../../JuceModules/modules/juce_events/../juce_core/system/juce_StandardHeader.h:53:0,
                 from jni/../../../JuceModules/modules/juce_events/../juce_core/juce_core.h:143,
                 from jni/../../../JuceModules/modules/juce_events/juce_events.h:29,
                 from jni/../../../JuceModules/modules/juce_events/juce_events.cpp:39:
<command-line>:0:41: error: expected initializer before '-' token
jni/../../../JuceModules/modules/juce_events/../juce_core/system/juce_PlatformDefs.h:213:39: note: in definition of macro 'JUCE_JOIN_MACRO_HELPER'
  #define JUCE_JOIN_MACRO_HELPER(a, b) a ## b
                                       ^
jni/../../../JuceModules/modules/juce_events/../juce_core/native/juce_android_JNIHelpers.h:231:65: note: in expansion of macro 'JUCE_JOIN_MACRO'
   extern "C" __attribute__ ((visibility("default"))) returnType JUCE_JOIN_MACRO (JUCE_JOIN_MACRO (Java_, className), _ ## methodName) params
                                                                 ^
jni/../../../JuceModules/modules/juce_events/../juce_core/system/juce_PlatformDefs.h:221:40: note: in expansion of macro 'JUCE_JOIN_MACRO_HELPER'
 #define JUCE_JOIN_MACRO(item1, item2)  JUCE_JOIN_MACRO_HELPER (item1, item2)
                                        ^
jni/../../../JuceModules/modules/juce_events/../juce_core/native/juce_android_JNIHelpers.h:231:82: note: in expansion of macro 'JUCE_JOIN_MACRO'
   extern "C" __attribute__ ((visibility("default"))) returnType JUCE_JOIN_MACRO (JUCE_JOIN_MACRO (Java_, className), _ ## methodName) params
                                                                                  ^
jni/../../../JuceModules/modules/juce_events/native/juce_android_Messaging.cpp:45:1: note: in expansion of macro 'JUCE_JNI_CALLBACK'
 JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, deliverMessage, void, (JNIEnv* env, jobject activity, jlong value))
 ^
jni/../../../JuceModules/modules/juce_events/native/juce_android_Messaging.cpp:45:20: note: in expansion of macro 'JUCE_ANDROID_ACTIVITY_CLASSNAME'
 JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, deliverMessage, void, (JNIEnv* env, jobject activity, jlong value))
                    ^
jni/../../../JuceModules/modules/juce_events/juce_events.cpp:103:1: error: expected '}' at end of input
 }

I am not sure why this error occurs, so any hints are appreciated. As far as I can tell, the "##" is used to concatenate values during compile time and the error for JUCE_JOIN_MACRO_HELPER triggers the three following errors. I am not using Doxygen for anything. It also seems that the three last errors are triggered from something else.

Since the "Demo" project compiles fine, I would guess that the issue may be in my code, but it seems from the above that my part of the code compiles fine. I have not set any extra compiler flags except the includes.

What could be the problem here? Here is the Android.mk for reference:


# Automatically generated makefile, created by the Introjucer
# Don't edit this file! Your changes will be overwritten when you re-save the Introjucer project!

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
    LOCAL_ARM_MODE := arm
endif

LOCAL_MODULE := juce_jni
LOCAL_SRC_FILES := \
  ../../../Source/QAWindow.cpp\
  ../../../Source/QACase.cpp\
  ../../../Source/QAHandler.cpp\
  ../../../Source/QAResultBuilder.cpp\
  ../../../Source/QAView.cpp\
  ../../../Source/Main.cpp\
  ../../../JuceModules/modules/juce_core/juce_core.cpp\
  ../../../JuceModules/modules/juce_cryptography/juce_cryptography.cpp\
  ../../../JuceModules/modules/juce_data_structures/juce_data_structures.cpp\
  ../../../JuceModules/modules/juce_events/juce_events.cpp\
  ../../../JuceModules/modules/juce_graphics/juce_graphics.cpp\
  ../../../JuceModules/modules/juce_gui_basics/juce_gui_basics.cpp\
  ../../../JuceModules/modules/juce_gui_extra/juce_gui_extra.cpp\
  ../../../JuceModules/modules/juce_opengl/juce_opengl.cpp\
  ../../../JuceModules/modules/juce_video/juce_video.cpp\

ifeq ($(NDK_DEBUG),1)
  LOCAL_CPPFLAGS += -fsigned-char -fexceptions -frtti -g -I "../../JuceLibraryCode" -I "../../JuceModules/modules" -I "../../../../SDK/include" -I "../../../../mMap3D" -O0 -std=c++11 -std=gnu++11 -D "JUCE_ANDROID=1" -D "JUCE_ANDROID_API_VERSION=8" -D "JUCE_ANDROID_ACTIVITY_CLASSNAME=com_myvr-software_mqatool_mQATool" -D JUCE_ANDROID_ACTIVITY_CLASSPATH=\"com/myvr-software/mqatool/mQATool\" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_ANDROID_7F0E4A25=1" -D "JUCE_APP_VERSION=1.0.0" -D "JUCE_APP_VERSION_HEX=0x10000" -I "../../../../modules/juce_gui_basics" -I "../../../../modules/juce_gui_extras -I "../../../../modules/juce_opengl" -I "../../../../modules/juce_video" -I "../../../../modules/juce_graphics" -I "../../../../modules/juce_events" -I "../../../../modules/juce_data_structures" -I "../../../../modules/juce_cryptography" -I "../../../../modules/juce_core"
  LOCAL_LDLIBS := -L../../../../Build -llog -lGLESv2
  LOCAL_CFLAGS += -fsigned-char -fexceptions -frtti -g -I "../../JuceLibraryCode" -I "../../JuceModules/modules" -I "../../../../SDK/include" -I "../../../../mMap3D" -O0 -std=c++11 -std=gnu++11 -D "JUCE_ANDROID=1" -D "JUCE_ANDROID_API_VERSION=8" -D "JUCE_ANDROID_ACTIVITY_CLASSNAME=com_myvr-software_mqatool_mQATool" -D JUCE_ANDROID_ACTIVITY_CLASSPATH=\"com/myvr-software/mqatool/mQATool\" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_ANDROID_7F0E4A25=1" -D "JUCE_APP_VERSION=1.0.0" -D "JUCE_APP_VERSION_HEX=0x10000" -I "../../../../modules/juce_gui_basics" -I "../../../../modules/juce_gui_extras -I "../../../../modules/juce_opengl" -I "../../../../modules/juce_video" -I "../../../../modules/juce_graphics" -I "../../../../modules/juce_events" -I "../../../../modules/juce_data_structures" -I "../../../../modules/juce_cryptography" -I "../../../../modules/juce_core"
  LOCAL_LDLIBS := -L../../../../Build -llog -lGLESv2
else
  LOCAL_CPPFLAGS += -fsigned-char -fexceptions -frtti -I "../../JuceLibraryCode" -I "../../JuceModules/modules" -I "../../../../SDK/include" -I "../../../../mMap3D" -Os -std=c++11 -std=gnu++11 -D "JUCE_ANDROID=1" -D "JUCE_ANDROID_API_VERSION=8" -D "JUCE_ANDROID_ACTIVITY_CLASSNAME=com_myvr-software_mqatool_mQATool" -D JUCE_ANDROID_ACTIVITY_CLASSPATH=\"com/myvr-software/mqatool/mQATool\" -D "NDEBUG=1" -D "JUCER_ANDROID_7F0E4A25=1" -D "JUCE_APP_VERSION=1.0.0" -D "JUCE_APP_VERSION_HEX=0x10000" -I "../../../../modules/juce_gui_basics" -I "../../../../modules/juce_gui_extras -I "../../../../modules/juce_opengl" -I "../../../../modules/juce_video" -I "../../../../modules/juce_graphics" -I "../../../../modules/juce_events" -I "../../../../modules/juce_data_structures" -I "../../../../modules/juce_cryptography" -I "../../../../modules/juce_core"
  LOCAL_LDLIBS := -L../../../../Build -llog -lGLESv2
  LOCAL_CFLAGS += -fsigned-char -fexceptions -frtti -I "../../JuceLibraryCode" -I "../../JuceModules/modules" -I "../../../../SDK/include" -I "../../../../mMap3D" -Os -std=c++11 -std=gnu++11 -D "JUCE_ANDROID=1" -D "JUCE_ANDROID_API_VERSION=8" -D "JUCE_ANDROID_ACTIVITY_CLASSNAME=com_myvr-software_mqatool_mQATool" -D JUCE_ANDROID_ACTIVITY_CLASSPATH=\"com/myvr-software/mqatool/mQATool\" -D "NDEBUG=1" -D "JUCER_ANDROID_7F0E4A25=1" -D "JUCE_APP_VERSION=1.0.0" -D "JUCE_APP_VERSION_HEX=0x10000" -I "../../../../modules/juce_gui_basics" -I "../../../../modules/juce_gui_extras -I "../../../../modules/juce_opengl" -I "../../../../modules/juce_video" -I "../../../../modules/juce_graphics" -I "../../../../modules/juce_events" -I "../../../../modules/juce_data_structures" -I "../../../../modules/juce_cryptography" -I "../../../../modules/juce_core"
  LOCAL_LDLIBS := -L../../../../Build -llog -lGLESv2
endif

include $(BUILD_SHARED_LIBRARY)

#2

The only thing I can think is that maybe you've got a macro somewhere that's defining a token which is being used in this code?


#3

It doesn't seem like there are any tokens that are used in both my code and Juce - at least I could not find any. I started out with a clean Juce project and added my files step by step. There were some errors in the process, but seemingly unrelated to the ones above. The new project compiles now, so I am not really sure what the problem is/was. I still cannot get the old one to compile, even though the settings and the make files looks to be identical.

I will post any updates if I figure something out.