[Mesa-dev] Problem with LLVM on Windows with MSVC
Jose Fonseca
jfonseca at vmware.com
Fri Apr 10 15:01:43 PDT 2015
I suspect that when you built LLVM, you built with the Debug build type
instead of Release. That's why you need LLVM_USE_CRT_DEBUG= instead of
LLVM_USE_CRT_RELEASE=. But I don't recommend you use a Debug LLVM
build, it can be much slower.
To be safe, I could update the instructions to mention both
LLVM_USE_CRT_DEBUG/RELEASE=
But you're right about a typo there: the 2nd -DLLVM_USE_CRT_RELEASE=
should have "MT", not "MTd".
Jose
On 10/04/15 22:46, Shervin Sharifi wrote:
> Thanks everyone.
> I was able to compile it using the instructions Jose sent from this
> page: http://mesa3d.org/llvmpipe.html
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__mesa3d.org_llvmpipe.html&d=AwMFaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=-nzRORyOJMG_Ypxfmg_i-cQCYiYB2RdnLwC8UALwNv4&s=5iUUSKJP0-twh5_K-h8u1oZnrJKh1nwBPKzufoV9nRY&e=>.
> However, I believe there's a typo in that page. In the text I've pasted
> below, the highlighted RELEASE should be DEBUG.
>
> Thanks again,
> Shervin
>
>
> For Windows you will need to build LLVM from source with MSVC or MINGW
> (either natively or through cross compilers) and CMake, and set the LLVM
> environment variable to the directory you installed it to. LLVM will be
> statically linked, so when building on MSVC it needs to be built with a
> matching CRT as Mesa, and you'll need to pass -DLLVM_USE_CRT_RELEASE=MTd
> for debug and checked builds, -DLLVM_USE_CRT_RELEASE=MTd for profile and
> release builds. You can build only the x86 target by passing
> -DLLVM_TARGETS_TO_BUILD=X86 to cmake.
>
> On Fri, Apr 10, 2015 at 1:21 AM, Predut, Marius <marius.predut at intel.com
> <mailto:marius.predut at intel.com>> wrote:
>
> Try to make local changes and remove this from file:____
>
> #ifdefined(_MSC_VER)____
>
> staticdoublecopysign(doublex,doubley)____
>
> …____
>
> #endif____
>
> It needs because vs 2013 has his own copysign function as standard
> api and then back here____
>
> __ __
>
> marius____
>
> __ __
>
> *From:*Shervin Sharifi [mailto:shervin0 at gmail.com
> <mailto:shervin0 at gmail.com>]
> *Sent:* Thursday, April 09, 2015 8:45 PM
> *To:* Predut, Marius
> *Cc:* mesa-dev at lists.freedesktop.org
> <mailto:mesa-dev at lists.freedesktop.org>
> *Subject:* Re: [Mesa-dev] Problem with LLVM on Windows with MSVC____
>
> __ __
>
> Thank you. ____
>
> I have compiled llvm with /MDd options, but Mesa doesn't accept that
> and asks for /MTd.____
>
> So I compiled llvm with /MTd and it worked.____
>
> However, I prefer to change Mesa to dynamic option, but I don't know
> how to do that. I tried the following, but got another error:____
>
> __ __
>
> The only thing I found is this in the scons\gallium.py:____
>
> if env['platform'] == 'windows' and msvc:____
>
> # Choose the appropriate MSVC CRT____
>
> # http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__msdn.microsoft.com_en-2Dus_library_2kzt1wy3.aspx&d=AwMFaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=-nzRORyOJMG_Ypxfmg_i-cQCYiYB2RdnLwC8UALwNv4&s=1KL6aPLZAEfM6QmfXRsUuhL8ea2chcskp_kl84xH87U&e=>____
>
> if env['build'] in ('debug', 'checked'):____
>
> env.Append(CCFLAGS = ['/MTd'])____
>
> env.Append(SHCCFLAGS = ['/LDd'])____
>
> else:____
>
> env.Append(CCFLAGS = ['/MT'])____
>
> env.Append(SHCCFLAGS = ['/LD'])____
>
> __ __
>
> I changed the /MTd to /MDd and compiled. I got the following error,
> so I'm not sure if this is the right way of doing it. ____
>
> __ __
>
> src\glsl\ir_constant_expression.cpp(57) : error C2491: 'copysign' :
> definition of dllimport function not allowed____
>
> __ __
>
> Thanks, ____
>
> Shervin____
>
> __ __
>
> P.S. You're right Marius. It was a typo. I missed the i at the end
> when copying the command line ("gd" instead of "gdi"). ____
>
> __ __
>
> __ __
>
> On Thu, Apr 9, 2015 at 9:42 AM, Predut, Marius
> <marius.predut at intel.com <mailto:marius.predut at intel.com>> wrote:____
>
> Indeed seems you have some incompatible libraries (one build static
> and other dynamic –dll)____
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=732124
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__bugzilla.mozilla.org_show-5Fbug.cgi-3Fid-3D732124&d=AwMFaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=-nzRORyOJMG_Ypxfmg_i-cQCYiYB2RdnLwC8UALwNv4&s=XXBc9wtK_ZMbeOt2qeG34pJhLVlceLU3Poz-CDbAuZ4&e=>____
>
> but what suppose `libgl-gd' target? Is this a typo mismatch?____
>
> Try to build llvm in a dynamic mode , may be it will solve your
> problems____
>
> ____
>
> marius____
>
> ____
>
> ____
>
> *From:*mesa-dev [mailto:mesa-dev-bounces at lists.freedesktop.org
> <mailto:mesa-dev-bounces at lists.freedesktop.org>] *On Behalf Of
> *Shervin Sharifi
> *Sent:* Thursday, April 09, 2015 2:57 AM
> *To:* mesa-dev at lists.freedesktop.org
> <mailto:mesa-dev at lists.freedesktop.org>
> *Subject:* [Mesa-dev] Problem with LLVM on Windows with MSVC____
>
> ____
>
> Hi,____
>
> ____
>
> I'm trying to build mesa on windows (MSVC) with gles support and
> with llvm.____
>
> Here are the keys I'm using:____
>
> scons.py gles=yes llvm=yes platform=windows libgl-gd____
>
> ____
>
> I'm getting a bunch of errors like this:____
>
> ____
>
> LLVMCore.lib(ValueSymbolTable.obj) : error LNK2038: mismatch
> detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't
> match value 'MTd_StaticDebug' in mesa.lib(uniform_query.obj)____
>
> ____
>
> I understand that this is due to mismatch between the runtime
> libraries, but I don't know how to fix it.____
>
> Should I change the CRT in llvm or in mesa? How should I do that? ____
>
> ____
>
> Thanks, ____
>
> Shervin ____
>
> ____
>
> ____
>
> ____
>
> ____
>
> ____
>
> __ __
>
>
More information about the mesa-dev
mailing list