niessner / Opt

Opt DSL
Other
254 stars 68 forks source link

How to build Opt on Windows 10 #164

Open mush881212 opened 2 years ago

mush881212 commented 2 years ago

Hello,

I am not familiar with building package. I checked out the Readme, but I still have no idea how to build Opt on windows 10, and I want to use it with VS2019.

Currently I download terra and unzip it to the "terra" folder (as the readme said). Then I run the buildOpt.bat with command line tool "x86_64 Cross Tools Command Prompt for VS 2019". The output is as bellow:

C:\DF\Optlang\Opt\API>buildOpt.bat C:\DF\Optlang\Opt\API>set OPT_DIR=C:\DF\Optlang\Opt\API\ C:\DF\Optlang\Opt\API>"C:\DF\Optlang\Opt\API\common\optMake.bat" "C:\DF\Optlang\Opt\API\....\terra" "C:\DF\Optlang\Opt\API\." "false" C:\DF\Optlang\Opt\API>echo Remaking Opt.dll Remaking Opt.dll C:\DF\Optlang\Opt\API>set TERRAHOME="C:\DF\Optlang\Opt\API\....\terra" C:\DF\Optlang\Opt\API>set TERRA="C:\DF\Optlang\Opt\API\....\terra"\bin\terra C:\DF\Optlang\Opt\API>set OPT_DIR="C:\DF\Optlang\Opt\API\." C:\DF\Optlang\Opt\API>set OPT_FULL_BUILD="false" C:\DF\Optlang\Opt\API>"C:\DF\Optlang\Opt\API\....\terra"\bin\terra "C:\DF\Optlang\Opt\API\."\src\createWrapper.t Opt "C:\DF\Optlang\Opt\API\."\src o "C:\DF\Optlang\Opt\API\."\release\include\Opt.h .\Opt.dll "false" D:/a/terra/terra/src/terralib.lua:2917: Errors reported during typechecking. C:\DF\Optlang\Opt\API\.\src\createWrapper.t:130: structural cast invalid, result structure has no key usemcjit var o = C.terra_Options { verbose = 0, debug = 1, usemcjit = 1 } ^ stack traceback: [C]: in function 'error' D:/a/terra/terra/src/terralib.lua:396: in function 'finishandabortiferrors' D:/a/terra/terra/src/terralib.lua:2058: in function 'invokeuserfunction' D:/a/terra/terra/src/terralib.lua:2917: in function 'docheck' D:/a/terra/terra/src/terralib.lua:3120: in function 'checkexp' D:/a/terra/terra/src/terralib.lua:2774: in function 'docheck' D:/a/terra/terra/src/terralib.lua:3120: in function 'fn' D:/a/terra/terra/src/terralist.lua:150: in function 'map' D:/a/terra/terra/src/terralib.lua:2572: in function 'docheck' D:/a/terra/terra/src/terralib.lua:3120: in function 'checkexp' D:/a/terra/terra/src/terralib.lua:3138: in function 'checkcond' D:/a/terra/terra/src/terralib.lua:3149: in function 'fn' D:/a/terra/terra/src/terralist.lua:150: in function 'map' D:/a/terra/terra/src/terralib.lua:3293: in function 'checksingle' D:/a/terra/terra/src/terralib.lua:3344: in function 'checkstmts' D:/a/terra/terra/src/terralib.lua:3229: in function 'checkblock' D:/a/terra/terra/src/terralib.lua:3428: in function 'typecheck' D:/a/terra/terra/src/terralib.lua:1172: in function 'defineobjects' C:\DF\Optlang\Opt\API\.\src\createWrapper.t:124: in main chunk

I got the error in createWrapper.t:130, is somebody know how to fix it, or if I miss some steps? Thank you for your help!

yys123456 commented 2 years ago

Have you solved it? I deleted the usemcjit = 1 and it could generate lib and dll file properly you can check this link https://github.com/terralang/terra/tree/master/release/include/terra and It says usemcjit is mandatory now.

yys123456 commented 2 years ago

@mush881212 But currently, I came across this problem on rtx2060 cuda11.1 vs2017, and still can't get it to work

.\util.t:874: cuModuleLoadData: cuda reported error 218: a PTX JIT compilation failed
stack traceback:
        [C]: in function 'error'
        [string "<string>"]:250: in function 'cudacompile'
        .\util.t:874: in function 'makeGPUFunctions'
        .\solverGPUGaussNewton.t:762: in function 'compilePlan'
        .\o.t:870: in function <.\o.t:862>
        [C]: in function 'xpcall'
        .\o.t:862: in function <.\o.t:861>

(but it worked on my laptop with MX150 card, cuda9.2, vs2017)