Open Barabas5532 opened 1 year ago
This seems to be breaking the build in example/app
as well.
I get a linker error again, and the build commands show that JUCE_USE_CURL=0
is not used when building juce_core.cpp, but it is used for some other files.
: && /usr/bin/c++ source/cpp/CMakeFiles/focusrite-e2e-tests.dir/tests/main.cpp.o source/cpp/CMakeFiles/focusrite-e2e-tests.dir/tests/TestCommand.cpp.o source/cpp/CMakeFiles/focusrite-e2e-tests.dir/tests/TestComponentSearch.cpp.o source/cpp/CMakeFiles/focusrite-e2e-tests.dir/tests/TestResponse.cpp.o source/cpp/CMakeFiles/focusrite-e2e-tests.dir/__/__/_deps/juce-src/modules/juce_core/juce_core.cpp.o source/cpp/CMakeFiles/focusrite-e2e-tests.dir/__/__/_deps/juce-src/modules/juce_events/juce_events.cpp.o source/cpp/CMakeFiles/focusrite-e2e-tests.dir/__/__/_deps/juce-src/modules/juce_gui_basics/juce_gui_basics.cpp.o source/cpp/CMakeFiles/focusrite-e2e-tests.dir/__/__/_deps/juce-src/modules/juce_graphics/juce_graphics.cpp.o source/cpp/CMakeFiles/focusrite-e2e-tests.dir/__/__/_deps/juce-src/modules/juce_data_structures/juce_data_structures.cpp.o -o source/cpp/focusrite-e2e-tests source/cpp/libfocusrite-e2e.a /usr/lib/libfreetype.so -lrt -ldl -lpthread && :
/usr/bin/ld: source/cpp/CMakeFiles/focusrite-e2e-tests.dir/__/__/_deps/juce-src/modules/juce_core/juce_core.cpp.o: in function `juce::CURLSymbols::create()':
juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x37): undefined reference to `curl_easy_init'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x4d): undefined reference to `curl_easy_setopt'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x64): undefined reference to `curl_easy_cleanup'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x7b): undefined reference to `curl_easy_getinfo'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x92): undefined reference to `curl_multi_add_handle'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0xa9): undefined reference to `curl_multi_cleanup'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0xc0): undefined reference to `curl_multi_fdset'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0xd7): undefined reference to `curl_multi_info_read'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0xee): undefined reference to `curl_multi_init'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x105): undefined reference to `curl_multi_perform'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x11c): undefined reference to `curl_multi_remove_handle'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x133): undefined reference to `curl_multi_timeout'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x14a): undefined reference to `curl_slist_append'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x161): undefined reference to `curl_slist_free_all'
/usr/bin/ld: juce_core.cpp:(.text._ZN4juce11CURLSymbols6createEv[_ZN4juce11CURLSymbols6createEv]+0x178): undefined reference to `curl_version_info'
collect2: error: ld returned 1 exit status
[29/29] : && /usr/bin/c++ example/app/CMakeFiles/e2e-example-app.dir/source/Main.cpp.o example/app/CMakeFiles/e2e-example-app.dir/__/__/_deps/juce-src/modules/juce_gui_extra/juce_gui_extra.cpp.o example/app/CMakeFiles/e2e-example-app.dir/__/__/_deps/juce-src/modules/juce_gui_basics/juce_gui_basics.cpp.o example/app/CMakeFiles/e2e-example-app.dir/__/__/_deps/juce-src/modules/juce_graphics/juce_graphics.cpp.o example/app/CMakeFiles/e2e-example-app.dir/__/__/_deps/juce-src/modules/juce_events/juce_events.cpp.o example/app/CMakeFiles/e2e-example-app.dir/__/__/_deps/juce-src/modules/juce_core/juce_core.cpp.o example/app/CMakeFiles/e2e-example-app.dir/__/__/_deps/juce-src/modules/juce_data_structures/juce_data_structures.cpp.o -o example/app/e2e-example-app_artefacts/e2e-example-app source/cpp/libfocusrite-e2e.a /usr/lib/libfreetype.so -lrt -ldl -lpthread && :
ninja: build stopped: subcommand failed.
Describe the bug
Doing a basic debug build causes a linker error:
JUCE explains why this appears:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Build completes without error.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Compare these invocations from the same build in my project:
First one is building a file in this library, the second is building the generated Main.cpp file for my project. There are many extra JUCE compile flags on the second invocation, and we can also see the
_DEBUG
, which is directly responsible for the failing linker.There are a few topics on the JUCE forum discussing similar use cases: https://forum.juce.com/t/how-to-create-a-static-library-that-use-juce-in-official-cmake/50080/3. Generally the advice seems to be that the same JUCE flags are required everywhere where a JUCE header gets included.
As far as I understand, the current build setup in this library has a chance to produce errors (linker, compiler or possibly UB) depending on the JUCE flags set by the user project. To fix this, there needs to be a way for the user project to supply the correct JUCE flags to this library. Possibly instead of linking directly to the JUCE modules in https://github.com/FocusriteGroup/juce-end-to-end/blob/51c5200d254df42ab912eb7d3c87ff5c0fcb6d94/source/cpp/CMakeLists.txt#L24-L43, it should link to a user defined target that can have the correct flags.