musikcube icon indicating copy to clipboard operation
musikcube copied to clipboard

Build failure on macOS (w/o homebrew)

Open rnkn opened this issue 2 years ago • 15 comments

Hello! Thanks for making Musikcube, I can't wait to try it out but unfortunately I'm hitting a building failure on macOS 11.4.

Specifically it seems that the CMake ensure_library_exists function is not picking up the installed libev:

$ pkg_info -L libev
Information for libev-4.33:

Files:
/opt/pkg/include/ev/ev++.h
/opt/pkg/include/ev/ev.h
/opt/pkg/include/ev/event.h
/opt/pkg/lib/ev/libev.la
/opt/pkg/lib/ev/libev.4.dylib
/opt/pkg/lib/ev/libev.a
/opt/pkg/lib/ev/libev.dylib
/opt/pkg/share/man/man3/ev.3.gz

Here's the CMake failure message:

$ cmake .
-- resolved BSD_PATH_PREFIX to: ''
-- [check-dependencies] curl found at /opt/pkg/lib/libcurl.dylib
-- [check-dependencies] pthread found at /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libpthread.tbd
-- [check-dependencies] ssl found at /opt/pkg/lib/libssl.dylib
-- [check-dependencies] crypto found at /opt/pkg/lib/libcrypto.dylib
-- [check-dependencies] z found at /opt/pkg/lib/libz.dylib
-- [build] ENABLE_BUNDLED_TAGLIB not defined, setting to 'true'
-- [build] link libraries are: /opt/pkg/lib/libboost_system.dylib;/opt/pkg/lib/libboost_filesystem.dylib;/opt/pkg/lib/libboost_thread.dylib;/opt/pkg/lib/libboost_chrono.dylib;/opt/pkg/lib/libboost_date_time.dylib;/opt/pkg/lib/libboost_atomic.dylib;curl;pthread;ssl;crypto;dl
CMake Error at .cmake/CheckDependencies.cmake:16 (message):




  [check-dependencies] ev not found



Call Stack (most recent call first):
  src/musikcubed/CMakeLists.txt:5 (ensure_library_exists)


-- Configuring incomplete, errors occurred!
See also "/Users/pwr/Developer/musikcube/CMakeFiles/CMakeOutput.log".
See also "/Users/pwr/Developer/musikcube/CMakeFiles/CMakeError.log".

And ./CMakeFiles/CMakeError.log:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /Library/Developer/CommandLineTools/usr/bin/cc 
Build flags: 
Id flags:  

The output was:
1
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas? I think it's just a case of supplying the appropriate CXXFLAGS or LDFLAGS but I'm sorry to say I'm not terribly familiar with CMake...

rnkn avatar Jul 13 '21 07:07 rnkn

I assume you're trying to install via homebrew? If so, this has been fixed, I just need to release a new version.

clangen avatar Jul 13 '21 23:07 clangen

I've used pkgsrc to install the dependencies (no stinkin' homebrew for me) then trying to build musikcube from master.

I noticed that CMakeLists.txt section "custom include/library directories for BSDs" has a hardcoded rule to use homebrew so I tried removing that to just keep BSD_PATH_PREFIX as "/usr/local" but got the same result.

rnkn avatar Jul 14 '21 03:07 rnkn

Neat, I wasn't aware of pkgsrc. Unfortunately, that clearly mean it isn't currently supported. :)

What if you set BSD_PATH_PREFIX to /opt/pkg?

clangen avatar Jul 14 '21 03:07 clangen

Progress! I needed to rewrite CMakeLists.txt a bit:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c69e19b..7f4326c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,22 +38,27 @@ link_directories ("${musikcube_SOURCE_DIR}/bin/plugins")
 
 # custom include/library directories for BSDs
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
-  set(BSD_PATH_PREFIX "/usr/local")
-  if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
-    execute_process(
-      COMMAND brew config
-      COMMAND grep -i HOMEBREW_PREFIX
-      COMMAND awk "{print $2}"
-      OUTPUT_STRIP_TRAILING_WHITESPACE
-      OUTPUT_VARIABLE BSD_PATH_PREFIX)
-  endif()
+  set(BSD_PATH_PREFIX "/opt/pkg")
   message(STATUS "resolved BSD_PATH_PREFIX to: '${BSD_PATH_PREFIX}'")
   link_directories ("${BSD_PATH_PREFIX}/lib")
