Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build on Arch linux (FFmpeg) #1525

Closed
superbonaci opened this issue Jun 29, 2024 · 22 comments · Fixed by #1537
Closed

Can't build on Arch linux (FFmpeg) #1525

superbonaci opened this issue Jun 29, 2024 · 22 comments · Fixed by #1537

Comments

@superbonaci
Copy link

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
Copy link
Contributor

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

@superbonaci
Copy link
Author

@CuriousTommy where is such error?

@CuriousTommy
Copy link
Contributor

CuriousTommy commented Jun 29, 2024

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
Copy link
Author

darling_make.txt

@CuriousTommy
Copy link
Contributor

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
Copy link
Contributor

CuriousTommy commented Jul 1, 2024

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:

FFmpeg/FFmpeg@65ddc74#diff-478d27d89657b0f159ce32990b05f3b42ef49fc65f042cdcdcfb38be764e56e4L1052-L1060

  • read_probe is no longer exposed in AVInputFormat

FFmpeg/FFmpeg@b800327#diff-9c8754d4affba4f4e8d0a1d3a6bcd6b23989f9f89cd090c2dddac4c6b826245dL615

@CuriousTommy
Copy link
Contributor

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

@superbonaci
Copy link
Author

Still fails

ffmpeg_fix.txt

@CuriousTommy
Copy link
Contributor

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;
      |                                        ~~~~~~~~~  ^

@swsharp
Copy link

swsharp commented Jul 28, 2024

I also encountered the original issue in a Manjaro / Arch Linux build environment. I tried using bc55338 refs/heads/ffmpeg_fix for this build but still encountered an error.

