Re: Compiling OpenShadingLanguage under Windows

Wormszer <worm...@...>

Thanks Oleg,

I am using flex 2.5.35 and bison 2.3 in cygwin 1.7.

I am pretty sure that my flex version is newer even though the version number is earlier. But im not sure about bison.
I have the GNUwin32 versions as well and tried those before. Most of the issues I had were in the flexer.h.

Hmm, I had a issue with that version of bison or flex i don't remember which that it wouldn't work with spaces in the file path when it called m4 internally.
Also I had to make sure my environment variables were defined using slashes and not backslashes otherwise CMake gave some errors.

Did you have an nparams() error in olsquerry? I am getting a linking error saying it can't find it.
Even though its looks like it should be able to find it. I will have to look closer at it and see why.

Other linker errors I had after defining R_OK were a boost library being linked twice and a missing tbb.lib.
The library errors i think come from cmake rather than vs2008. I didn't see a obvious reference to the tbb.lib in the project settings I wonder if there is a #pragma somewhere asking for it.

The error I am getting on olscomp for hash_map is

1>        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xhash(648) : while compiling class template member function 'std::list<_Ty,_Ax>::_Const_iterator<_Secure_validation> stdext::_Hash<_Traits>::lower_bound(const ustring &) const'
1>        with
1>        [
1>            _Ty=std::pair<const ustring,OSL::pvt::Symbol *>,
1>            _Ax=std::allocator<std::pair<const ustring,OSL::pvt::Symbol *>>,
1>            _Secure_validation=true,
1>            _Traits=stdext::_Hmap_traits<ustring,OSL::pvt::Symbol *,ustringHash,std::allocator<std::pair<const ustring,OSL::pvt::Symbol *>>,false>
1>        ]
1>        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\hash_map(88) : see reference to class template instantiation 'stdext::_Hash<_Traits>' being compiled
1>        with
1>        [
1>            _Traits=stdext::_Hmap_traits<ustring,OSL::pvt::Symbol *,ustringHash,std::allocator<std::pair<const ustring,OSL::pvt::Symbol *>>,false>
1>        ]
1>        d:\projects\graphics\oslproject\osl\src\liboslcomp\symtab.h(258) : see reference to class template instantiation 'stdext::hash_map<_Kty,_Ty,_Tr>' being compiled
1>        with
1>        [
1>            _Kty=ustring,
1>            _Ty=OSL::pvt::Symbol *,
1>            _Tr=ustringHash
1>        ]
1>C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xhash(654) : error C3849: function-style call on an expression of type 'const ustringHash' would lose const and/or volatile qualifiers for all 2 available operator overloads

I was hoping SP1 might of corrected something in the stdext::hash_map but it didn't seem to help.

I haven't dug in really deep yet to track down exactly whats going on yet. I will probably try and do that later tonight.

I am running Windows 7 x64 and using the project files generated from CMake 2.8.0.


On Sun, Jan 17, 2010 at 5:39 PM, Oleg <ode...@...> wrote:
Hi Jeremy,

I'm using the following versions of flex/bison:

 - flex,    GnuWin32 distribution, version 2.5.4
 - bison, GnuWin32 distribution, version 2.4.1

and having the same problems. I have simply commented out <unistd.h>
includes and compiled the corresponding files again. The another
problem is that this flex version cannot use slashes as path separator
for generated files, so I have replaced slashes by backslashes for
every flex file.

The "access" function is defined in "io.h" header file under Windows,
so I have changed the "oslquery.cpp" file as follows:

#ifdef __unix__
   #include <unistd.h>
   #define EXIST F_OK
   #define EXEC  X_OK
   #define WRITE W_OK
   #define READ  R_OK
   #include <io.h>
   #define EXIST 00
   #define EXEC  01
   #define WRITE 02
   #define READ  04

The "hash_map" class is defined in "stdext" namespace under Windows/VS
2008. I think you can use it without SP1, but I'm not sure.


On 17 Jan., 22:52, wormszer <wo...@...> wrote:
> I too have been trying to build under windows and ran across the same
> problem with the t variable.
> Assuming gcc allows it for some reason, by default is_closure() is
> false so that is what i set it too.
> I am having trouble with some includes particulary
> #include <unistd.h>
> I have one error in oslquery a missing R_OK which is defined i believe
> through this file.
> I can dig it up and add it but I think i will run into more problems
> later on in the other projects.
> I am also getting a hash_map error when building oslcomp.
> What version of flex and bison are you using? I had found a gnuwin32
> builds of both but flex was pretty out of date.
> I have installed cygwin to use the latest versions from there to run
> flex and bison. Which generates files that have better includes
> <iostream> vs <iostream.h> etc.
> Hopefully we can get this figured out.
> I am using visual studio 2008 as well. I just realized i might not
> have sp1. I will update and see if that helps at all.
> Thanks
> Jeremy

You received this message because you are subscribed to the Google Groups "OSL Developers" group.
To post to this group, send email to osl...@....
To unsubscribe from this group, send email to osl...@....
For more options, visit this group at

Join { to automatically receive all group messages.