-  link_directories ("${BSD_PATH_PREFIX}/opt/openssl/lib")
-  link_directories ("${BSD_PATH_PREFIX}/opt/ncurses/lib")
+  link_directories ("${BSD_PATH_PREFIX}/lib/openssl")
+  link_directories ("${BSD_PATH_PREFIX}/lib/ncurses")
+  link_directories ("${BSD_PATH_PREFIX}/lib/ev")
+  link_directories ("${BSD_PATH_PREFIX}/lib/ffmpeg4")
+  link_directories ("${BSD_PATH_PREFIX}/lib/ffmpeg4/libavcodec")
+  link_directories ("${BSD_PATH_PREFIX}/lib/ffmpeg4/libavutil")
+  link_directories ("${BSD_PATH_PREFIX}/lib/ffmpeg4/libavformat")
+  link_directories ("${BSD_PATH_PREFIX}/lib/ffmpeg4/libswresample")
   include_directories("${BSD_PATH_PREFIX}/include")
-  include_directories("${BSD_PATH_PREFIX}/opt/openssl/include")
-  include_directories("${BSD_PATH_PREFIX}/opt/ncurses/include")
+  include_directories("${BSD_PATH_PREFIX}/include/openssl")
+  include_directories("${BSD_PATH_PREFIX}/include/ncurses")
+  include_directories("${BSD_PATH_PREFIX}/include/ev")
+  include_directories("${BSD_PATH_PREFIX}/include/ffmpeg4")
+  include_directories("${BSD_PATH_PREFIX}/include/ffmpeg4/libavcodec")
+  include_directories("${BSD_PATH_PREFIX}/include/ffmpeg4/libavutil")
+  include_directories("${BSD_PATH_PREFIX}/include/ffmpeg4/libavformat")
+  include_directories("${BSD_PATH_PREFIX}/include/ffmpeg4/libswresample")
+
 endif ()
 
 if (${LINK_STATICALLY} MATCHES "true")

Maybe the function ensure_library_exists could check in subdirectories too?

But, my progress was slowed with make:

$ make
[  1%] Building CXX object src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/plugin.mm.o
In file included from /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/mutex:190:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__mutex_base:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/chrono:827:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:71:9: error: no member named 'clock_t' in the global namespace
using ::clock_t;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:73:9: error: no member named 'time_t' in the global namespace; did you mean 'size_t'?
using ::time_t;
      ~~^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.5/include/stddef.h:46:23: note: 'size_t' declared here
typedef __SIZE_TYPE__ size_t;
                      ^
In file included from /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/mutex:190:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__mutex_base:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/chrono:827:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:74:9: error: no member named 'tm' in the global namespace
using ::tm;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:78:9: error: no member named 'clock' in the global namespace
using ::clock;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:79:9: error: no member named 'difftime' in the global namespace
using ::difftime;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:80:9: error: no member named 'mktime' in the global namespace
using ::mktime;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:81:9: error: no member named 'time' in the global namespace
using ::time;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:83:9: error: no member named 'asctime' in the global namespace
using ::asctime;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:84:9: error: no member named 'ctime' in the global namespace
using ::ctime;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:85:9: error: no member named 'gmtime' in the global namespace
using ::gmtime;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:86:9: error: no member named 'localtime' in the global namespace
using ::localtime;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:88:9: error: no member named 'strftime' in the global namespace
using ::strftime;
      ~~^
In file included from /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/mutex:190:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__mutex_base:14:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/chrono:1581:12: error: unknown type name 'time_t'; did you mean 'size_t'?
    static time_t     to_time_t  (const time_point& __t) _NOEXCEPT;
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/cstddef:50:9: note: 'size_t' declared here
using ::size_t;
        ^
