ssize_t

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
crenelle
In need of some credit
In need of some credit
Posts: 7
Joined: Mon Jan 31, 2011 6:47 pm

ssize_t

Post by crenelle »

We're doing Universal 32-bit builds on Mac using Xcode 3.2.5, just starting to build files and reconciling includes.

We have a conflict between string.h in the Mac OS X 10.5 SDK, and defs.h in wxWidgets:

defs.h declares typedef wxInt32 ssize_t (int)
string.h declares typedef __darwin_ssize_t ssize_t (long)

Apparently wxWidgets depends on HAVE_SSIZE_T be defined; however, the Apple files use _SSIZE_T.

In our build, ssize_t is defined by defs.h, and then down the road string.h attempts to define it also. It checks _SSIZE_T, which wasn't defined, so it goes ahead.

error: conflicting declaration 'typedef __darwin_ssize_t ssize_t'
error: 'ssize_t' has a previous declaration as 'typedef wxInt32 ssize_t'

On the surface, it looks as if defs.h should define _SSIZE_T when it defines ssize_t, just to tell the Mac SDK to back off.

How do the experts read this?

This is pretty early in our project setup process, getting something else wrong to wind up here would not raise an eyebrow.

Thanks!

-Mike
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

How do you build your project? Namely, do you use wx-config?

I'm asking because I have never heard of this


Also see http://trac.wxwidgets.org/ticket/12249 : make sure you downloaded the right wxWidgets
"Keyboard not detected. Press F1 to continue"
-- Windows
crenelle
In need of some credit
In need of some credit
Posts: 7
Joined: Mon Jan 31, 2011 6:47 pm

Post by crenelle »

That's a different problem. We also saw the File System Watcher error. (For that problem, we set the relevant define to 0.)

We're using 2.9.1.
preethis
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Dec 05, 2017 9:10 am

Re: ssize_t

Post by preethis »

When i try to build my xcode project that is using wxwidgets in MAC , i am facing the same issue:
Typedef redefinition with different types('wxint32' (aka 'int') vs '__darwin_ssize_t'(aka 'long')) defs.h

Can anyone please help me to resolve this error.

Using wx-3.0
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: ssize_t

Post by eranon »

crenelle wrote:We have a conflict between string.h in the Mac OS X 10.5 SDK, and defs.h in wxWidgets
Wow! Trying to stay 10.5 compatible should be a real challenge. If you have a real reason to keep OS X 10.5, maybe you could try with an older wxWidgets too... Just my two cents since in my own apps I dropped all before 10.8/10.9 (depends on the app) and I don't use Xcode as IDE.

Also, what I several times noticed under Mac is that it "often" (from my own experience, so not an universal one) better compiles when I directly develop under the minimal OS X version I target (rather than installing the concerned SDK in a more recent OS X version).
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
preethis
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Dec 05, 2017 9:10 am

Re: ssize_t

Post by preethis »

WXWidget undefined error is throwing when tried to build xcode project that uses wx-3.0.
We are using OSX version 10.13 .. And also we are using __WXOSX_COCOA__ and __WXMAC__

In wx/defs.h

#ifdef __WXMAC__

DECLARE_WXCOCOA_OBJC_CLASS(NSString);

#if wxOSX_USE_COCOA

typedef WX_NSWindow WXWindow;
typedef WX_NSView WXWidget;
typedef WX_NSMenu WXHMENU;
typedef WX_NSOpenGLPixelFormat WXGLPixelFormat;
typedef WX_NSOpenGLContext WXGLContext;

#elif wxOSX_USE_IPHONE

DECLARE_WXCOCOA_OBJC_CLASS(UIWindow);
DECLARE_WXCOCOA_OBJC_CLASS(UIView);
DECLARE_WXCOCOA_OBJC_CLASS(UIFont);
DECLARE_WXCOCOA_OBJC_CLASS(UIImage);
DECLARE_WXCOCOA_OBJC_CLASS(UIEvent);
DECLARE_WXCOCOA_OBJC_CLASS(NSSet);
DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext);

typedef WX_UIWindow WXWindow;
typedef WX_UIView WXWidget;
typedef WX_EAGLContext WXGLContext;
typedef WX_NSString* WXGLPixelFormat;

#endif

Since we are using COCOA, it should take the appropriate WXWidget. But its throwing errors.

Please help!!
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: ssize_t

Post by eranon »

I don't use/know Xcode (I'm using CodeBlocks against LLVM Clang). What's your command line for building and what errors are reported by the compiler and/or linker?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
preethis
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Dec 05, 2017 9:10 am

WX and XCode: wxFileSystemWatcher error

Post by preethis »

MAC : OSX version 10.13
wx : 3.0
Preprocessor Macros: __WXMAC__ WXUSINGDLL wxUSE_BASE=1 __WXMAC_XCODE__=1 _UNICODE UNICODE wxUSE_UNICODE __WXOSX_COCOA__

Other C++ Flags: -D__WXMAC__ -DWXUSINGDLL -D__WXNDEBUG__ -DMACOS -read_only_relocs supress -DwxUSE_UNICODE

When i try to compile xcode project that uses wx3.0, the below errors are thrown.
1) Typedef redefinition with different types ('wxInt32' (aka 'int') vs '_darwin_ssize_t' (aka 'long'))
* Noticed In wx/defs.h
#if SIZEOF_SIZE_T == 4
typedef wxInt32 ssize_t;
#elif SIZEOF_SIZE_T == 8
typedef wxInt64 ssize_t;
#else
#error "error defining ssize_t, size_t is not 4 or 8 bytes"
#endif
MAC OS specific .h file also has same typedef as long. How to resolve this ambiguity??

2) wxFilesystemWatcher requires either inotify() or kqueue()
* setup.h file taken from wx/include/mac-unicode-release-3.0. Please refer the attached setup.h file. Even I changed wxUSE_FSWATCHER to 0 and checked. It still showing error.

3) "wxUSE_ACCESSIBILITY is currently only supported under wxMSW"
4) "wxUSER_WEBVIEW requires atleast one backend"

I am new to xcode. We are porting Visual studio project into xcode. Please help resolving these issues.
Attachments
setup.h
(51.28 KiB) Downloaded 83 times
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: ssize_t

Post by eranon »

@preethis: You extended the subject and it sounds for me like a kind of thread hijacking... Please, open your own thread!

@crenelle: I have no idea how to solved this redefinition, but, again (I suggested implicitely in my previous message but didn't say explicitely), maybe it would be better to directly build your project in the OS X version you target (standalone SDK are not always perfect on Mac).

Also, just to be sure: we're well agree that Universal Binaries is here to target Intel and PowerPC (you're not just talking about 32/64-bit Fat Binaries)? So, you built wxWidgets itself with "--enable-universal-binary"?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Post Reply