Tonecarver / tcRackModules

GNU General Public License v3.0
13 stars 1 forks source link

v1.0.3: Build error on macOS platform #5

Closed cschol closed 2 years ago

cschol commented 2 years ago

Build error during integration for version 1.0.3.

x86_64-apple-darwin17-clang++-libc++  -std=c++11 -stdlib=libc++   -fPIC -I/home/build/rack-plugin-toolchain/Rack-SDK/include -I/home/build/rack-plugin-toolchain/Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_MAC -mmacosx-version-min=10.7  -c -o build/src/Blur.cpp.o src/Blur.cpp
In file included from src/Traveler.cpp:9:
src/../lib/ThreadSafeList.hpp:32:43: error: no matching constructor for initialization of 'const std::lock_guard<std::mutex>'
        const std::lock_guard<std::mutex> lock(list_mutex);
                                          ^    ~~~~~~~~~~
/home/build/rack-plugin-toolchain/local/osxcross/bin/../SDK/MacOSX10.13.sdk/usr/include/c++/v1/__mutex_base:103:14: note: candidate constructor not viable: 1st argument ('const std::mutex') would lose const qualifier
    explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
             ^
/home/build/rack-plugin-toolchain/local/osxcross/bin/../SDK/MacOSX10.13.sdk/usr/include/c++/v1/__mutex_base:112:5: note: candidate constructor not viable: no known conversion from 'const std::mutex' to 'const std::__1::lock_guard<std::__1::mutex>' for 1st argument
    lock_guard(lock_guard const&) _LIBCPP_EQUAL_DELETE;
    ^
/home/build/rack-plugin-toolchain/local/osxcross/bin/../SDK/MacOSX10.13.sdk/usr/include/c++/v1/__mutex_base:106:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
    lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
    ^
1 error generated.
make[2]: *** [/home/build/rack-plugin-toolchain/Rack-SDK/compile.mk:69: build/src/Traveler.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Tonecarver commented 2 years ago

Removed 'const' qualifier pushed v1.0.4 commit 6bcf9e00637ba26e7db3de22a9ec51294973c8d8 (HEAD -> v1, origin/v1) Author: Bill Davies bdavies00@yahoo.com Date: Sat Nov 13 10:01:09 2021 -0700

cschol commented 2 years ago

Still does not compile.

See here for one way to fix: https://stackoverflow.com/a/68624340

Adding mutable keyword to the mutex resolves the compile error.

Tonecarver commented 2 years ago

Excellent, thank you. Added mutable keyword to the mutex declaration.

commit cf05802dae8681e380778ca528f76a1291247fb7 (HEAD -> v1, origin/v1) Author: Bill Davies bdavies00@yahoo.com Date: Sat Nov 13 12:26:59 2021 -0700

ThreadSafeList declare mutex mutable