In file included from /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/mutex:190:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__mutex_base:14:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/chrono:1582:35: error: unknown type name 'time_t'; did you mean 'size_t'?
    static time_point from_time_t(time_t __t) _NOEXCEPT;
                                  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/cstddef:50:9: note: 'size_t' declared here
using ::size_t;
        ^
In file included from /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/mutex:190:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__mutex_base:14:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/chrono:2949:10: error: unknown type name 'time_t'; did you mean 'size_t'?
  static time_t to_time_t(const time_point& __t) noexcept {
         ^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/cstddef:50:9: note: 'size_t' declared here
using ::size_t;
        ^
In file included from /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/mutex:190:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__mutex_base:14:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/chrono:2956:33: error: unknown type name 'time_t'; did you mean 'size_t'?
  static time_point from_time_t(time_t __t) noexcept {
                                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/cstddef:50:9: note: 'size_t' declared here
using ::size_t;
        ^
In file included from /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/mutex:190:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__mutex_base:14:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/chrono:2951:14: error: use of undeclared identifier 'time_t'; did you mean 'size_t'?
      return time_t(
             ^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/cstddef:50:9: note: 'size_t' declared here
using ::size_t;
        ^
In file included from /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/mutex:190:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__mutex_base:15:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/system_error:149:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/string:506:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/string_view:175:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__string:57:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/memory:681:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/atomic:576:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__threading_support:325:28: error: incomplete result type '__libcpp_timespec_t' (aka 'timespec') in function definition
inline __libcpp_timespec_t __convert_to_timespec(const chrono::nanoseconds& __ns)
                           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/pthread.h:307:16: note: forward declaration of 'timespec'
                const struct timespec * _Nullable __restrict)
                             ^
In file included from /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/mutex:190:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__mutex_base:15:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/system_error:149:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/string:506:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/string_view:175:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__string:57:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/algorithm:643:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/memory:681:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/atomic:576:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__threading_support:329:23: error: variable has incomplete type '__libcpp_timespec_t' (aka 'timespec')
  __libcpp_timespec_t __ts;
                      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/pthread.h:307:16: note: forward declaration of 'timespec'
                const struct timespec * _Nullable __restrict)
                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/plugin.mm.o] Error 1
make[1]: *** [src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/all] Error 2
make: *** [all] Error 2

rnkn avatar Jul 14 '21 04:07 rnkn

Yikes. It looks like some include paths are missing, but I'm not quite sure how to fix it. I think I'll need to get an pkgsrc environment setup to debug.

It does look like all of these errors are coming from the macosmediakeys plugin, though. I'm curious if it succeeds if you comment out these two lines in the top-level CMakeLists.txt:

  add_subdirectory(src/plugins/macosmediakeys)
  add_dependencies(musikcube macosmediakeys)

My guess is you'll run into similar errors in other plugins, though... but probably worth a try to see if that narrows down the problem.

clangen avatar Jul 15 '21 02:07 clangen

You're on the money there; removing those lines runs into the same cascade of errors with coreaudioout, and removing those runs into errors with ffmpegdecoder. Definitely seems like the include paths aren't being passed... somewhere?

rnkn avatar Jul 15 '21 08:07 rnkn

p.s. Please don't feel obliged to spend time on pkgsrc just to debug, but I wholeheartedly recommend using pkgsrc for whatever OS you're on. It's amazing, and surely the most Unix-ish package manager.

rnkn avatar Jul 15 '21 13:07 rnkn

Yeah -- I'm trying to figure out how to deal with this particular issue; I don't currently have an easy path for getting a pkgsrc installation up and running. Hmm.

Would it be possible for you to give me a snippet of verbose make output? i.e. VERBOSE=1 make? I'm interested in the compiler flags being resolved -- things like include paths, c++ version, etc. Something along these lines would suffice:

