ShiftMediaProject / FFVS-Project-Generator

A program that can scan existing FFmpeg/LibAV source files and dynamically generate a Visual Studio project file.
GNU Lesser General Public License v2.1
176 stars 77 forks source link

Project generation fails due to stdatomic #43

Closed softworkz closed 2 years ago

softworkz commented 2 years ago

Content of ffvs_log.txt is this:

rgb2rgb.c
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\include\stdatomic.h(15): fatal error C1189: #error:  <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release.

When I try the generation with VS 2019 by running from a "Developer Command Prompt for VS 2019", I get an error about missing stdatomic, like here:

  Error: Errors detected during compilation :-
         error C1083: Cannot open include file: 'stdatomic.h': No such file or directory

It can be worked around by copying the stdatomic.h shim (which earlier versions of the generator were creating) to the project target folder before running generation. This works in both cases (2022 and 2019).

I'm not sure why you have removed it. It's still included in the full project repo: https://github.com/ShiftMediaProject/FFmpeg/tree/d31acdd6c739e9b1e2b01dc2f383052fe24b3751/SMP

BTW: Big thanks for maintaining this!

Sibras commented 2 years ago

When I try the generation with VS 2019 by running from a "Developer Command Prompt for VS 2019", I get an error about missing stdatomic, like here:

  Error: Errors detected during compilation :-
         error C1083: Cannot open include file: 'stdatomic.h': No such file or directory

This shouldnt actually be happening as it should just pull in the compat file directly (instead of needing the old shim) as the compat header location is added to the command line. Try the latest code from git (youll have to compile it yourself) and see if that still has this issue or not.

I'm not sure why you have removed it. It's still included in the full project repo: https://github.com/ShiftMediaProject/FFmpeg/tree/d31acdd6c739e9b1e2b01dc2f383052fe24b3751/SMP

Those are actually leftovers that shouldnt actually still be there (I hadnt noticed till now)

softworkz commented 2 years ago

Try the latest code from git (youll have to compile it yourself) and see if that still has this issue or not.

It still has the issue:

rgb2rgb.c
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\include\stdatomic.h(15): fatal error C1189: #error:  <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release.

But I should note that I'm using the command as follows:

project_generate.exe --rootdir=../../source/ffmpeg --prefix=../../msvc --projdir=../vsprojects_head %PGOPTIONS% It has been working fine for years like this.

But now I'm also seeing path issues in the generated project files. The prefix-path (which I had re-added in the PR from today) is no longer applied correctly everywhere.

Comparing the project files, left is earlier result, right is current result (after the WinRT split commit):

image

And here:

image

softworkz commented 2 years ago

For better understanding, this is the basic folder structure:;

image

Most important is that the projects are outside of the ffmpeg repository, leaving it untouched.

softworkz commented 2 years ago

The only way out of all those problems was to drop the "Split Projects.." commit from history (but applying all others).

I got all working again. The stdatomic shim is still required.

But the "Split Projects.." commit is screwing up everything. It drops many template variables and replaces them by hardcoded paths and makes other assumptions about the folder structure which make it impossible to use any other structure like it was possible before.

Why can't I just use use the default structure?

Well, it's not that I'd just find a different folder structure better by personal taste. The problem is that the default structure forces you to have the VS projects in a subfolder (SMP) inside the ffmpeg repository. And that's something I can't do. I need 100% clean and original ffmpeg branches to work with. Even a tiny commit to .gitignore would be too much already. This would mess up the history and permanently require manual handling (I switch branches quite often).

I hope it will be possible to re-introduce those dropped templating capabilities..?

Sibras commented 2 years ago

But I should note that I'm using the command as follows:

project_generate.exe --rootdir=../../source/ffmpeg --prefix=../../msvc --projdir=../vsprojects_head %PGOPTIONS%

Ah yep that will be the problem, prefix support was not complete after the winrt changes (and was thus removed) and the stdatomic error is a bug due to the use of --projdir

Ill fix both of those which should clear up your issues

softworkz commented 2 years ago

Awesome! Thank you very much. Will try shortly.

softworkz commented 2 years ago

I have compiled the generator with you patch and I can confirm that it's working fine, now!

Thanks again!

oviano commented 2 years ago

Building the latest master project_generator and running against latest FFmpeg main still produces the stdatomic error for me.

My command line is

