libretro / libretro/RetroArch

config :: ffmpeg_init_audio header file conditional causes an undeclared failure

Open
#13,953 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

compilation ffmpeg
Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

I have the dev 5.0.1-3.fc36 package for the header file installed: /usr/include/ffmpeg/libavutil/channel_layout.h

#define AV_CH_LAYOUT_MONO              (AV_CH_FRONT_CENTER)
#define AV_CH_LAYOUT_STEREO            (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)

... but it self-declares:

#ifndef AVUTIL_CHANNEL_LAYOUT_H
#define AVUTIL_CHANNEL_LAYOUT_H
Actual behavior
CC record/drivers/record_ffmpeg.c
CC cores/libretro-ffmpeg/ffmpeg_core.c
record/drivers/record_ffmpeg.c: In function ‘ffmpeg_init_audio’:
record/drivers/record_ffmpeg.c:307:9: error: ‘AV_CH_LAYOUT_STEREO’ undeclared (first use in this function)
  307 |       ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
      |         ^~~~~~~~~~~~~~~~~~~
record/drivers/record_ffmpeg.c:307:9: note: each undeclared identifier is reported only once for each function it appears in
record/drivers/record_ffmpeg.c:307:31: error: ‘AV_CH_LAYOUT_MONO’ undeclared (first use in this function)
  307 |       ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
      |                               ^~~~~~~~~~~~~~~~~
make: *** [Makefile:206: obj-unix/release/record/drivers/record_ffmpeg.o] Error 1

Using git version 14ab2db692 on Intel Linux (Fedora 36), if I remove the ifdef/endif compiler conditional, this works.
RetroArch/record/drivers/record_ffmpeg.c

#ifdef HAVE_AV_CHANNEL_LAYOUT
#include <libavutil/channel_layout.h>
#endif
Steps to reproduce the bug

RetroArch.spec.txt
rpmbuild -bb rpmbuild/SPECS/RetroArch.spec

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in record/drivers/record_ffmpeg.c around ffmpeg_init_audio and the HAVE_AV_CHANNEL_LAYOUT conditional, then inspect the installed libavutil/channel_layout.h shown in the report. Reproduce the Fedora build with the linked RetroArch.spec.txt and rpmbuild command. Done means the affected build compiles without undeclared AV_CH_LAYOUT_STEREO or AV_CH_LAYOUT_MONO errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend, build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.