Stuck on Xlib related compile error on Tiger

View: New views
3 Messages — Rating Filter:   Alert me  

Stuck on Xlib related compile error on Tiger

by Linus Nyberg-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

While trying to get TclBitPrint (aka MacCarbonPrint) working with Tcl 8.5 on
Mac OS X 10.4, I'm stuck on a weird compilation error that I just can't get
past.

It only happens on Tiger - on Leopard the exact same XCode setup (and even
the same gcc calls) succeeds.
It's easier for me to understand why it fails than why it succeeds, which
shows that I am missing some vital piece of the puzzle regarding Tk.

The problem seems to be that the Xlib headers in Tk conflicts with the Xlib
headers in /Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/.
What I don't get is... Why doesn't this _always_ happen when someone
includes tkInt.h on Mac?

In tkMacOSXPort.h, it first includes <X11/Xlib.h>, which contains the
declaration of XSetDashes. And then, right after, tkMacOSXPort.h includes
"tkIntXlibDecls.h", which tries to declare XSetDashes (and others) again.

Can anyone give any clues about what mechanism in the Tk headers and/or
compiler flags is supposed to prevent these conflicting declarations?

Below is the compiler call and part of the output (copy pasted from XCode).

Linus

###############################
Building target "MacCarbonPrint dylib" of project "MacCarbonPrint"


Checking Dependencies
CompileC "build/MacCarbonPrint.build/Development/MacCarbonPrint
dylib.build/Objects-normal/i386/MacCarbonPrint.o"
/Users/linus/tclbitprint.080126/tclbitprint/mac/MacCarbonPrint.c normal i386
c com.apple.compilers.gcc.4_0
    cd /Users/linus/tclbitprint.080126/tclbitprint
    /usr/bin/gcc-4.0 -x c -arch i386 -pipe -Wno-trigraphs -fpascal-strings
-fasm-blocks -g -O0 -DUSE_TCL_STUBS -DTARGET_OS_MAC=1
-DTARGET_API_MAC_CARBON=1 -DUSE_TK_STUBS -DMAC_OSX_TK
-DUSE_COMPOSITELESS_PHOTO_PUT_BLOCK -fmessage-length=0 -mfix-and-continue
-mmacosx-version-min=10.4
-I/Users/linus/tclbitprint.080126/tclbitprint/build/MacCarbonPrint.build/Dev
elopment/MacCarbonPrint\ dylib.build/MacCarbonPrint.hmap -Wmost
-Wno-four-char-constants -Wno-unknown-pragmas
-F/Users/linus/tclbitprint.080126/tclbitprint/build/Development
-I/Users/linus/tclbitprint.080126/tclbitprint/build/Development/include
-I/Users/linus/85test/wish/tcl/generic -I/Users/linus/85test/wish/tk/macosx
-I/Users/linus/85test/wish/tk/generic
-I\"/Users/linus/85test/wish/build/tk/Tcl.framework/Headers\"
-I\"/Users/linus/85test/wish/build/tk/Tk.framework/Headers\"
-I\"/Users/linus/85test/wish/build/tk/Tcl.framework/PrivateHeaders\"
-I\"/Users/linus/85test/wish/build/tk/Tk.framework/PrivateHeaders\"
-I/Users/linus/tclbitprint.080126/tclbitprint/build/MacCarbonPrint.build/Dev
elopment/MacCarbonPrint\ dylib.build/DerivedSources -isysroot
/Developer/SDKs/MacOSX10.4u.sdk -c
/Users/linus/tclbitprint.080126/tclbitprint/mac/MacCarbonPrint.c -o
/Users/linus/tclbitprint.080126/tclbitprint/build/MacCarbonPrint.build/Devel
opment/MacCarbonPrint\ dylib.build/Objects-normal/i386/MacCarbonPrint.o
In file included from /Users/linus/85test/wish/tk/macosx/tkMacOSXPort.h:73,
                 from /Users/linus/85test/wish/tk/generic/tkPort.h:30,
                 from /Users/linus/85test/wish/tk/generic/tkInt.h:27,
                 from /Users/linus/85test/wish/tk/macosx/tkMacOSXInt.h:20,
                 from