project_generate.exe --disable-programs --disable-avdevice --disable-avformat --disable-avfilter --disable-postproc --disable-swresample --disable-swscale --disable-muxers --disable-demuxers --disable-encoders --disable-decoders --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=aac --enable-decoder=ac3 --enable-decoder=eac3 --disable-parsers --enable-parser=h264 --enable-parser=hevc --enable-parser=aac --enable-parser=ac3 --disable-bsfs --enable-bsf=h264_mp4toannexb --enable-bsf=hevc_mp4toannexb --enable-bsf=aac_adtstoasc --enable-bsf=null --disable-doc --disable-network --disable-bzlib --disable-iconv --disable-zlib --disable-lzma --disable-sdl2 --prefix=..\ffmpeg-win32

Copying the stdatomic.h file into the SMP folder prevents the error.

Sibras commented 2 years ago

Building the latest master project_generator and running against latest FFmpeg main still produces the stdatomic error for me.

My command line is

project_generate.exe --disable-programs --disable-avdevice --disable-avformat --disable-avfilter --disable-postproc --disable-swresample --disable-swscale --disable-muxers --disable-demuxers --disable-encoders --disable-decoders --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=aac --enable-decoder=ac3 --enable-decoder=eac3 --disable-parsers --enable-parser=h264 --enable-parser=hevc --enable-parser=aac --enable-parser=ac3 --disable-bsfs --enable-bsf=h264_mp4toannexb --enable-bsf=hevc_mp4toannexb --enable-bsf=aac_adtstoasc --enable-bsf=null --disable-doc --disable-network --disable-bzlib --disable-iconv --disable-zlib --disable-lzma --disable-sdl2 --prefix=..\ffmpeg-win32

Copying the stdatomic.h file into the SMP folder prevents the error.

Testing that exact command line and I cannot reproduce the error

oviano commented 2 years ago

Is that using the current FFmpeg master? Because I re-tested against release/4.4 and it did not produce the error on that branch.

Sibras commented 2 years ago

Yep, tested against the very latest master and have no issues.

oviano commented 2 years ago

Hmm, there must be more to it then. Are you also using VS2022?

c:\Users\Oliver\Git\source\thirdparty\FFmpeg\SMP>project_generate.exe --disable-programs --disable-avdevice --disable-avformat --disable-avfilter --disable-postproc --disable-swresample --disable-swscale --disable-muxers --disable-demuxers --disable-encoders --disable-decoders --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=aac --enable-decoder=ac3 --enable-decoder=eac3 --disable-parsers --enable-parser=h264 --enable-parser=hevc --enable-parser=aac --enable-parser=ac3 --disable-bsfs --enable-bsf=h264_mp4toannexb --enable-bsf=hevc_mp4toannexb --enable-bsf=aac_adtstoasc --enable-bsf=null --disable-doc --disable-network --disable-bzlib --disable-iconv --disable-zlib --disable-lzma --disable-sdl2 --prefix=..\ffmpeg-win32
Project generator (this may take several minutes, please wait)...
  Passing configure file...
  Outputting config.h...
  Outputting config_components.h...
  Outputting avconfig.h...
  Outputting ffversion.h...
  Outputting enabled components file libavfilter/filter_list.c...
  Outputting enabled components file libavcodec/codec_list.c...
  Outputting enabled components file libavcodec/parser_list.c...
  Outputting enabled components file libavcodec/bsf_list.c...
  Outputting enabled components file libavformat/demuxer_list.c...
  Outputting enabled components file libavformat/muxer_list.c...
  Outputting enabled components file libavdevice/indev_list.c...
  Outputting enabled components file libavdevice/outdev_list.c...
  Outputting enabled components file libavformat/protocol_list.c...
  Generating from Makefile (../libavcodec/MakeFile)...
  Generating from Makefile (../libavcodec/x86/MakeFile)...
  Generating missing DCE symbols (libavcodec)...
  Generating project exports file (libavcodec)...
Invalid switch - "".
  Error: Errors detected during compilation :-
         error C1189: #error:  <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release.
         Unknown error detected. See ffvs_log.txt for further details.
ac3_parser.c
adts_parser.c
allcodecs.c
avcodec.c
avdct.c
avpacket.c
bitstream.c
bitstream_filters.c
bsf.c
codec_desc.c
codec_par.c
d3d11va.c
decode.c
dirac.c
dv_profile.c
encode.c
get_buffer.c
imgconvert.c
jni.c
mathtables.c
mediacodec.c
mpeg12framerate.c
options.c
parser.c
parsers.c
profiles.c
qsv_api.c
raw.c
utils.c
version.c
vlc.c
vorbis_parser.c
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\stdatomic.h(15): fatal error C1189: #error:  <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release. (compiling source file ../libavcodec/mpeg12framerate.c)