darlinghq / darling

Darwin/macOS emulation layer for Linux
http://www.darlinghq.org
GNU General Public License v3.0
11.21k stars 426 forks source link

Can't build on Arch linux #1525

Open superbonaci opened 3 days ago

superbonaci commented 3 days ago

Build Log What is the build error?

make
[ 90%] Built target lpmove
[ 90%] Built target lpoptions
[ 90%] Built target lpstat
[ 90%] Linking C shared library IconServices
ld: warning: static initializer found in 'CMakeFiles/IconServices.dir/src/IconServices.m.o'. Use -no_inits to make this an error.  Use -no_warn_inits to suppress warning
ld: warning: static initializer found in 'CMakeFiles/IconServices.dir/src/IconServices.m.o'. Use -no_inits to make this an error.  Use -no_warn_inits to suppress warning
[ 91%] Built target IconServices
make[1]: *** [CMakeFiles/Makefile2:40843: src/CoreAudio/AudioToolbox/CMakeFiles/AudioToolbox.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 91%] Linking C shared library AppKit
ld: warning: instance method 'drawWithRect:options:' in category from CMakeFiles/AppKit.dir/NSStringDrawing.m.o conflicts with same method from another category
ld: warning: instance method 'size' in category from CMakeFiles/AppKit.dir/NSStringDrawing.m.o conflicts with same method from another category
ld: warning: instance method 'drawInRect:' in category from CMakeFiles/AppKit.dir/NSStringDrawing.m.o conflicts with same method from another category
ld: warning: instance method 'drawAtPoint:' in category from CMakeFiles/AppKit.dir/NSStringDrawing.m.o conflicts with same method from another category
[ 92%] Built target AppKit
make: *** [Makefile:136: all] Error 2

System Information What system are you building with?

Software Version
Clang X.Y.Z
CMake X.Y.Z
Linux Kernel X.Y.Z
Darling Git Commit Hash
CuriousTommy commented 3 days ago

@superbonaci The build log doesn't show the cause for the build error. You need to copy and paste the actual error.

superbonaci commented 3 days ago

@CuriousTommy where is such error?

CuriousTommy commented 3 days ago

If you did a multi-threaded build, you would have to look for it in the output (try searching for any reference to "Error").

make[1]: *** [CMakeFiles/Makefile2:40843: src/CoreAudio/AudioToolbox/CMakeFiles/AudioToolbox.dir/all] Error 2

This error above only tells me that an error occurred in AudioToolbox, it's not enough information for me to know what is actually causing the error.

If you are not sure where the actual error is located, I strongly recommend post the entire output (either in a pastebin, or equivalent site).

superbonaci commented 2 days ago

darling_make.txt

CuriousTommy commented 2 days ago

Okay, here is the cause:

[ 84%] Building C object src/external/security/SecurityTool/macOS/CMakeFiles/securitytool_macos.dir/keychain_lock.c.o
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:103:8: error: no member named 'channels' in 'AVCodecContext'
  103 |                 cIn->channels = inSourceFormat->mChannelsPerFrame;
      |                 ~~~  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:106:52: error: no member named 'channels' in 'AVCodecContext'
  106 |                 std::cout << "Converting from PCM with " << cIn->channels << " channels at " << cIn->sample_rate << " Hz\n";
      |                                                             ~~~  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:134:13: error: no member named 'channels' in 'AVCodecContext'
  134 |         m_encoder->channels = m_destinationFormat.mChannelsPerFrame;
      |         ~~~~~~~~~  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:136:13: error: no member named 'channel_layout' in 'AVCodecContext'
  136 |         m_encoder->channel_layout = CAChannelCountToLayout(m_destinationFormat.mChannelsPerFrame);
      |         ~~~~~~~~~  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:164:16: error: no member named 'channel_layout' in 'AVFrame'
  164 |         m_audioFrame->channel_layout = m_encoder->channel_layout;
      |         ~~~~~~~~~~~~  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:164:44: error: no member named 'channel_layout' in 'AVCodecContext'
  164 |         m_audioFrame->channel_layout = m_encoder->channel_layout;
      |                                        ~~~~~~~~~  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:167:78: error: no member named 'channels' in 'AVCodecContext'
  167 |         int audioSampleBuffer_size = av_samples_get_buffer_size(nullptr, m_encoder->channels, m_audioFrame->nb_samples, m_encoder->sample_fmt, 0);
      |                                                                          ~~~~~~~~~  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:177:66: error: no member named 'channels' in 'AVCodecContext'
  177 |         if (int err = avcodec_fill_audio_frame(m_audioFrame, m_encoder->channels, m_encoder->sample_fmt,
      |                                                              ~~~~~~~~~  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:456:4: warning: TODO: test this new avcodec decoder code [-W#warnings]
  456 |                 #warning TODO: test this new avcodec decoder code
      |                  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:570:5: warning: TODO: test this new avcodec encoder code [-W#warnings]
  570 |                         #warning TODO: test this new avcodec encoder code
      |                          ^
2 warnings and 8 errors generated.
CuriousTommy commented 2 days ago

Seems that AVCodecContext is part of ffmpeg (avcodec.h). Looking at the built Arch Linux's ffmpeg package confirms that channels does not exist inside AVCodecContext anymore.


After some further digging, channels is a deprecated API that has been recently removed:

https://github.com/FFmpeg/FFmpeg/commit/65ddc74988245a01421a63c5cffa4d900c47117c#diff-478d27d89657b0f159ce32990b05f3b42ef49fc65f042cdcdcfb38be764e56e4L1052-L1060

CuriousTommy commented 1 day ago

@superbonaci I pushed a ffmpeg_fix branch that should fix your issue. Please test and let me know if the build succeeds.

superbonaci commented 1 day ago

Still fails

ffmpeg_fix.txt

CuriousTommy commented 22 hours ago

Hmm...

/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:150:13: error: no member named 'channel_layout' in 'AVCodecContext'
  150 |         m_encoder->channel_layout = CAChannelCountToLayout(m_destinationFormat.mChannelsPerFrame);
      |         ~~~~~~~~~  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:178:16: error: no member named 'channel_layout' in 'AVFrame'
  178 |         m_audioFrame->channel_layout = m_encoder->channel_layout;
      |         ~~~~~~~~~~~~  ^
/home/jmss/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:178:44: error: no member named 'channel_layout' in 'AVCodecContext'
  178 |         m_audioFrame->channel_layout = m_encoder->channel_layout;
      |                                        ~~~~~~~~~  ^