/Users/linus/tclbitprint.080126/tclbitprint/mac/MacCarbonPrint.h:13,
                 from
/Users/linus/tclbitprint.080126/tclbitprint/mac/MacCarbonPrint.c:14:
/Users/linus/85test/wish/tk/generic/tkIntXlibDecls.h:669: error: conflicting
types for 'XSetDashes'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/Xlib.h:3193: error: previous
declaration of 'XSetDashes' was here
/Users/linus/85test/wish/tk/generic/tkIntXlibDecls.h:715: error: conflicting
types for 'XKeycodeToKeysym'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/Xlib.h:1687: error: previous
declaration of 'XKeycodeToKeysym' was here
/Users/linus/85test/wish/tk/generic/tkIntXlibDecls.h:740: error: conflicting
types for 'XBell'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/Xlib.h:2005: error: previous
declaration of 'XBell' was here
/Users/linus/85test/wish/tk/generic/tkIntXlibDecls.h:747: error: conflicting
types for 'XChangeProperty'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/Xlib.h:2069: error: previous
declaration of 'XChangeProperty' was here
...snip...


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Tcl-mac mailing list
tcl-mac@...
https://lists.sourceforge.net/lists/listinfo/tcl-mac

Re: Stuck on Xlib related compile error on Tiger

by Mats Bengtsson-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just a far fetched guess, but it shouldn't pick up any system X11
headers at all since they are not required to build AquaTk extensions:

The problem seems to be that the Xlib headers in Tk conflicts with the Xlib
headers in /Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/.

Mats

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Tcl-mac mailing list
tcl-mac@...
https://lists.sourceforge.net/lists/listinfo/tcl-mac

Re: Stuck on Xlib related compile error on Tiger

by Linus Nyberg-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

FYI, the problem was that I didn't have
"/Users/linus/85test/wish/build/tk/xlib" in the header search paths. Doh!

Linus

-----Original Message-----
From: tcl-mac-bounces@...
[mailto:tcl-mac-bounces@...] On Behalf Of Linus Nyberg
Sent: den 30 januari 2008 11:01
To: tcl-mac@...
Subject: [MACTCL] Stuck on Xlib related compile error on Tiger

Hi!

While trying to get TclBitPrint (aka MacCarbonPrint) working with Tcl 8.5 on
Mac OS X 10.4, I'm stuck on a weird compilation error that I just can't get
past.

It only happens on Tiger - on Leopard the exact same XCode setup (and even
the same gcc calls) succeeds.
It's easier for me to understand why it fails than why it succeeds, which
shows that I am missing some vital piece of the puzzle regarding Tk.

The problem seems to be that the Xlib headers in Tk conflicts with the Xlib
headers in /Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/.
What I don't get is... Why doesn't this _always_ happen when someone
includes tkInt.h on Mac?

In tkMacOSXPort.h, it first includes <X11/Xlib.h>, which contains the
declaration of XSetDashes. And then, right after, tkMacOSXPort.h includes
"tkIntXlibDecls.h", which tries to declare XSetDashes (and others) again.

Can anyone give any clues about what mechanism in the Tk headers and/or
compiler flags is supposed to prevent these conflicting declarations?

Below is the compiler call and part of the output (copy pasted from XCode).

Linus

###############################
Building target "MacCarbonPrint dylib" of project "MacCarbonPrint"


Checking Dependencies
CompileC "build/MacCarbonPrint.build/Development/MacCarbonPrint
dylib.build/Objects-normal/i386/MacCarbonPrint.o"
/Users/linus/tclbitprint.080126/tclbitprint/mac/MacCarbonPrint.c normal i386
c com.apple.compilers.gcc.4_0
    cd /Users/linus/tclbitprint.080126/tclbitprint
    /usr/bin/gcc-4.0 -x c -arch i386 -pipe -Wno-trigraphs -fpascal-strings
