Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make under Windows fails #997

Open
McLP2 opened this issue Nov 14, 2020 · 3 comments
Open

Make under Windows fails #997

McLP2 opened this issue Nov 14, 2020 · 3 comments

Comments

@McLP2
Copy link

McLP2 commented Nov 14, 2020

Hey there!
I just tried to compile the 3.6.5 release commit without success.
After I ran cmake -G "MinGW Makefiles" ., mingw32-make fails at FileUtils.cpp with the following error:

...\OpenSceneGraph\src\osgDB\FileUtils.cpp: In function 'bool osgDB::makeDirectory(const string&)':
...\OpenSceneGraph\src\osgDB\FileUtils.cpp:161:19: error: aggregate 'osgDB::makeDirectory(const string&)::stat64 stbuf' has incomplete type and cannot be defined
  161 |     struct stat64 stbuf;
      |                   ^~~~~
...\OpenSceneGraph\src\osgDB\FileUtils.cpp:165:38: error: invalid use of incomplete type 'struct osgDB::makeDirectory(const string&)::stat64'
  165 |     if( stat64( path.c_str(), &stbuf ) == 0 )
      |                                      ^
...\OpenSceneGraph\src\osgDB\FileUtils.cpp:161:12: note: forward declaration of 'struct osgDB::makeDirectory(const string&)::stat64'
  161 |     struct stat64 stbuf;
      |            ^~~~~~
...\OpenSceneGraph\src\osgDB\FileUtils.cpp:186:41: error: invalid use of incomplete type 'struct osgDB::makeDirectory(const string&)::stat64'
  186 |         if( stat64( dir.c_str(), &stbuf ) < 0 )
      |                                         ^
...\OpenSceneGraph\src\osgDB\FileUtils.cpp:161:12: note: forward declaration of 'struct osgDB::makeDirectory(const string&)::stat64'
  161 |     struct stat64 stbuf;
      |            ^~~~~~
...\OpenSceneGraph\src\osgDB\FileUtils.cpp: In function 'osgDB::FileType osgDB::fileType(const string&)':
...\OpenSceneGraph\src\osgDB\FileUtils.cpp:311:19: error: aggregate 'osgDB::fileType(const string&)::stat64 fileStat' has incomplete type and cannot be defined
  311 |     struct stat64 fileStat;
      |                   ^~~~~~~~
...\OpenSceneGraph\src\osgDB\FileUtils.cpp:315:44: error: invalid use of incomplete type 'struct osgDB::fileType(const string&)::stat64'
  315 |     if ( stat64(filename.c_str(), &fileStat) != 0 )
      |                                            ^
...\OpenSceneGraph\src\osgDB\FileUtils.cpp:311:12: note: forward declaration of 'struct osgDB::fileType(const string&)::stat64'
  311 |     struct stat64 fileStat;
      |            ^~~~~~

This seems to be a relatively old issue, as I found the same error in a Mail thread from 2004 but as I am relatively new to C++, I am not sure how to apply their solution (as it does not seem appropreate having to change the source code, just to use make instead of visual studio) or if even a fix inside some configuration might be possible.

@robertosfield
Copy link
Collaborator

robertosfield commented Nov 14, 2020 via email

@McLP2
Copy link
Author

McLP2 commented Nov 19, 2020

Tried OpenSceneGraph-3.6 and master branches, still getting the same error.

@jardik
Copy link

jardik commented Mar 5, 2021

Mingw-w64 has _stat64 structure and function is called _stat64. Maybe OSG expects POSIX OS when compiling with GCC and is using stat64? On Mingw, best would probably be just using regular stat and defining _FILE_OFFSET_BITS=64, this makes "stat" being define for _stat64. See msys64\mingw64\x86_64-w64-mingw32\include\sys\stat.h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants