Author Topic: rev3921 does not build for MacOSX  (Read 3650 times)

Offline bnilsson

  • Almost regular
  • **
  • Posts: 184
rev3921 does not build for MacOSX
« on: May 03, 2007, 07:30:36 am »
I get this:
Quote
memorymappedfile.cpp: In member function 'long int wxMemoryMappedFile::MapFile(const wxString&, bool)':
memorymappedfile.cpp:112: error: 'errno' was not declared in this scope
memorymappedfile.cpp:121: error: 'errno' was not declared in this scope
memorymappedfile.cpp:131: error: 'errno' was not declared in this scope
memorymappedfile.cpp: In static member function 'static wxULongLong wxMemoryMappedFile::GetFileSize64(wxMemoryMappedFileHandleType)':
memorymappedfile.cpp:223: error: 'off64_t' was not declared in this scope
memorymappedfile.cpp:223: error: expected `;' before 'size'
memorymappedfile.cpp:224: error: 'lseek64' was not declared in this scope
memorymappedfile.cpp:225: error: 'size' was not declared in this scope
memorymappedfile.cpp:229: error: 'size' was not declared in this scope
make[5]: *** [memorymappedfile.lo] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
-- Ingnorance should not be taken for stupidity --

HW: PowerMac Dual PowerPC G5 2.3Ghz, 1GB RAM OS: MacOSX 10.4.10 Compiler: powerpc-apple-darwin8-gcc-4.0.1

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: rev3921 does not build for MacOSX
« Reply #1 on: May 03, 2007, 01:49:54 pm »
Try this. I no longer have a Mac, so you'll have to tell us if it works.


http://forums.codeblocks.org/index.php?topic=5824.0;topicseen
problem, building C::B latest on freebsd 6.2


At the top of memorymappedfile.cpp you might add __WXMAC__ or whatever to:

#if defined(__WXGTK__)
    #include "errno.h"
#endif

Please tell me if that also worked.

« Last Edit: May 03, 2007, 01:54:03 pm by Pecan »

Offline bnilsson

  • Almost regular
  • **
  • Posts: 184
Re: rev3921 does not build for MacOSX
« Reply #2 on: May 03, 2007, 08:46:38 pm »
It worked.
In memorymappedfile.cpp I added
at line 14:
Quote
#if defined(__WXGTK__) || defined(__WXMAC__)
    #include "errno.h"
#endif
and at line 222:
Quote
#elif defined(__BSD__) || defined(__DARWIN__)
   off_t size = lseek(hFile, 0, SEEK_END);
   lseek(hFile, 0, SEEK_SET);//go back to the start of the file
   if (-1 == size)
   {
      throw wxMemoryMappedInvalidFileSize();
   }
   return wxULongLong(size);   
#else

Thanks a lot. I hope this goes into the next rev.
-- Ingnorance should not be taken for stupidity --

HW: PowerMac Dual PowerPC G5 2.3Ghz, 1GB RAM OS: MacOSX 10.4.10 Compiler: powerpc-apple-darwin8-gcc-4.0.1

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: rev3921 does not build for MacOSX
« Reply #3 on: May 03, 2007, 09:39:52 pm »
It worked.
In memorymappedfile.cpp I added
at line 14:
Quote
#if defined(__WXGTK__) || defined(__WXMAC__)
    #include "errno.h"
#endif
and at line 222:
Quote
#elif defined(__BSD__) || defined(__DARWIN__)
   off_t size = lseek(hFile, 0, SEEK_END);
   lseek(hFile, 0, SEEK_SET);//go back to the start of the file
   if (-1 == size)
   {
      throw wxMemoryMappedInvalidFileSize();
   }
   return wxULongLong(size);   
#else

Thanks a lot. I hope this goes into the next rev.


Thanks to Tims S and bnilsson

I'll commit the fixes.