-fasm-blocks -g -O0 -DUSE_TCL_STUBS -DTARGET_OS_MAC=1
-DTARGET_API_MAC_CARBON=1 -DUSE_TK_STUBS -DMAC_OSX_TK
-DUSE_COMPOSITELESS_PHOTO_PUT_BLOCK -fmessage-length=0 -mfix-and-continue
-mmacosx-version-min=10.4
-I/Users/linus/tclbitprint.080126/tclbitprint/build/MacCarbonPrint.build/Dev
elopment/MacCarbonPrint\ dylib.build/MacCarbonPrint.hmap -Wmost
-Wno-four-char-constants -Wno-unknown-pragmas
-F/Users/linus/tclbitprint.080126/tclbitprint/build/Development
-I/Users/linus/tclbitprint.080126/tclbitprint/build/Development/include
-I/Users/linus/85test/wish/tcl/generic -I/Users/linus/85test/wish/tk/macosx
-I/Users/linus/85test/wish/tk/generic
-I\"/Users/linus/85test/wish/build/tk/Tcl.framework/Headers\"
-I\"/Users/linus/85test/wish/build/tk/Tk.framework/Headers\"
-I\"/Users/linus/85test/wish/build/tk/Tcl.framework/PrivateHeaders\"
-I\"/Users/linus/85test/wish/build/tk/Tk.framework/PrivateHeaders\"
-I/Users/linus/tclbitprint.080126/tclbitprint/build/MacCarbonPrint.build/Dev
elopment/MacCarbonPrint\ dylib.build/DerivedSources -isysroot
/Developer/SDKs/MacOSX10.4u.sdk -c
/Users/linus/tclbitprint.080126/tclbitprint/mac/MacCarbonPrint.c -o
/Users/linus/tclbitprint.080126/tclbitprint/build/MacCarbonPrint.build/Devel
opment/MacCarbonPrint\ dylib.build/Objects-normal/i386/MacCarbonPrint.o
In file included from /Users/linus/85test/wish/tk/macosx/tkMacOSXPort.h:73,
                 from /Users/linus/85test/wish/tk/generic/tkPort.h:30,
                 from /Users/linus/85test/wish/tk/generic/tkInt.h:27,
                 from /Users/linus/85test/wish/tk/macosx/tkMacOSXInt.h:20,
                 from
/Users/linus/tclbitprint.080126/tclbitprint/mac/MacCarbonPrint.h:13,
                 from
/Users/linus/tclbitprint.080126/tclbitprint/mac/MacCarbonPrint.c:14:
/Users/linus/85test/wish/tk/generic/tkIntXlibDecls.h:669: error: conflicting
types for 'XSetDashes'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/Xlib.h:3193: error: previous
declaration of 'XSetDashes' was here
/Users/linus/85test/wish/tk/generic/tkIntXlibDecls.h:715: error: conflicting
types for 'XKeycodeToKeysym'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/Xlib.h:1687: error: previous
declaration of 'XKeycodeToKeysym' was here
/Users/linus/85test/wish/tk/generic/tkIntXlibDecls.h:740: error: conflicting
types for 'XBell'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/Xlib.h:2005: error: previous
declaration of 'XBell' was here
/Users/linus/85test/wish/tk/generic/tkIntXlibDecls.h:747: error: conflicting
types for 'XChangeProperty'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/X11/Xlib.h:2069: error: previous
declaration of 'XChangeProperty' was here
...snip...


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Tcl-mac mailing list
tcl-mac@...
https://lists.sourceforge.net/lists/listinfo/tcl-mac


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Tcl-mac mailing list
tcl-mac@...
https://lists.sourceforge.net/lists/listinfo/tcl-mac
LightInTheBox - Buy quality products at wholesale price!