windows compilation failed

Discussion and help for Compilation problems and platform portability.

Moderator: coordinators

windows compilation failed

Postby Rom1 » Fri Nov 04, 2011 11:23 am

Hello,

I spend a lot of time trying to compile luxrender in another workstation.

I got a problem with "Yacc'ing" and "lexing"
It failled and I got the error :

1>bison: m4: Invalid argument

(same with lex after fixing this one)

I solve it by changing two files : (on windows\support\bin)

bison_on_path.bat
flex_on_path.bat

I inverted
set PATH=%PATH%;%LUX_WINDOWS_BUILD_ROOT%\support\bin\
by
set PATH=%LUX_WINDOWS_BUILD_ROOT%\support\bin\;%PATH%

explication : Probably I could have another version of bison on my path for another tool. When MSVC want to launch bison it found the first one on the path and that's the wrong one.
by setting LUX_ROOT at first i'm sure to have the good one.

I suggest to patch the repository


Second error

"Error spawning 'cmd.exe'"

corrected with this page for example : http://social.msdn.microsoft.com/Forums ... b047d9376/

Must be done on each workstation ...
Rom1
Developer
 
Posts: 100
Joined: Thu Feb 04, 2010 7:18 am

Re: windows compilation failed

Postby Rom1 » Wed Feb 01, 2012 2:56 pm

News from my compilation problems ...

I patched getdeps to check if all dependencies have been installed properly.

Because it would be difficult to understand why it don't want to compile.


Second part : I tried to use cmake on windows ...

I don't know how to proced, I just want to have my VS project files up to date regarding the cmake files.

explanation : I have some patchs on my mercurial repo that add files, if I want to add or remove them I need to add or remove the file in the project.

I think cmake can read the cmake files and re-generate the VS project files.

So I can just "update and compile" ;)




Code: Select all
add verification if getdeps fail

diff -r c3ce28b81f50 -r d9b093fbf839 build-deps-x64.bat
--- a/build-deps-x64.bat   Thu Sep 22 16:42:05 2011 +0200
+++ b/build-deps-x64.bat   Mon Jan 16 11:57:01 2012 +0100
@@ -53,6 +53,42 @@
   echo %%LUX_X64_ZLIB_ROOT%% not valid! Aborting.
   exit /b -1
)
+IF NOT EXIST %LUX_X64_OCL_LIBS% (
+   echo.
+   echo %%LUX_X64_OCL_LIBS%% not valid! Aborting.
+   exit /b -1
+)
+IF NOT EXIST %LUX_X64_OCL_INCLUDE% (
+   echo.
+   echo %%LUX_X64_OCL_INCLUDE%% not valid! Aborting.
+   exit /b -1
+)
+IF NOT EXIST %LUX_X64_GLUT_LIBS% (
+   echo.
+   echo %%LUX_X64_GLUT_LIBS%% not valid! Aborting.
+   exit /b -1
+)
+IF NOT EXIST %LUX_X64_GLUT_INCLUDE% (
+   echo.
+   echo %%LUX_X64_GLUT_INCLUDE%% not valid! Aborting.
+   exit /b -1
+)
+IF NOT EXIST %LUX_X64_GLEW_LIBS% (
+   echo.
+   echo %%LUX_X64_GLEW_LIBS%% not valid! Aborting.
+   exit /b -1
+)
+IF NOT EXIST %LUX_X64_GLEW_BIN% (
+   echo.
+   echo %%LUX_X64_GLEW_BIN%% not valid! Aborting.
+   exit /b -1
+)
+IF "x%LUX_X64_GLEW_LIBNAME%" == "x" (
+   echo.
+   echo %%LUX_X64_GLEW_LIBNAME%% not valid! Aborting.
+   exit /b -1
+)
+