cd /Users/clangen/src/musikcube/src/musikcore && /Library/Developer/CommandLineTools/usr/bin/c++ -DBOOST_ALL_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -DHAVE_BOOST -DMCSDK_DEFINE_EXPORTS -DSIGSLOT_USE_POSIX_THREADS -D_FILE_OFFSET_BITS=64 -Dmusikcore_EXPORTS -I/Users/clangen/src/musikcube/src -I/Users/clangen/src/musikcube/src/musikcore -I/Users/clangen/src/musikcube/src/musikcube -I/Users/clangen/src/musikcube/src/musikcube/cursespp -I/Users/clangen/src/musikcube/src/3rdparty/include -I/opt/homebrew/opt/openssl/include -I/opt/homebrew/opt/ncurses/include -I/Users/clangen/src/musikcube/src/musikcore/. -I/Users/clangen/src/musikcube/src/musikcore/.. -I/Users/clangen/src/musikcube/src/musikcore/../3rdparty/include -I/Users/clangen/src/musikcube/src/musikcore/../3rdparty/include/md5 -I/Users/clangen/src/musikcube/src/musikcore/../3rdparty/include/sqlite -isystem /opt/homebrew/include -std=c++14 -Wno-unused-result -Wno-deprecated-declarations -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -fPIC -MD -MT src/musikcore/CMakeFiles/musikcore.dir/audio/PlaybackService.cpp.o -MF CMakeFiles/musikcore.dir/audio/PlaybackService.cpp.o.d -o CMakeFiles/musikcore.dir/audio/PlaybackService.cpp.o -c /Users/clangen/src/musikcube/src/musikcore/audio/PlaybackService.cpp

clangen avatar Jul 17 '21 19:07 clangen

Thanks for looking into this for me!

I think pkgsrc might be a red herring here. If the build process assumes for homebrew's unorthodox install paths on macOS (e.g. stuff like /usr/local/opt/*, /usr/local/ncurses/include etc.) it will still cause trouble for people who have manually built/installed dependencies.

But here's a snippet of a verbose make, and it does appear like all the include paths are passed...

$ make VERBOSE=1
/opt/pkg/bin/cmake -S/Users/pwr/Developer/musikcube -B/Users/pwr/Developer/musikcube --check-build-system CMakeFiles/Makefile.cmake 0
/opt/pkg/bin/cmake -E cmake_progress_start /Users/pwr/Developer/musikcube/CMakeFiles /Users/pwr/Developer/musikcube//CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 all
/Library/Developer/CommandLineTools/usr/bin/make  -f src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/build.make src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/depend
cd /Users/pwr/Developer/musikcube && /opt/pkg/bin/cmake -E cmake_depends "Unix Makefiles" /Users/pwr/Developer/musikcube /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys /Users/pwr/Developer/musikcube /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/build.make src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/build
[  1%] Building CXX object src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/plugin.mm.o
cd /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys && /Library/Developer/CommandLineTools/usr/bin/c++ -DHAVE_BOOST -DSIGSLOT_USE_POSIX_THREADS -D_FILE_OFFSET_BITS=64 -Dmacosmediakeys_EXPORTS -I/Users/pwr/Developer/musikcube/src -I/Users/pwr/Developer/musikcube/src/musikcore -I/Users/pwr/Developer/musikcube/src/musikcube -I/Users/pwr/Developer/musikcube/src/musikcube/cursespp -I/Users/pwr/Developer/musikcube/src/3rdparty/include -I/opt/pkg/include -I/opt/pkg/include/openssl -I/opt/pkg/include/ncurses -I/opt/pkg/include/ev -I/opt/pkg/include/ffmpeg4 -I/opt/pkg/include/ffmpeg4/libavcodec -I/opt/pkg/include/ffmpeg4/libavutil -I/opt/pkg/include/ffmpeg4/libavformat -I/opt/pkg/include/ffmpeg4/libswresample -std=c++14 -Wno-unused-result -Wno-deprecated-declarations -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -fPIC -o CMakeFiles/macosmediakeys.dir/plugin.mm.o -c /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm
In file included from /Users/pwr/Developer/musikcube/src/plugins/macosmediakeys/plugin.mm:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/mutex:190:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__mutex_base:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/chrono:827:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/ctime:71:9: error: no member named 'clock_t' in the global namespace
using ::clock_t;
      ~~^

