x265 multilab have strange Issues when compile it with MSVC 2013.

Issue #148 closed
changhao fu created an issue

x265 source commits b1af4c36f48a4500a4912373ebcda9a5540b5c15

When compile it with GCC 5.1.0 it worked fine.

In MSVC 2013 update4 it worked fine in main.

But in main10 it would be:

x265 compile with GCC 5.1.0 http://www.imagebam.com/image/20e45c417829275

x265 compile with MSVC 2013 update4 http://www.imagebam.com/image/bef984417829281

Msvc also have 54 waring said that some functions/classes have been defined in x265-static.lib,and the same functions/classes in x265-static-main10.lib are ignored.

x265 cli: --preset veryslow --crf 17.0 --tu-intra-depth 3 --tu-inter-depth 3 --me 3 --subme 5 --merange 44 --b-intra --no-rect --no-amp --ref 5 --weightb --keyint 720 --min-keyint 1 --bframes 9 --aq-mode 1 --aq-strength 1.1 --rd 5 --no-sao --no-open-gop --rc-lookahead 72 --scenecut 40 --max-merge 4 --qcomp 0.78 --no-strong-intra-smoothing --psy-rdoq 14.0 --psy-rd 1.2 --deblock -2:-2 --rdoq-level 1 --qg-size 32 --qpstep 5 --colormatrix bt709 --input-depth 10 --pools +,- --output-depth 10

bat file

@cd 10bit

"C:\Program Files (x86)\CMake\bin\cmake.exe"  -G "Visual Studio 12 Win64" ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DYASM_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/yasm.exe"

  call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
  MSBuild /property:Configuration="Release" /target:rebuild x265.sln 
  copy/y Release\x265-static.lib ..\8bit\x265-static-main10.lib

@cd ..

@cd 8bit

"C:\Program Files (x86)\CMake\bin\cmake.exe"  -G "Visual Studio 12 Win64" ../../../source -DHIGH_BIT_DEPTH=OFF -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=ON -DEXTRA_LIB=x265-static-main10.lib -DEXTRA_LINK_FLAGS="/FORCE:MULTIPLE" -DYASM_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/yasm.exe"

  call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
  MSBuild /property:Configuration="Release" /target:rebuild x265.sln
  copy/y Release\x265.exe ..

@cd ..

And if I change the bat file like this,that would be mian10 worked fine and strange Issues happened in main.

@cd 8bit

"C:\Program Files (x86)\CMake\bin\cmake.exe"  -G "Visual Studio 12 Win64" ../../../source -DHIGH_BIT_DEPTH=OFF -DEXPORT_C_API=OFF -

DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DYASM_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/yasm.exe"

  call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
  MSBuild /property:Configuration="Release" /target:rebuild x265.sln 
  copy/y Release\x265-static.lib ..\10bit\x265-static-main.lib

@cd ..

@cd 10bit

"C:\Program Files (x86)\CMake\bin\cmake.exe"  -G "Visual Studio 12 Win64" ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -

DENABLE_SHARED=OFF -DENABLE_CLI=ON -DEXTRA_LIB=x265-static-main.lib -DEXTRA_LINK_FLAGS="/FORCE:MULTIPLE" -DYASM_EXECUTABLE="C:/Program Files 

(x86)/Microsoft Visual Studio 12.0/VC/bin/yasm.exe"

  call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"
  MSBuild /property:Configuration="Release" /target:rebuild x265.sln
  copy/y Release\x265.exe ..

@cd ..

Comments (2)

  1. Steve Borho

    The warnings come from a bug in MSVC. anonymous namespaces are supposed to be treated like static, anything within them is supposed to be file-local and not exported. But the way MSVC implemented them they still conflict when you link together two builds of the same source file.

  2. Steve Borho

    multilib: static functions to avoid link conflict (closes #148)

    MSVC's implementation of anonymous namespaces prevents linking two builds of the same library together (they are not properly file-local, they are just given a file-unique namespace which is the same unique namespace in both builds).

    Because of this, we must use static declarators

    → <<cset a4d86a9cba97>>

  3. Log in to comment