lvqcl wrote:> It doesn't know about uint32_t type, so the definition of cpu_xgetbv_x86() fails. > It can be fixed by adding "#include share/compat.h" to cpu.c (or by using > FLAC__uint32 from FLAC/ordinals.h).Ok, added share/compat.h.> When I fix this, the following problem occurs: > > error LNK2019: unresolved external symbol ___cpuidex referenced in function _FLAC__cpu_info_x86 libflac_static.lib > fatal error LNK1120: 1 unresolved externals flac.exe > > The code > > if (FLAC__AVX_SUPPORTED) > __cpuidex(cpuinfo, level, 0); /* for AVX2 detection */ > else > __cpuid(cpuinfo, level); /* some old compilers don't support __cpuidex */ > > adds reference to __cpuidex() even though MSVC2005 doesn't have it > (according to MSDN, it was added to MSVC 2008 SP1).That suggests that FLAC__AVX_SUPPORTED is true. Can you set it to false for MSVC2005? Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo wrote:> lvqcl wrote: > >> error LNK2019: unresolved external symbol ___cpuidex referenced in function _FLAC__cpu_info_x86 libflac_static.lib >> fatal error LNK1120: 1 unresolved externals flac.exe >> >> The code >> >> if (FLAC__AVX_SUPPORTED) >> __cpuidex(cpuinfo, level, 0); /* for AVX2 detection */ >> else >> __cpuid(cpuinfo, level); /* some old compilers don't support __cpuidex */ >> >> adds reference to __cpuidex() even though MSVC2005 doesn't have it >> (according to MSDN, it was added to MSVC 2008 SP1). > > That suggests that FLAC__AVX_SUPPORTED is true. Can you set it to false > for MSVC2005?No, FLAC__AVX_SUPPORTED is 0 (initially it's undefined, then inside cpu.h it's defined as 0). MSVC cannot discard unused references in debug builds and when LTCG is on, for example: <http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2016-April/193437.html> And currently LTCG is enabled for release builds.
Erik de Castro Lopo wrote:> That suggests that FLAC__AVX_SUPPORTED is true. Can you set it to false > for MSVC2005?Maybe we need something like: #if defined _MSC_VER && _MSC_VER < XXXXXXXXX #undef FLAC__AVX_SUPPORTED #define FLAC__AVX_SUPPORTED 0 #endif You need to provide me with a value for XXXXXXXXX. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
lvqcl wrote:> No, FLAC__AVX_SUPPORTED is 0 (initially it's undefined, then inside cpu.h > it's defined as 0). > > MSVC cannot discard unused references in debug builds and when LTCG is on, > for example: <http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2016-April/193437.html> > > And currently LTCG is enabled for release builds.Ok, thats a problem. A large chunk of the cleanup I was hoping to do depended on the fact that any sane compiler drops code which can be proved to be un-needed at compiler. Can LTCG be disabled? Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
lvqcl wrote:> No, FLAC__AVX_SUPPORTED is 0 (initially it's undefined, then inside cpu.h > it's defined as 0). > > MSVC cannot discard unused references in debug builds and when LTCG is on, > for example: <http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2016-April/193437.html> > > And currently LTCG is enabled for release builds.Ok, I think I've fixed it in: commit a08e90c425343630d820b8775d5a2a63a02689ee Author: Erik de Castro Lopo <erikd at mega-nerd.com> Date: Sun Jun 26 21:09:08 2016 +1000 libFLAC/cpu.c: Fixes for MSVC Please test. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/