msbuild /? > nul
if NOT ERRORLEVEL 0 (
Rom1
Developer
 
Posts: 100
Joined: Thu Feb 04, 2010 7:18 am

Re: windows compilation failed

Postby Lord Crc » Fri Feb 03, 2012 8:56 am

Sorry for the delayed response, unless someone beats me to it I'll post a proper answer tonight.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

Re: windows compilation failed

Postby Rom1 » Tue Feb 21, 2012 1:56 pm

So ...

I think you've been busy ;)
Rom1
Developer
 
Posts: 100
Joined: Thu Feb 04, 2010 7:18 am

Re: windows compilation failed

Postby Lord Crc » Wed Feb 22, 2012 8:29 pm

So sorry :oops: My memory isn't as sticky as it used to be...

I've got two "specialized config" files, you can find them in the cmake/SpecializedConfig subdirectory of both lux and luxrays, named Config_LordCrc2008.cmake. There you specify the path to all the dependencies. Note in the config for lux that I have an include directory in dependency folder for the "unistd.h", you can find this file in the "windows" repository.

I have the following directory layout:
Code: Select all
root/build
root/lux
root/luxrays


where lux and luxrays are the respective repositories.

For building luxrays I use the following in the luxrays directory:
Code: Select all
del CMakeCache.txt && cmake -DLUXRAYS_CUSTOM_CONFIG=Config_LordCrc2008 -DBUILD_LUXMARK=OFF

This should produce a "LuxRays.sln" file, which you can use to compile luxrays (can't recall the command line to do so right now). The LUXRAYS_CUSTOM_CONFIG parameter is the name of the config file, minus the cmake extension.

For building lux run cmake from the build directory as follows:
Code: Select all
del CMakeCache.txt && cmake -DLUX_CUSTOM_CONFIG=Config_LordCrc2008 -G "Visual Studio 9 2008 Win64" ..\lux

This should yield "lux.sln".

There was some issue with cmake though, which prevented the linking from succeeding. I'll try to dig up the relevant info tomorrow, you have to manually set a flag or two in the "lux.sln" file.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

Re: windows compilation failed

Postby Lord Crc » Wed Feb 22, 2012 9:03 pm

I've just pushed a few changes to the luxrays cmake stuff which I had forgotten to push earlier.

Lord Crc wrote:There was some issue with cmake though, which prevented the linking from succeeding. I'll try to dig up the relevant info tomorrow, you have to manually set a flag or two in the "lux.sln" file.


Ah I recalled slightly wrong. The default will build a shared version using lux.dll. If you want to build a static version (or luxconsole etc) you'll have to modify the cmake file and unfortunately modify the generated project files manually. However I suspect you can use the "patch" tool to modify the project files, you just need to force two flags to "yes".

Here's how to modify for linking liblux statically:
In lux/CMakeLists.txt around line 398 change
Code: Select all
   ADD_DEFINITIONS(-DLUX_DLL)
   SET(LUX_LIBRARY luxShared)

to
Code: Select all
   #ADD_DEFINITIONS(-DLUX_DLL)
   SET(LUX_LIBRARY luxStatic)

then run cmake as above. Open the solution file, and for each "final" project you want to build (ie not luxShared or luxStatic), right click -> properties -> Linker -> General. Then set "Link Library Dependencies" and "Use Library Dependency Inputs" to "Yes". Then build as normal.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

Re: windows compilation failed

Postby Chawl » Mon Mar 19, 2012 2:52 pm

I got this when I tried to compile ad8af80e6fb1 on VS2008 SP1 Win7 64bit. 128247ecea5a (parent) was OK.

Sorry if I hijacked the thread btw. Tx.

Code: Select all
1>------ Build started: Project: liblux, Configuration: Release x64 ------
1>Compiling...
1>sqbvhaccel.cpp
1>..\..\..\lux\accelerators\sqbvhaccel.cpp(182) : error C2782: 'const _Ty &std::max(const _Ty &,const _Ty &)' : template parameter '_Ty' is ambiguous
1>        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility(3382) : see declaration of 'std::max'
1>        could be 'boost::int32_t'
1>        or       'int'
1>..\..\..\lux\accelerators\sqbvhaccel.cpp(182) : error C2780: 'const _Ty &std::max(const _Ty &,const _Ty &,_Pr)' : expects 3 arguments - 2 provided
1>        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility(3390) : see declaration of 'std::max'
1>..\..\..\lux\accelerators\sqbvhaccel.cpp(206) : error C2782: 'const _Ty &std::max(const _Ty &,const _Ty &)' : template parameter '_Ty' is ambiguous
1>        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility(3382) : see declaration of 'std::max'
1>        could be 'boost::int32_t'
1>        or       'int'
1>..\..\..\lux\accelerators\sqbvhaccel.cpp(206) : error C2780: 'const _Ty &std::max(const _Ty &,const _Ty &,_Pr)' : expects 3 arguments - 2 provided
1>        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility(3390) : see declaration of 'std::max'
1>Build log was saved at "file://c:\Users\Cagil\Desktop\LR\windows\Projects\luxrender\BuildTemp\liblux\x64\Release\BuildLog.htm"
1>liblux - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
Chawl
 
Posts: 71
Joined: Fri May 14, 2010 7:52 pm
Location: Ankara, Turkey

Re: windows compilation failed

Postby Rom1 » Mon Mar 19, 2012 2:58 pm

There is probably a redefinition of "max(a,b)" in sqbvhaccel

look in the .h or .cpp if there is something like that.

or something included.

sorry I don't have more time to check :(
Rom1
Developer
 
Posts: 100
Joined: Thu Feb 04, 2010 7:18 am

Re: windows compilation failed

Postby Chawl » Mon Mar 19, 2012 3:57 pm

I can't find a declaration or template problem, then I omitted std::max and made a dirty hack like this:

Code: Select all
const int32_t pi = parentIndex > 0 ? parentIndex : 0;


on sqbvhaccel.cpp(182) and sqbvhaccel.cpp(206).
Chawl
 
Posts: 71
Joined: Fri May 14, 2010 7:52 pm
Location: Ankara, Turkey

Re: windows compilation failed

Postby Dade » Tue Mar 20, 2012 3:39 am

Chawl wrote:I can't find a declaration or template problem, then I omitted std::max and made a dirty hack like this:


It is just the Visual C++ to be not very clever: you can fix the problem with a "max<int32_t>(a, b)". I pushed a patch for this problem.
User avatar
Dade
Developer
 
Posts: 4795
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

Next

Return to Compilation & Portability

Who is online

Users browsing this forum: No registered users and 1 guest