7 warnings and 3 errors generated.
2 warnings generated.
make[2]: *** [src/CoreAudio/AudioToolbox/CMakeFiles/AudioToolbox.dir/build.make:104: src/CoreAudio/AudioToolbox/CMakeFiles/AudioToolbox.dir/AudioConverterImpl.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:40445: src/CoreAudio/AudioToolbox/CMakeFiles/AudioToolbox.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Earlier in the build

/home/stuarts/git/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:103:2: warning: "TODO: Remove deprecated 'channels' once we no longer support older distros"  [-W#warnings]
  103 | #warning "TODO: Remove deprecated 'channels' once we no longer support older distros" 
      |  ^
[ 84%] Building C object src/external/apr/apr-util/apr-util/CMakeFiles/aprutil.dir/buckets/apr_buckets_refcount.c.o
/home/stuarts/git/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:143:2: warning: "TODO: Remove deprecated 'channels' once we no longer support older distros"  [-W#warnings]
  143 | #warning "TODO: Remove deprecated 'channels' once we no longer support older distros" 
      |  ^
/home/stuarts/git/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/stuarts/git/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/stuarts/git/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;
      |                                        ~~~~~~~~~  ^
/home/stuarts/git/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:180:2: warning: "TODO: Remove deprecated 'channels' once we no longer support older distros"  [-W#warnings]
  180 | #warning "TODO: Remove deprecated 'channels' once we no longer support older distros" 
      |  ^
/home/stuarts/git/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:479:4: warning: TODO: test this new avcodec decoder code [-W#warnings]
  479 |                 #warning TODO: test this new avcodec decoder code
      |                  ^
/home/stuarts/git/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:593:5: warning: TODO: test this new avcodec encoder code [-W#warnings]
  593 |                         #warning TODO: test this new avcodec encoder code
Software Version
Clang 18.1.18
CMake 3.30.0
Linux Kernel 6.9.9-1-MANJARO
Darling bc55338 refs/heads/ffmpeg_fix

@bivirus
Copy link

bivirus commented Jul 31, 2024

i get the same error

@Neoncat-OG
Copy link

I could resolve the no member named 'channel_layout' in '...' error by using ch_layout instead but now I get this error:

/home/user/darling/src/CoreAudio/AudioToolbox/AudioConverterImpl.cpp:150:23: error: no viable overloaded '='
150 | m_encoder->ch_layout = CAChannelCountToLayout(m_destinationFormat.mChannelsPerFrame);

I'm not smart enough to solve the problem but I hope this helps.

@juancolchete
Copy link

The problem could be solved by downgrading ffmpeg version and some depencencies to be able to build.

sudo pacman -U https://archive.archlinux.org/packages/l/libjxl/libjxl-0.9.0-1-x86_64.pkg.tar.zst
sudo pacman -U https://archive.archlinux.org/packages/l/libplacebo/libplacebo-6.338.1-1-x86_64.pkg.tar.zst
sudo pacman -U https://archive.archlinux.org/packages/l/libavif/libavif-0.9.3-1-x86_64.pkg.tar.zst
sudo pacman -U https://archive.archlinux.org/packages/r/rav1e/rav1e-0.6.6-3-x86_64.pkg.tar.zst
sudo pacman -U https://archive.archlinux.org/packages/l/libvpx/libvpx-1.8.2-2-x86_64.pkg.tar.zst 
sudo pacman -U https://archive.archlinux.org/packages/x/x265/x265-3.5-3-x86_64.pkg.tar.zst
sudo pacman -U https://archive.archlinux.org/packages/f/ffmpeg/ffmpeg-2%3A6.1.1-7-x86_64.pkg.tar.zst

Then re build and install

make
sudo make install

@CuriousTommy CuriousTommy changed the title Can't build on Arch linux Can't build on Arch linux (FFmpeg) Aug 18, 2024
@CuriousTommy
Copy link
Contributor

@superbonaci I set up a Manjaro VM to fix the remaining build issues. Try now and let me know if you run into any issues.

@superbonaci
Copy link
Author

@CuriousTommy are you on manjaro unstable, so it's more like Arch?

Still compile error:

[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/regcomp.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/regenc.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/regerror.c.o
2 warnings generated.
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/regexec.c.o
[ 85%] Linking C shared library SpotlightServices
ld: warning: OS dylibs should not add rpaths (linker option: -rpath) (Xcode build setting: LD_RUNPATH_SEARCH_PATHS)
ld: warning: static initializer found in 'CMakeFiles/SpotlightServices.dir/src/SpotlightServices.m.o'. Use -no_inits to make this an error.  Use -no_warn_inits to suppress warning
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/regparse.c.o
ld: warning: OS dylibs should not add rpaths (linker option: -rpath) (Xcode build setting: LD_RUNPATH_SEARCH_PATHS)
ld: warning: static initializer found in 'CMakeFiles/SpotlightServices.dir/src/SpotlightServices.m.o'. Use -no_inits to make this an error.  Use -no_warn_inits to suppress warning
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/regsyntax.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/ruby.c.o
[ 85%] Built target SpotlightServices
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/safe.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/signal.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/sprintf.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/st.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/strftime.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/string.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/struct.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/symbol.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/thread.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/time.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/transient_heap.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/transcode.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/util.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/variable.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/version.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/vm_backtrace.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/vm_dump.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/vm_trace.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/vm.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/missing/explicit_bzero.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/missing/setproctitle.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/enc/ascii.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/enc/unicode.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/enc/us_ascii.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/enc/utf_8.c.o
[ 85%] Building C object src/external/ruby/CMakeFiles/Ruby.dir/ruby/enc/trans/newline.c.o
[ 85%] Linking C shared library Ruby
ld: warning: OS dylibs should not add rpaths (linker option: -rpath) (Xcode build setting: LD_RUNPATH_SEARCH_PATHS)
ld: warning: -undefined dynamic_lookup is incompatible with dyld share cache
ld: warning: OS dylibs should not add rpaths (linker option: -rpath) (Xcode build setting: LD_RUNPATH_SEARCH_PATHS)
ld: warning: -undefined dynamic_lookup is incompatible with dyld share cache
[ 85%] Built target Ruby
make: *** [Makefile:136: all] Error 2

@CuriousTommy
Copy link
Contributor

are you on manjaro unstable, so it's more like Arch?

Not sure, just went with the default install.

Still compile error:

ld: warning: OS dylibs should not add rpaths (linker option: -rpath) (Xcode build setting: LD_RUNPATH_SEARCH_PATHS)
ld: warning: -undefined dynamic_lookup is incompatible with dyld share cache
ld: warning: OS dylibs should not add rpaths (linker option: -rpath) (Xcode build setting: LD_RUNPATH_SEARCH_PATHS)
ld: warning: -undefined dynamic_lookup is incompatible with dyld share cache
[ 85%] Built target Ruby
make: *** [Makefile:136: all] Error 2

Again... the log you posted doesn't tell me what is causing the Error 2 to occur. If you are not sure where the actual error is at, post the entire log in a Pastebin/GitHub gist.

@superbonaci
Copy link
Author

superbonaci commented Aug 20, 2024

@CuriousTommy
Copy link
Contributor

Can you run git status & git log and copy and paste the output.

@superbonaci
Copy link
Author

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

$ git log
commit 773e9874cf38fdeb9518f803e041924e255d0ebe
Merge: 203af1f60 42f93a955
Author: CuriousTommy <curioustommy@protonmail.com>
Date:   Sun Aug 18 12:11:15 2024 -0700

    Merge pull request #1522 from darlinghq/update_submodules
    
    Update Submodules

commit 42f93a95577482bac823e849e880535b332b24c7

@superbonaci
Copy link
Author

I'm going to try Manjaro unstable too, in case there's some difference with Arch.

@CuriousTommy
Copy link
Contributor

You need to check out the ffmpeg_fix branch. Run git checkout ffmpeg_fix to switch to the ffmpeg_fix branch

@superbonaci
Copy link
Author

That works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants