Compiling OpenShadingLanguage under Windows


Oleg <ode...@...>
 

Hi All,

I'm trying to compile the OpenShadingLanguage library under Windows
using VisualStudio 2008. I was able to compile the following projects
so
far:
- oslquery
- oslinfo

There is a problem compiling the "oslgram.cpp" file generated by
bison.
The compiler complains that "TypeSpec" type used in "oslgram.y", line
274, is unknown:

Error 22 error C2065: 't' : undeclared identifier D:\Src
\OpenShadingLanguage\src\liboslcomp\oslgram.y 274

Error 23 error C2228: left of '.is_closure' must have class/
struct/union D:\Src\OpenShadingLanguage\src\liboslcomp\oslgram.y
274


Here is the corresponding code in "oslgram.y":

| simple_typename IDENTIFIER arrayspec initializer_list
{
TypeDesc simple = lextype ($1);
simple.arraylen = $3;
TypeSpec t (simple, t.is_closure
()); // <--- LINE 274
ASTvariable_declaration *var;
var = new ASTvariable_declaration (oslcompiler,
t,
ustring ($2), $4, false,
true /* ismeata */, false /
*output */,
true /* initializer list */);
$$ = var;
}
;

I'm not familiar with bison... Any help is welcome :-)

Regards,
Oleg


P.S.: It's great that Sony Pictures ImageWorks shares this technology!


Chris Foster <chri...@...>
 

On Sun, Jan 17, 2010 at 8:25 AM, Oleg <ode...@...> wrote:
| simple_typename IDENTIFIER arrayspec initializer_list
                {
                    TypeDesc simple = lextype ($1);
                    simple.arraylen = $3;
                    TypeSpec t (simple, t.is_closure
());                                        // <--- LINE 274
                    ASTvariable_declaration *var;
                    var = new ASTvariable_declaration (oslcompiler,
t,
                                     ustring ($2), $4, false,
                                     true /* ismeata */, false /
*output */,
                                     true /* initializer list */);
                    $$ = var;
                }
        ;

I'm not familiar with bison... Any help is welcome :-)
The chunk of code between the '{' and '}' is just C++ (mostly, except for the
$ markers of course). Looking at this, the line

TypeSpec t (simple, t.is_closure());

doesn't make any sense to me, since it appears to use t before it's constructed.
(Why does this even compile elsewhere? Maybe there's another variable t in the
scope?)

To me it seems this should be

TypeSpec t (simple, false);

since the metadata can never be a closure. I'm not an expert though (not by
any means!); does this sound right guys?

~Chris


Oleg <ode...@...>
 

Hi Chris,

Thank you very much for your reply. It works!

Here comes the next problem compiling the "osllex.cpp" file generated
by flex from "osllex.l" :-(

D:/Src/OpenShadingLanguage/src/liboslcomp/osllex.l(118) : error C2065:
'osllloc' : undeclared identifier



Here is the corresponding cpp code:

#define yylloc osllloc

void preprocess (const char *yytext);

// Macro that sets the yylloc line variables to the current parse
line.
#define SETLINE yylloc.first_line = yylloc.last_line = oslcompiler-
lineno()


And here is the lex code:

#define yylloc osllloc

void preprocess (const char *yytext);

// Macro that sets the yylloc line variables to the current parse
line.
#define SETLINE yylloc.first_line = yylloc.last_line = oslcompiler-
lineno()
%}


%%

/************************************************
* Lexical matching rules
************************************************/

/* preprocessor symbols */
{CPP} { preprocess (YYText()); SETLINE; } //
<--- LINE 118


wormszer <worm...@...>
 

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

On Jan 17, 8:23 am, Oleg <od...@...> wrote:
Hi Chris,

Thank you very much for your reply. It works!

Here comes the next problem compiling the "osllex.cpp" file generated
by flex from "osllex.l" :-(

D:/Src/OpenShadingLanguage/src/liboslcomp/osllex.l(118) : error C2065:
'osllloc' : undeclared identifier

Here is the corresponding cpp code:

#define yylloc osllloc

void preprocess (const char *yytext);

// Macro that sets the yylloc line variables to the current parse
line.
#define SETLINE yylloc.first_line = yylloc.last_line = oslcompiler-

lineno()
And here is the lex code:

#define yylloc osllloc

void preprocess (const char *yytext);

// Macro that sets the yylloc line variables to the current parse
line.
#define SETLINE yylloc.first_line = yylloc.last_line = oslcompiler-

lineno()
%}

%%

 /************************************************
  * Lexical matching rules
  ************************************************/

 /* preprocessor symbols */
{CPP}                   {  preprocess (YYText()); SETLINE; }             //
<--- LINE 118


Oleg <ode...@...>
 

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
#else
#include <io.h>
#define EXIST 00
#define EXEC 01
#define WRITE 02
#define READ 04
#endif

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.

Regards,
Oleg

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


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.

Jeremy


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
#else
   #include <io.h>
   #define EXIST 00
   #define EXEC  01
   #define WRITE 02
   #define READ  04
#endif

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.

Regards,
Oleg


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 http://groups.google.com/group/osl-dev?hl=en.





Wormszer <worm...@...>
 

Ok I was able to get
oslquery
oslinfo
oslcomp
oslc
all to build. I am still working on oslexec

Here is what I had to change to get it to build, see if these changes work for you or match what you figured out.


oslquery
==============================================================
Add include lib path for tbb lib.
I had to change
class DLLPUBLIC OSLQuery {
to
class DLLEXPORT OSLQuery {
I was having an issue where the __declspec(dllimport) was not allowing nparams to be called from the OSOReaderQuery class. I think this possibly has something to do with dllimport and inline functions.
I have not used dllimport when not importing from a library and from some quick reading i didn't see anything that stuck out as a possible issue other than inlining.


oslinfo
==============================================================
Add include lib path for tbb lib.


oslcomp
==============================================================
Add include lib path for tbb lib.

I was having an issue with some const operator() calls.
Digging in to the code the fix i found was here in ustring.h located in the OIIO includes
I had to add a const version of the hash/comparison operator. The non const version could probably be removed.

class ustringHash
#ifdef _WIN32
    : public hash_compare<ustring>
#endif
{
public:
    size_t operator() (const ustring &s) const { return s.hash(); }
#ifdef _WIN32
    bool operator() (const ustring &a, const ustring &b) {
        return strcmp (a.c_str(), b.c_str()) < 0;
    }
    bool operator() (const ustring &a, const ustring &b) const {
        return strcmp (a.c_str(), b.c_str()) < 0;
    }

#endif
};

That should allow for oslcomp to build.
But there were no symbols being exported from the library, so no lib was being generated.
So I changed oslcomp.h to export the OSLCompiler class borrowing the exports.h from the other libraries.
And a lib file is now generated.

#ifndef OSLCOMP_H
#define OSLCOMP_H

#include "export.h"

#ifdef OSL_NAMESPACE
namespace OSL_NAMESPACE {
#endif

namespace OSL {


class DLLEXPORT OSLCompiler {
public:


oslc
==============================================================
export symbols from oslcomp library


<unistd>
==============================================================
I use the following <unistd> file for the projects that need it.

#ifndef __STRICT_ANSI__

#include <io.h>
#include <process.h>

#define    F_OK    0
#define    R_OK    4
#define    W_OK    2
#define    X_OK    1

#endif

CMAKE
==============================================================
And there were various other CMake tweaks i had to make as well to get it to generate the project correctly and find some of the libraries.
I think the only change i was unsure why i had to make was I had to change the libsxxxx projects from LIBRARY to ARCHIVE. I'm not sure why.

oslexec
==============================================================
I am getting a lot of errors relating to the generated code and a ton of missing math functions it looks like. I will dig into this project next.


And then to see if it works after all this.
Let me know where you get.

Jeremy


On Sun, Jan 17, 2010 at 7:18 PM, Wormszer <worm...@...> wrote:
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.

Jeremy

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
#else
   #include <io.h>
   #define EXIST 00
   #define EXEC  01
   #define WRITE 02
   #define READ  04
#endif

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.

Regards,
Oleg


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 http://groups.google.com/group/osl-dev?hl=en.






Wormszer <worm...@...>
 

My generated code issues were from VS having not rebuilt the files with the new flex.

So now I am just left with a bunch of missing math functions.
It looks likes visual studios implementation of math. or cmath is missing a lot of the functions.

Things like
log2f, logbf, truncf, etc
and defines like M_E, M_1_PI, M_PI_2 etc.

See if you run into the same thing and then im not sure where to go from here.

I guess we should get some feedback from others, maybe they are available somewhere else, or I could be missing something.

Jeremy


On Sun, Jan 17, 2010 at 11:29 PM, Wormszer <worm...@...> wrote:
Ok I was able to get
oslquery
oslinfo
oslcomp
oslc
all to build. I am still working on oslexec

Here is what I had to change to get it to build, see if these changes work for you or match what you figured out.


oslquery
==============================================================
Add include lib path for tbb lib.
I had to change
class DLLPUBLIC OSLQuery {
to
class DLLEXPORT OSLQuery {
I was having an issue where the __declspec(dllimport) was not allowing nparams to be called from the OSOReaderQuery class. I think this possibly has something to do with dllimport and inline functions.
I have not used dllimport when not importing from a library and from some quick reading i didn't see anything that stuck out as a possible issue other than inlining.


oslinfo
==============================================================
Add include lib path for tbb lib.


oslcomp
==============================================================
Add include lib path for tbb lib.

I was having an issue with some const operator() calls.
Digging in to the code the fix i found was here in ustring.h located in the OIIO includes
I had to add a const version of the hash/comparison operator. The non const version could probably be removed.

class ustringHash
#ifdef _WIN32
    : public hash_compare<ustring>
#endif
{
public:
    size_t operator() (const ustring &s) const { return s.hash(); }
#ifdef _WIN32
    bool operator() (const ustring &a, const ustring &b) {
        return strcmp (a.c_str(), b.c_str()) < 0;
    }
    bool operator() (const ustring &a, const ustring &b) const {
        return strcmp (a.c_str(), b.c_str()) < 0;
    }

#endif
};

That should allow for oslcomp to build.
But there were no symbols being exported from the library, so no lib was being generated.
So I changed oslcomp.h to export the OSLCompiler class borrowing the exports.h from the other libraries.
And a lib file is now generated.

#ifndef OSLCOMP_H
#define OSLCOMP_H

#include "export.h"

#ifdef OSL_NAMESPACE
namespace OSL_NAMESPACE {
#endif

namespace OSL {


class DLLEXPORT OSLCompiler {
public:


oslc
==============================================================
export symbols from oslcomp library


<unistd>
==============================================================
I use the following <unistd> file for the projects that need it.

#ifndef __STRICT_ANSI__

#include <io.h>
#include <process.h>

#define    F_OK    0
#define    R_OK    4
#define    W_OK    2
#define    X_OK    1

#endif

CMAKE
==============================================================
And there were various other CMake tweaks i had to make as well to get it to generate the project correctly and find some of the libraries.
I think the only change i was unsure why i had to make was I had to change the libsxxxx projects from LIBRARY to ARCHIVE. I'm not sure why.

oslexec
==============================================================
I am getting a lot of errors relating to the generated code and a ton of missing math functions it looks like. I will dig into this project next.


And then to see if it works after all this.
Let me know where you get.

Jeremy



On Sun, Jan 17, 2010 at 7:18 PM, Wormszer <worm...@...> wrote:
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.

Jeremy

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
#else
   #include <io.h>
   #define EXIST 00
   #define EXEC  01
   #define WRITE 02
   #define READ  04
#endif

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.

Regards,
Oleg


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 http://groups.google.com/group/osl-dev?hl=en.







Chris Foster <chri...@...>
 

On Mon, Jan 18, 2010 at 2:51 PM, Wormszer <worm...@...> wrote:
My generated code issues were from VS having not rebuilt the files with the
new flex.

So now I am just left with a bunch of missing math functions.
It looks likes visual studios implementation of math. or cmath is missing a
lot of the functions.

Things like
log2f, logbf, truncf, etc
These are all C99 math functions, not available on windows I guess... I had a
look in boost (they implement some of the C99 functions there) but
unfortunately these ones aren't implemented yet :-(

It may be best to implement versions of these in a compatibility header for
platforms which don't have full C99 support yet. (Maybe there is a handy C99
math library under an appropriate license from which the functions can be
taken?)

and defines like M_E, M_1_PI, M_PI_2 etc.
The M_PI etc constants are nonstandard, but may be obtained on windows by
#defining _USE_MATH_DEFINES before you include math.h.

See if you run into the same thing and then im not sure where to go from
here.

I guess we should get some feedback from others, maybe they are available
somewhere else, or I could be missing something.
When you've got this figured out, it's best to submit a patch and one of the
developers will check it in, possibly after a few improvements have been made.

AFAIK there's no official guide yet for how to submit patches, but I'm going
to take a guess that the procedure won't be too much different from Larry's
other open source project, OIIO, apart from the use of codereview.appspot.com
for code reviews rather than the mailing list:

http://openimageio.org/wiki/index.php?title=Developing_OIIO


Cheers,
~Chris.


Wormszer <worm...@...>
 

Thanks Chris,

I got the defines included but after searching around and trying some various things I have been unable to find a solution to the missing math functions.

The closest I got was to using the boost library's, but they are missing two functions logbf and exp2f i believe.

I found implementations of them in the glibc but they are in assembly and need pre-processing first at least. And the licensing probably doesn't match up.
And then there is probably no guarantee VS assembler will like them.

I found a commercial implementation, but couldn't really find anything for windows open source.

So my best solutions so far is to use the boost libraries and then implementing the couple of missing functions.

But some kind of wrapper or library seems like it might be a good idea for speed or possible enhancements later on like gpu etc.

Jeremy


On Mon, Jan 18, 2010 at 12:32 AM, Chris Foster <chri...@...> wrote:
On Mon, Jan 18, 2010 at 2:51 PM, Wormszer <worm...@...> wrote:
> My generated code issues were from VS having not rebuilt the files with the
> new flex.
>
> So now I am just left with a bunch of missing math functions.
> It looks likes visual studios implementation of math. or cmath is missing a
> lot of the functions.
>
> Things like
> log2f, logbf, truncf, etc

These are all C99 math functions, not available on windows I guess...  I had a
look in boost (they implement some of the C99 functions there) but
unfortunately these ones aren't implemented yet :-(

It may be best to implement versions of these in a compatibility header for
platforms which don't have full C99 support yet.  (Maybe there is a handy C99
math library under an appropriate license from which the functions can be
taken?)

> and defines like M_E, M_1_PI, M_PI_2 etc.

The M_PI etc constants are nonstandard, but may be obtained on windows by
#defining _USE_MATH_DEFINES before you include math.h.

> See if you run into the same thing and then im not sure where to go from
> here.
>
> I guess we should get some feedback from others, maybe they are available
> somewhere else, or I could be missing something.

When you've got this figured out, it's best to submit a patch and one of the
developers will check it in, possibly after a few improvements have been made.

AFAIK there's no official guide yet for how to submit patches, but I'm going
to take a guess that the procedure won't be too much different from Larry's
other open source project, OIIO, apart from the use of codereview.appspot.com
for code reviews rather than the mailing list:

http://openimageio.org/wiki/index.php?title=Developing_OIIO


Cheers,
~Chris.

--
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 http://groups.google.com/group/osl-dev?hl=en.





Oleg <ode...@...>
 

Hi Jeremy,

I have installed the latest cygwin version and was able to process all
flex/bison files. The cygwin flex version can handle "/" as path
separator, too :-) Apart from that I had the same problems compiling
"oslinfo", "oslquery", "oslcomp" and "exec" projects. I have found c99
macro definitions

here http://lists.boost.org/Archives/boost/2005/12/97593.php

and

here http://www.gamedev.net/community/forums/topic.asp?topic_id=127944

Maybe we can use CUDA or OpenCL (which is better, since available on
NVIDIA/ATI) for all missing math functions. Please see

- http://developer.download.nvidia.com/compute/cuda/2_3/toolkit/docs/NVIDIA_CUDA_Programming_Guide_2.3.pdf,
page 120
- http://www.khronos.org/registry/cl/specs/opencl-1.0.43.pdf?q=specification,
page 168

Regards,
Oleg

On 18 Jan., 05:51, Wormszer <wo...@...> wrote:
My generated code issues were from VS having not rebuilt the files with the
new flex.

So now I am just left with a bunch of missing math functions.
It looks likes visual studios implementation of math. or cmath is missing a
lot of the functions.

Things like
log2f, logbf, truncf, etc
and defines like M_E, M_1_PI, M_PI_2 etc.

See if you run into the same thing and then im not sure where to go from
here.

I guess we should get some feedback from others, maybe they are available
somewhere else, or I could be missing something.

Jeremy


Wormszer <worm...@...>
 

I tried the first link you mention but i end up with a different set of errors.

What did you do to get it working? I will play with it some more and see.

I got the defines enabled by defining the _USE_MATH_DEFINES like Chris mentioned and mentioned in the second link.

I agree on trying to use something like open CL. Do they provide CPU implementations for all the math functions?
But to take advantage of the real gpu speed up we would need to do it somewhere else where things can be batched.

I hope once i get this building to dig in and figure out what is going on in the shader execution and language parsing. With my goal trying to help with getting some kind of GPU based shader preview implementation going as mentioned in Larry's introduction.
Open CL I would think should be a good language to shoot towards as I am under the impression its supposed to replace nvidias cuda and ati's brook stream stuff. Or at least both vendors will support it.

Jeremy

On Mon, Jan 18, 2010 at 6:19 PM, Oleg <ode...@...> wrote:
Hi Jeremy,

I have installed the latest cygwin version and was able to process all
flex/bison files. The cygwin flex version can handle "/" as path
separator, too :-) Apart from that I had the same problems compiling
"oslinfo", "oslquery", "oslcomp" and "exec" projects. I have found c99
macro definitions

here    http://lists.boost.org/Archives/boost/2005/12/97593.php

and

here    http://www.gamedev.net/community/forums/topic.asp?topic_id=127944

Maybe we can use CUDA or OpenCL (which is better, since available on
NVIDIA/ATI) for all missing math functions. Please see

- http://developer.download.nvidia.com/compute/cuda/2_3/toolkit/docs/NVIDIA_CUDA_Programming_Guide_2.3.pdf,
page 120
- http://www.khronos.org/registry/cl/specs/opencl-1.0.43.pdf?q=specification,
page 168

Regards,
Oleg


On 18 Jan., 05:51, Wormszer <wo...@...> wrote:
> My generated code issues were from VS having not rebuilt the files with the
> new flex.
>
> So now I am just left with a bunch of missing math functions.
> It looks likes visual studios implementation of math. or cmath is missing a
> lot of the functions.
>
> Things like
> log2f, logbf, truncf, etc
> and defines like M_E, M_1_PI, M_PI_2 etc.
>
> See if you run into the same thing and then im not sure where to go from
> here.
>
> I guess we should get some feedback from others, maybe they are available
> somewhere else, or I could be missing something.
>
> 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 http://groups.google.com/group/osl-dev?hl=en.





Wormszer <worm...@...>
 

After looking at ATI's open cl I think its a little bit overkill. From initial look i think we would have to create kernels for each math function we wanted as well as create an open cl context to make use the the language features defined in the Open CL spec.

For doing a gpu version of a shader this might work but as a stand-in for the C99 math i don't think it would be a good solution.

Jeremy


On Mon, Jan 18, 2010 at 8:58 PM, Wormszer <worm...@...> wrote:
I tried the first link you mention but i end up with a different set of errors.

What did you do to get it working? I will play with it some more and see.

I got the defines enabled by defining the _USE_MATH_DEFINES like Chris mentioned and mentioned in the second link.

I agree on trying to use something like open CL. Do they provide CPU implementations for all the math functions?
But to take advantage of the real gpu speed up we would need to do it somewhere else where things can be batched.

I hope once i get this building to dig in and figure out what is going on in the shader execution and language parsing. With my goal trying to help with getting some kind of GPU based shader preview implementation going as mentioned in Larry's introduction.
Open CL I would think should be a good language to shoot towards as I am under the impression its supposed to replace nvidias cuda and ati's brook stream stuff. Or at least both vendors will support it.

Jeremy

On Mon, Jan 18, 2010 at 6:19 PM, Oleg <ode...@...> wrote:
Hi Jeremy,

I have installed the latest cygwin version and was able to process all
flex/bison files. The cygwin flex version can handle "/" as path
separator, too :-) Apart from that I had the same problems compiling
"oslinfo", "oslquery", "oslcomp" and "exec" projects. I have found c99
macro definitions

here    http://lists.boost.org/Archives/boost/2005/12/97593.php

and

here    http://www.gamedev.net/community/forums/topic.asp?topic_id=127944

Maybe we can use CUDA or OpenCL (which is better, since available on
NVIDIA/ATI) for all missing math functions. Please see

- http://developer.download.nvidia.com/compute/cuda/2_3/toolkit/docs/NVIDIA_CUDA_Programming_Guide_2.3.pdf,
page 120
- http://www.khronos.org/registry/cl/specs/opencl-1.0.43.pdf?q=specification,
page 168

Regards,
Oleg


On 18 Jan., 05:51, Wormszer <wo...@...> wrote:
> My generated code issues were from VS having not rebuilt the files with the
> new flex.
>
> So now I am just left with a bunch of missing math functions.
> It looks likes visual studios implementation of math. or cmath is missing a
> lot of the functions.
>
> Things like
> log2f, logbf, truncf, etc
> and defines like M_E, M_1_PI, M_PI_2 etc.
>
> See if you run into the same thing and then im not sure where to go from
> here.
>
> I guess we should get some feedback from others, maybe they are available
> somewhere else, or I could be missing something.
>
> 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 http://groups.google.com/group/osl-dev?hl=en.






Chris Foster <chri...@...>
 

On Tue, Jan 19, 2010 at 2:48 PM, Wormszer <worm...@...> wrote:
For doing a gpu version of a shader this might work
A GPU only version is definitely interesting, but a very big job :)

but as a stand-in for
the C99 math i don't think it would be a good solution.
Heck no! Instead I imagine that most of the functions can be easily
implemented in terms of existing C89 functionality. For instance, AFAIK the
double version of log2 exists in C89, so

float log2f(float x) { return log2(x); }

even if I'm mistaken, natural log definitely exists, so you could use
something like

float log2f(float x)
{
// log2(x) = log(x)/log(2) ~= 1.4426950408889633 * log(x)
return 1.4426950408889633 * log(x);
}

~Chris.


Larry Gritz <l...@...>
 

You're quite right, Chris. I think this is just a bad cut-and-paste from the distant past and was never symptomatic, but definitely is wrong.

-- lg


On Jan 16, 2010, at 2:50 PM, Chris Foster wrote:
The chunk of code between the '{' and '}' is just C++ (mostly, except for the
$ markers of course). Looking at this, the line

TypeSpec t (simple, t.is_closure());

doesn't make any sense to me, since it appears to use t before it's constructed.
(Why does this even compile elsewhere? Maybe there's another variable t in the
scope?)

To me it seems this should be

TypeSpec t (simple, false);

since the metadata can never be a closure. I'm not an expert though (not by
any means!); does this sound right guys?
--
Larry Gritz
l...@...


Larry Gritz <l...@...>
 

Sorry about joining this thread late.

I think that any files that need these functions should 

  #include <OpenImageIO/fmath.h>

where many of these symbols and some of the missing functions are defined.  See fmath.h circa line 70 for M_PI and the like, and circa line 690 for log2f.  If there are more missing functions, we should add them to fmath.h (inside the '#ifdef _WIN32' near where log2f is defined).

-- lg


On Jan 17, 2010, at 8:51 PM, Wormszer wrote:

My generated code issues were from VS having not rebuilt the files with the new flex.

So now I am just left with a bunch of missing math functions.
It looks likes visual studios implementation of math. or cmath is missing a lot of the functions.

Things like
log2f, logbf, truncf, etc
and defines like M_E, M_1_PI, M_PI_2 etc.

See if you run into the same thing and then im not sure where to go from here.

I guess we should get some feedback from others, maybe they are available somewhere else, or I could be missing something.

Jeremy


On Sun, Jan 17, 2010 at 11:29 PM, Wormszer <worm...@...> wrote:
Ok I was able to get
oslquery
oslinfo
oslcomp
oslc
all to build. I am still working on oslexec

Here is what I had to change to get it to build, see if these changes work for you or match what you figured out.


oslquery
==============================================================
Add include lib path for tbb lib.
I had to change
class DLLPUBLIC OSLQuery {
to
class DLLEXPORT OSLQuery {
I was having an issue where the __declspec(dllimport) was not allowing nparams to be called from the OSOReaderQuery class. I think this possibly has something to do with dllimport and inline functions.
I have not used dllimport when not importing from a library and from some quick reading i didn't see anything that stuck out as a possible issue other than inlining.


oslinfo
==============================================================
Add include lib path for tbb lib.


oslcomp
==============================================================
Add include lib path for tbb lib.

I was having an issue with some const operator() calls.
Digging in to the code the fix i found was here in ustring.h located in the OIIO includes
I had to add a const version of the hash/comparison operator. The non const version could probably be removed.

class ustringHash
#ifdef _WIN32
    : public hash_compare<ustring>
#endif
{
public:
    size_t operator() (const ustring &s) const { return s.hash(); }
#ifdef _WIN32
    bool operator() (const ustring &a, const ustring &b) {
        return strcmp (a.c_str(), b.c_str()) < 0;
    }
    bool operator() (const ustring &a, const ustring &b) const {
        return strcmp (a.c_str(), b.c_str()) < 0;
    }

#endif
};

That should allow for oslcomp to build.
But there were no symbols being exported from the library, so no lib was being generated.
So I changed oslcomp.h to export the OSLCompiler class borrowing the exports.h from the other libraries.
And a lib file is now generated.

#ifndef OSLCOMP_H
#define OSLCOMP_H

#include "export.h"

#ifdef OSL_NAMESPACE
namespace OSL_NAMESPACE {
#endif

namespace OSL {


class DLLEXPORT OSLCompiler {
public:


oslc
==============================================================
export symbols from oslcomp library


<unistd>
==============================================================
I use the following <unistd> file for the projects that need it.

#ifndef __STRICT_ANSI__

#include <io.h>
#include <process.h>

#define    F_OK    0
#define    R_OK    4
#define    W_OK    2
#define    X_OK    1

#endif

CMAKE
==============================================================
And there were various other CMake tweaks i had to make as well to get it to generate the project correctly and find some of the libraries.
I think the only change i was unsure why i had to make was I had to change the libsxxxx projects from LIBRARY to ARCHIVE. I'm not sure why.

oslexec
==============================================================
I am getting a lot of errors relating to the generated code and a ton of missing math functions it looks like. I will dig into this project next.


And then to see if it works after all this.
Let me know where you get.

Jeremy



On Sun, Jan 17, 2010 at 7:18 PM, Wormszer <worm...@...> wrote:
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.

Jeremy

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
#else
   #include <io.h>
   #define EXIST 00
   #define EXEC  01
   #define WRITE 02
   #define READ  04
#endif

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.

Regards,
Oleg


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 http://groups.google.com/group/osl-dev?hl=en.






<ATT00001..htm>

--
Larry Gritz




Wormszer <worm...@...>
 

Thanks Larry,

I was wondering where the best place would be to add the missing functionality.
Currently I have used the boost C99 math libraries and the missing two functions logbf and exp2f i defined to 0.0f temporarily so I could see what other issues I would run into when building.
I will come back and try and work the missing math functions into fmath.h.

But I have run into a couple of other issues with the oslexec project and the TypeSpec class.

It seems that some of its functions are implemented in Symtab.cpp instead of TypeSpec.cpp specifically, c_str() and string(). I am not sure if this was on purpose or not.
On the oslexec project on windows this was causing linking issues. This project doesn't include symtab.cpp and they were not being exported from the oslcomp library. Including Symtab.cpp raises other errors.
So I moved these declarations into the TypeSpec.cpp file fixing the linking errors.

There is a similiar issue with Symbol::mangled () it was implemented in Symtab.cpp as well. I also moved this to TypeSpec.cpp to fix the errors But I am not sure if that is best place since its not as obvious as the TypeSpec functions.

I can now build oslexec and it did not seem to effect oslcomp.

Jeremy


On Tue, Jan 19, 2010 at 10:34 AM, Larry Gritz <l...@...> wrote:
Sorry about joining this thread late.

I think that any files that need these functions should 