...

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/plugin.mm.o] Error 1
make[1]: *** [src/plugins/macosmediakeys/CMakeFiles/macosmediakeys.dir/all] Error 2
make: *** [all] Error 2

rnkn avatar Jul 18 '21 05:07 rnkn

Yeah, I think that homebrew is somehow masking whatever the root cause is, but it's strange because the missing symbols seem to be things that are built into C/C++... your compiler flags correctly specify -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk, which should be sufficient.

In this example, the symbol clock_t doesn't seem to be available in ctime, but it's defined at /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/sys/_types/_clock_t.h

Out of curiosity, what version of macOS are you running?

clangen avatar Jul 19 '21 02:07 clangen

So, funny story, in attempt to fix this I upgraded Apple's Command Line Tools (12.5.1) and, as is Apple's wont, they completely broke the cc compiler when called from CMake. I'll need to put this issue on hold until I figure out how to fix cc.

rnkn avatar Jul 22 '21 04:07 rnkn

Yikes. Maybe that suggests something was already slightly amiss? All the best figuring it out. 😬 Let me know if musikcube compiles once cc/c++ are back and working.

clangen avatar Jul 22 '21 06:07 clangen

Unfortunately, looks like it is also/still broken on MacOS 12.1 Monterey with their clang 13. sigh. this is getting tiresome and i now see my Mac days coming to a close. Anyway, in case in helps here's what it looked like:

 ~/C/musikcube> git log -n1
commit e0763f3730306d07b07f09a6ef9d224705372cf6 (HEAD -> master, origin/master, origin/HEAD)
Author: casey langen <[email protected]>
Date:   Sun Jan 2 23:32:08 2022 -0800

    Add additional debug logging to PipeWire state changes.

 ~/C/musikcube> git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

 ~/C/musikcube> cmake .
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success
-- Performing Test LLVM_HAS_ATOMICS
-- Performing Test LLVM_HAS_ATOMICS - Success
-- resolved BSD_PATH_PREFIX to: '/usr/local'
-- Found Boost: /usr/local/lib/cmake/Boost-1.76.0/BoostConfig.cmake (found suitable version "1.76.0", minimum required is "1.55.0") found components: system filesystem thread
-- [check-dependencies] curl found at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/lib/libcurl.tbd
-- [check-dependencies] pthread found at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/lib/libpthread.tbd
-- [check-dependencies] ssl found at /usr/local/opt/openssl/lib/libssl.dylib
-- [check-dependencies] crypto found at /usr/local/opt/openssl/lib/libcrypto.dylib
-- [check-dependencies] z found at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/lib/libz.tbd
-- [build] ENABLE_BUNDLED_TAGLIB not defined, setting to 'true'
-- [build] link libraries are: Boost::system;Boost::filesystem;Boost::thread;curl;pthread;ssl;crypto;dl
-- [check-dependencies] ev found at /usr/local/lib/libev.dylib
-- [taglibmetadatareader] defining ENABLE_FFMPEG
-- [taglibmetadatareader] using bundled taglib = true
-- [taglibmetadatareader] using /Users/ngzax/Code/musikcube/src/plugins/taglib_plugin/taglib-1.11/stage/lib/libtag.a
-- [check-dependencies] microhttpd found at /usr/local/lib/libmicrohttpd.dylib
-- [check-dependencies] mp3lame found at /usr/local/lib/libmp3lame.dylib
-- [stockencoders] defining ENABLE_FFMPEG
-- [check-dependencies] avcodec found at /usr/local/lib/libavcodec.dylib
-- [check-dependencies] avutil found at /usr/local/lib/libavutil.dylib
-- [check-dependencies] avformat found at /usr/local/lib/libavformat.dylib
-- [check-dependencies] swresample found at /usr/local/lib/libswresample.dylib
-- [libopenmpt] enabled = true; found library at /usr/local/lib/libopenmpt.dylib
-- [check-dependencies] openmpt found at /usr/local/lib/libopenmpt.dylib
-- [ffmpeg] enabled = true
-- [check-dependencies] avcodec found at /usr/local/lib/libavcodec.dylib
-- [check-dependencies] avutil found at /usr/local/lib/libavutil.dylib
-- [check-dependencies] avformat found at /usr/local/lib/libavformat.dylib
-- [check-dependencies] swresample found at /usr/local/lib/libswresample.dylib
-- [mpris] systemd *not* found. MPRIS plugin not enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/ngzax/Code/musikcube
 
