juce-framework / JUCE

JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, LV2 and AAX audio plug-ins.
https://juce.com
Other
6.63k stars 1.74k forks source link

[iOS] Undefined symbol juce_iOSMain in standalone application with only ISC licensed modules #708

Closed phniix closed 4 years ago

phniix commented 4 years ago

The Issue

Inside the ISC licensed module, juce_events, there exists inside of the file juce_ApplicationBase.cpp, an externally defined symbol for iOS, nested below an JUCE_IOS preprocessor define. This externally defined symbol is:

int juce_iOSMain (int argc, const char* argv[], void* classPtr);

see: https://github.com/juce-framework/JUCE/blob/02bbe31c0d2fb59ed32fb725b56ad25536c7ed75/modules/juce_events/messages/juce_ApplicationBase.cpp#L179

This symbol is available and defined within the GPL/Commercial licensed module, juce_gui_basics. It is defined in the file juce_ios_Windowing.mm.

see: https://github.com/juce-framework/JUCE/blob/02bbe31c0d2fb59ed32fb725b56ad25536c7ed75/modules/juce_gui_basics/native/juce_ios_Windowing.mm#L423

For users of only the ISC licensed modules, linking fails when attempting to use the ISC licensed JUCE framework components in a standalone iOS application.

The link step fails to find the symbol defined in juce_gui_basics because that module is not being included. juce_gui_basics is not an ISC licensed module, it is a GPL/Commercial licensed module.

It is my opinion, that ISC licensed modules should not have such a dependency on GPL/Commercial licensed modules. Some may conclude, this may be part of a nefarious plot to help gather more GPL/Commercial based users of the software. I just think this is an unfortunate bug.

I propose a small change to lines 178 and 236 in juce_ApplicationBase.cpp, which will serve to prevent and buffer the ISC licensed code from requiring the GPL/Commercial licensed module. It will allow standalone iOS applications to link without dramas.

Line 178: https://github.com/juce-framework/JUCE/blob/02bbe31c0d2fb59ed32fb725b56ad25536c7ed75/modules/juce_events/messages/juce_ApplicationBase.cpp#L178

Line 236: https://github.com/juce-framework/JUCE/blob/02bbe31c0d2fb59ed32fb725b56ad25536c7ed75/modules/juce_events/messages/juce_ApplicationBase.cpp#L236

Proposed solution

My proposal is for the preprocessor check on both of the above lines be modified such that:

#if JUCE_IOS && JUCE_MODULE_AVAILABLE_juce_gui_basics 

When applications make use of any of the ISC licensed code within their own standalone application structures, this undefined external symbol will not be included as it specifically also requires the existence of the appropriate module availability macro for the dependent juce_gui_basics GPL/Commercial licensed code.

JUCE issue steps

1) detailed steps on how to reproduce the bug, preferably with already existing JUCE code such as the demo plugin or the demo code

Download and unzip juce_linker_error_submission.zip

Open up and read the README.md file contained in the root of the unzipped directory.

Open the Xcode project in Xcode 11.2 +

Follow instructions in README.md file.

2) the expected behaviour

Should build and link without issues relating to unknown symbol:

int juce_iOSMain (int argc, const char* argv[], void* classPtr);

3) the operating system

iOS

4) the architecture (32-bit or 64-bit)

64-bit

5) a stack trace - if the bug causes a crash

Not a crash, but here's the output from the failed linker step:

Undefined symbols for architecture arm64:
  "juce::juce_iOSMain(int, char const**, void*)", referenced from:
      juce::JUCEApplicationBase::main(int, char const**) in include_juce_events.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

6) the plugin format (VST2, VST3, AU, AAX, RTAS) - if applicable

N/A.

7) which DAW you observed the bug in - if applicable

N/A.

Make sure you have pulled the latest commits from the develop branch of the JUCE repo and have re-compiled the Projucer before you submit your bug. Often we have already fixed the issue but it hasn't yet been released on the master branch. If it's a major bug, which must be hot-fixed immediately, then we will also accept bug reports for tagged release versions.

see juce_ApplicationBase.cpp: https://github.com/juce-framework/JUCE/blob/920f86eace90b4d49f91abe38abfe5a09a094a67/modules/juce_events/messages/juce_ApplicationBase.cpp#L178

see juce_ios_Windowing.mm: https://github.com/juce-framework/JUCE/blob/920f86eace90b4d49f91abe38abfe5a09a094a67/modules/juce_gui_basics/native/juce_ios_Windowing.mm#L423

ed95 commented 4 years ago

https://github.com/juce-framework/JUCE/pull/709