  #include <OpenImageIO/fmath.h>

where many of these symbols and some of the missing functions are defined.  See fmath.h circa line 70 for M_PI and the like, and circa line 690 for log2f.  If there are more missing functions, we should add them to fmath.h (inside the '#ifdef _WIN32' near where log2f is defined).

-- lg


On Jan 17, 2010, at 8:51 PM, Wormszer wrote:

My generated code issues were from VS having not rebuilt the files with the new flex.

So now I am just left with a bunch of missing math functions.
It looks likes visual studios implementation of math. or cmath is missing a lot of the functions.

Things like
log2f, logbf, truncf, etc
and defines like M_E, M_1_PI, M_PI_2 etc.

See if you run into the same thing and then im not sure where to go from here.

I guess we should get some feedback from others, maybe they are available somewhere else, or I could be missing something.

Jeremy


On Sun, Jan 17, 2010 at 11:29 PM, Wormszer <worm...@...> wrote:
Ok I was able to get
oslquery
oslinfo
oslcomp
oslc
all to build. I am still working on oslexec

Here is what I had to change to get it to build, see if these changes work for you or match what you figured out.


oslquery
==============================================================
Add include lib path for tbb lib.
I had to change
class DLLPUBLIC OSLQuery {
to
class DLLEXPORT OSLQuery {
I was having an issue where the __declspec(dllimport) was not allowing nparams to be called from the OSOReaderQuery class. I think this possibly has something to do with dllimport and inline functions.
I have not used dllimport when not importing from a library and from some quick reading i didn't see anything that stuck out as a possible issue other than inlining.


oslinfo
==============================================================
Add include lib path for tbb lib.


oslcomp
==============================================================
Add include lib path for tbb lib.

I was having an issue with some const operator() calls.
Digging in to the code the fix i found was here in ustring.h located in the OIIO includes
I had to add a const version of the hash/comparison operator. The non const version could probably be removed.

class ustringHash
#ifdef _WIN32
    : public hash_compare<ustring>
#endif
{
public:
    size_t operator() (const ustring &s) const { return s.hash(); }
#ifdef _WIN32
    bool operator() (const ustring &a, const ustring &b) {
        return strcmp (a.c_str(), b.c_str()) < 0;
    }
    bool operator() (const ustring &a, const ustring &b) const {
        return strcmp (a.c_str(), b.c_str()) < 0;
    }

#endif
};

That should allow for oslcomp to build.
But there were no symbols being exported from the library, so no lib was being generated.
So I changed oslcomp.h to export the OSLCompiler class borrowing the exports.h from the other libraries.
And a lib file is now generated.

#ifndef OSLCOMP_H
#define OSLCOMP_H

#include "export.h"

#ifdef OSL_NAMESPACE
namespace OSL_NAMESPACE {
#endif

namespace OSL {


class DLLEXPORT OSLCompiler {
public:


oslc
==============================================================
export symbols from oslcomp library


<unistd>
==============================================================
I use the following <unistd> file for the projects that need it.

#ifndef __STRICT_ANSI__

#include <io.h>
#include <process.h>

#define    F_OK    0
#define    R_OK    4
#define    W_OK    2
#define    X_OK    1

#endif

CMAKE
==============================================================
And there were various other CMake tweaks i had to make as well to get it to generate the project correctly and find some of the libraries.
I think the only change i was unsure why i had to make was I had to change the libsxxxx projects from LIBRARY to ARCHIVE. I'm not sure why.

oslexec
==============================================================
I am getting a lot of errors relating to the generated code and a ton of missing math functions it looks like. I will dig into this project next.


And then to see if it works after all this.
Let me know where you get.

Jeremy



On Sun, Jan 17, 2010 at 7:18 PM, Wormszer <worm...@...> wrote:
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.

Jeremy

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
#else
   #include <io.h>
   #define EXIST 00
   #define EXEC  01
   #define WRITE 02
   #define READ  04
#endif

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.

Regards,
Oleg


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 http://groups.google.com/group/osl-dev?hl=en.






<ATT00001..htm>

--
Larry Gritz




--
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 http://groups.google.com/group/osl-dev?hl=en.



Oleg <ode...@...>
 

Hi Jeremy,

Using boost math functions, some definitions in fmath.h and the
following two implementations of my own

inline float
logbf(float val) {
// please see http://www.kernel.org/doc/man-pages/online/pages/man3/logb.3.html
return logf(val)/logf(FLT_RADIX);
}

inline float
exp2f(float val) {
// 2^val = e^(val*ln(2))
return exp( val*log(2.0f) );
}

I was able to compile it under Windows. It's not the best solution,
but probably better as nothing...

It's time to test it :-)

Regards,
Oleg

On 19 Jan., 19:08, Wormszer <wo...@...> wrote:
Thanks Larry,

I was wondering where the best place would be to add the missing
functionality.
Currently I have used the boost C99 math libraries and the missing two
functions logbf and exp2f i defined to 0.0f temporarily so I could see what
other issues I would run into when building.
I will come back and try and work the missing math functions into fmath.h.

But I have run into a couple of other issues with the oslexec project and
the TypeSpec class.

It seems that some of its functions are implemented in Symtab.cpp instead of
TypeSpec.cpp specifically, c_str() and string(). I am not sure if this was
on purpose or not.
On the oslexec project on windows this was causing linking issues. This
project doesn't include symtab.cpp and they were not being exported from the
oslcomp library. Including Symtab.cpp raises other errors.
So I moved these declarations into the TypeSpec.cpp file fixing the linking
errors.

There is a similiar issue with Symbol::mangled () it was implemented in
Symtab.cpp as well. I also moved this to TypeSpec.cpp to fix the errors But
I am not sure if that is best place since its not as obvious as the TypeSpec
functions.

I can now build oslexec and it did not seem to effect oslcomp.

Jeremy


Wormszer <worm...@...>
 

Great,

Did you encounter the same linking issues i mentioned?

Let me know how it works out for you.

I had tried compiling the shaders after making some changes to the project file for a path issues, but I didnt get any warnings or outputs from inside vs.
If I tried to run it from the command line, after finding all the dependencies, it gave me a could not find file error. It didn't seem to be a dll error but something else.

I plan to look into it more now.

Jeremy


On Tue, Jan 19, 2010 at 8:14 PM, Oleg <ode...@...> wrote:
Hi Jeremy,

Using boost math functions, some definitions in fmath.h and the
following two implementations of my own

inline float
logbf(float val) {
   // please see http://www.kernel.org/doc/man-pages/online/pages/man3/logb.3.html
   return logf(val)/logf(FLT_RADIX);
}

inline float
exp2f(float val) {
   // 2^val = e^(val*ln(2))
   return exp( val*log(2.0f) );
}

I was able to compile it under Windows. It's not the best solution,
but probably better as nothing...

It's time to test it :-)

Regards,
Oleg

On 19 Jan., 19:08, Wormszer <wo...@...> wrote:
> Thanks Larry,
>
> I was wondering where the best place would be to add the missing
> functionality.
> Currently I have used the boost C99 math libraries and the missing two
> functions logbf and exp2f i defined to 0.0f temporarily so I could see what
> other issues I would run into when building.
> I will come back and try and work the missing math functions into fmath.h.
>
> But I have run into a couple of other issues with the oslexec project and
> the TypeSpec class.
>
> It seems that some of its functions are implemented in Symtab.cpp instead of
> TypeSpec.cpp specifically, c_str() and string(). I am not sure if this was
> on purpose or not.
> On the oslexec project on windows this was causing linking issues. This
> project doesn't include symtab.cpp and they were not being exported from the
> oslcomp library. Including Symtab.cpp raises other errors.
> So I moved these declarations into the TypeSpec.cpp file fixing the linking
> errors.
>
> There is a similiar issue with Symbol::mangled () it was implemented in
> Symtab.cpp as well. I also moved this to TypeSpec.cpp to fix the errors But
> I am not sure if that is best place since its not as obvious as the TypeSpec
> functions.
>
> I can now build oslexec and it did not seem to effect oslcomp.
>
> 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 http://groups.google.com/group/osl-dev?hl=en.





"Pierre Saunier" <pierre...@...>
 

Dear all,

Isn't it possible to distribute the files produced by Flex and bison?
Normally, they should be independant from the system (they are produced on and they are
used on), and it will avoid a lot of trouble to build osl...
And if someone wants to recreate them, it is always possible!

When the doc about integrating OSL in an actual renderer will be available? At least some
sample code?

Regards,

Pierre

Great,

Did you encounter the same linking issues i mentioned?

Let me know how it works out for you.

I had tried compiling the shaders after making some changes to the project
file for a path issues, but I didnt get any warnings or outputs from inside
vs.
If I tried to run it from the command line, after finding all the
dependencies, it gave me a could not find file error. It didn't seem to be a
dll error but something else.

I plan to look into it more now.

Jeremy


On Tue, Jan 19, 2010 at 8:14 PM, Oleg <ode...@...> wrote:

Hi Jeremy,

Using boost math functions, some definitions in fmath.h and the
following two implementations of my own

inline float
logbf(float val) {
// please see
http://www.kernel.org/doc/man-pages/online/pages/man3/logb.3.html
return logf(val)/logf(FLT_RADIX);
}

inline float
exp2f(float val) {
// 2^val = e^(val*ln(2))
return exp( val*log(2.0f) );
}

I was able to compile it under Windows. It's not the best solution,
but probably better as nothing...

It's time to test it :-)

Regards,
Oleg

On 19 Jan., 19:08, Wormszer <wo...@...> wrote:
Thanks Larry,

I was wondering where the best place would be to add the missing
functionality.
Currently I have used the boost C99 math libraries and the missing two
functions logbf and exp2f i defined to 0.0f temporarily so I could see
what
other issues I would run into when building.
I will come back and try and work the missing math functions into
fmath.h.

But I have run into a couple of other issues with the oslexec project and
the TypeSpec class.

It seems that some of its functions are implemented in Symtab.cpp instead
of
TypeSpec.cpp specifically, c_str() and string(). I am not sure if this
was
on purpose or not.
On the oslexec project on windows this was causing linking issues. This
project doesn't include symtab.cpp and they were not being exported from
the
oslcomp library. Including Symtab.cpp raises other errors.
So I moved these declarations into the TypeSpec.cpp file fixing the
linking
errors.

There is a similiar issue with Symbol::mangled () it was implemented in
Symtab.cpp as well. I also moved this to TypeSpec.cpp to fix the errors
But
I am not sure if that is best place since its not as obvious as the
TypeSpec
functions.

I can now build oslexec and it did not seem to effect oslcomp.

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...@...<osl-dev%2B...@...>
.
For more options, visit this group at
http://groups.google.com/group/osl-dev?hl=en.



_________________________________________________________
Mail sent using root eSolutions Webmailer - www.root.lu