~/C/musikcube> make
Consolidate compiler generated dependencies of target macosmediakeys
[  1%] Built target macosmediakeys
Consolidate compiler generated dependencies of target musikcore
[ 23%] Built target musikcore
[ 23%] Performing configure step for 'taglib'
CMake Warning at /usr/local/Cellar/cmake/3.22.1/share/cmake/Modules/Platform/Darwin-Initialize.cmake:303 (message):
  Ignoring CMAKE_OSX_SYSROOT value:

   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk

  because the directory does not exist.
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.22.1/share/cmake/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
  CMakeLists.txt:3 (project)


-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - broken
CMake Error at /usr/local/Cellar/cmake/3.22.1/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/ngzax/Code/musikcube/src/plugins/taglib_plugin/taglib-prefix/src/taglib-build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make -f Makefile cmTC_b5b2a/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_b5b2a.dir/build.make CMakeFiles/cmTC_b5b2a.dir/build
    Building C object CMakeFiles/cmTC_b5b2a.dir/testCCompiler.c.o
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc   -mmacosx-version-min=10.15 -MD -MT CMakeFiles/cmTC_b5b2a.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_b5b2a.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_b5b2a.dir/testCCompiler.c.o -c /Users/ngzax/Code/musikcube/src/plugins/taglib_plugin/taglib-prefix/src/taglib-build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_b5b2a
    /usr/local/Cellar/cmake/3.22.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b5b2a.dir/link.txt --verbose=1
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc  -mmacosx-version-min=10.15 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_b5b2a.dir/testCCompiler.c.o -o cmTC_b5b2a
    ld: library not found for -lSystem
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[4]: *** [cmTC_b5b2a] Error 1
    make[3]: *** [cmTC_b5b2a/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


-- Configuring incomplete, errors occurred!
See also "/Users/ngzax/Code/musikcube/src/plugins/taglib_plugin/taglib-prefix/src/taglib-build/CMakeFiles/CMakeOutput.log".
See also "/Users/ngzax/Code/musikcube/src/plugins/taglib_plugin/taglib-prefix/src/taglib-build/CMakeFiles/CMakeError.log".
make[2]: *** [src/plugins/taglib_plugin/taglib-prefix/src/taglib-stamp/taglib-configure] Error 1
make[1]: *** [src/plugins/taglib_plugin/CMakeFiles/taglib.dir/all] Error 2
make: *** [all] Error 2

it's weird that cmake is looking for cc in MacOSX11.1.sdk since CMakeCache.txt has correctly identified and set CMAKE_OSX_SYSROOT to MacOSX12.1.sdk.

the good news is that the homebrew install does work so i am still able to run the best music player evah! :)

ngzax avatar Jan 13 '22 14:01 ngzax

This seems to be the closest to identifying the source of the problem: https://stackoverflow.com/questions/54068035/linking-not-working-in-homebrews-cmake-since-mojave/54103956#54103956

However the fix suggested does not work for me. CMake is basically a show-stopper on macOS now.

rnkn avatar Jan 13 '22 14:01 rnkn

thanks for the pointer. being stubborn i tried editing CMakeLists.txt as well per the SO issue and it didn't work for me either. f apple. :/

ngzax avatar Jan 13 '22 15:01 ngzax