|
From: Mojca M. <moj...@gm...> - 2012-03-31 15:24:38
|
On 2012-01-08, Jérôme Lodewyck wrote:
> Le Dimanche 8 Janvier 2012 17:45:08 vous avez écrit :
>> I had to replace Cocoa/Cocoa.h with Carbon/Carbon.h. Import of Cocoa
>> doesn't work and I have no idea why (maybe because it is in Objective
>> C and some compiler flags bail?). I also have no idea how safe it is
>> to use Carbon, but apparently it worked this time.
>
> Just for the fun, here is a version that should compile with Cocoa. Beware
> it
> breaks the build systems on non-OSX systems (I don't know how to
> conditionally
> add sources for a given OS in Makefile.am...). As far as I understand, the
> problem with Carbon is that it is somehow obsolete and apperently does not
> work on 64 bits systems.
I have prepared a patch against latest sources using your idea. I'm
attaching two files:
- gnuplot-qt-maconly.patch which attempts to solve this issue
- gnuplot-qt-all.patch which additionally solves three other issues
(trivial patches)
Now my latest observations:
1.) If I run ./prepare myself, the patch seems to work fine.
2.) I wanted to prepare a patch for MacPorts against 4.6.0 and since I
have a newer version of autotools, I wanted to include only the
relevant changes (leaving out all the parts that only have to do with
newer version of autotools). The funny part is that compiling the
result with CC=clang CXX=clang++ OBJC=clang worked fine, while the
compilation using the default compiler choked with with
c++ -DHAVE_CONFIG_H -I. -I.. -I../term -I../term
-DBINDIR=\"/path/to/gnuplot/inst/bin\"
-DX11_DRIVER_DIR=\"/path/to/gnuplot/inst/libexec/gnuplot/4.6\"
-DQT_DRIVER_DIR=\"/path/to/gnuplot/inst/libexec/gnuplot/4.6\"
-DGNUPLOT_SHARE_DIR=\"/path/to/gnuplot/inst/share/gnuplot/4.6\"
-DGNUPLOT_PS_DIR=\"/path/to/gnuplot/inst/share/gnuplot/4.6/PostScript\"
-DGNUPLOT_JS_DIR=\"/path/to/gnuplot/inst/share/gnuplot/4.6/js\"
-DGNUPLOT_LUA_DIR=\"/path/to/gnuplot/inst/share/gnuplot/4.6/lua\"
-DCONTACT=\"gnu...@li...\"
-DHELPFILE=\"/path/to/gnuplot/inst/share/gnuplot/4.6/gnuplot.gih\"
-DGNUPLOT_X11=\"`echo gnuplot_x11 | sed 's,x,x,'`\"
-DXAPPLRESDIR=\"/etc/X11/app-defaults/\"
-DQTGNUPLOT_DATA_DIR=\"/path/to/gnuplot/inst/share/gnuplot/4.6/qt\"
-I/Library/Frameworks/QtCore.framework/Headers
-I/Library/Frameworks/QtGui.framework/Headers
-I/Library/Frameworks/QtNetwork.framework/Headers
-I/Library/Frameworks/QtSvg.framework/Headers -g -O2 -MT qt_term.o
-MD -MP -MF .deps/qt_term.Tpo -c -o qt_term.o `test -f
'qtterminal/qt_term.cpp' || echo './'`qtterminal/qt_term.cpp
In file included from qtterminal/qt_term.cpp:49:
In file included from ./plot.h:46:
./mouse.h:189:6: error: variable has incomplete type 'void'
void set_ruler __PROTO((TBOOLEAN on, int mx, int my));
^
./mouse.h:189:25: error: use of undeclared identifier '_Bool'; did you
mean 'QBool'?
void set_ruler __PROTO((TBOOLEAN on, int mx, int my));
^
./syscfg.h:368:18: note: expanded from macro 'TBOOLEAN'
#define TBOOLEAN bool
^
./syscfg.h:352:15: note: expanded from macro 'bool'
# define bool _Bool
^
./syscfg.h:189:25: note: expanded from macro '__PROTO'
# define __PROTO(proto) proto
^
In file included from qtterminal/qt_term.cpp:49:
In file included from ./plot.h:46:
./mouse.h:197:50: error: unknown type name '_Bool'; did you mean 'QBool'?
void bind_process __PROTO((char* lhs, char* rhs, TBOOLEAN allwindows));
^
./syscfg.h:368:18: note: expanded from macro 'TBOOLEAN'
#define TBOOLEAN bool
^
./syscfg.h:352:15: note: expanded from macro 'bool'
# define bool _Bool
^
./syscfg.h:189:25: note: expanded from macro '__PROTO'
# define __PROTO(proto) proto
^
/Library/Frameworks/QtCore.framework/Headers/qglobal.h:1976:7: note:
'QBool' declared here
class QBool
^
In file included from qtterminal/qt_term.cpp:49:
./plot.h:53:8: error: unknown type name '_Bool'; did you mean 'QBool'?
extern TBOOLEAN interactive;
^
./syscfg.h:368:18: note: expanded from macro 'TBOOLEAN'
#define TBOOLEAN bool
^
./syscfg.h:352:15: note: expanded from macro 'bool'
# define bool _Bool
^
/Library/Frameworks/QtCore.framework/Headers/qglobal.h:1976:7: note:
'QBool' declared here
class QBool
^
In file included from qtterminal/qt_term.cpp:49:
etc.
Even more funny is that:
> c++ --version
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
> clang++ --version
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
The gcc compiler fails with
g++ -DHAVE_CONFIG_H -I. -I.. -I../term -I../term
-DBINDIR=\"/path/to/gnuplot/inst/bin\"
-DX11_DRIVER_DIR=\"/path/to/gnuplot/inst/libexec/gnuplot/4.6\"
-DQT_DRIVER_DIR=\"/path/to/gnuplot/inst/libexec/gnuplot/4.6\"
-DGNUPLOT_SHARE_DIR=\"/path/to/gnuplot/inst/share/gnuplot/4.6\"
-DGNUPLOT_PS_DIR=\"/path/to/gnuplot/inst/share/gnuplot/4.6/PostScript\"
-DGNUPLOT_JS_DIR=\"/path/to/gnuplot/inst/share/gnuplot/4.6/js\"
-DGNUPLOT_LUA_DIR=\"/path/to/gnuplot/inst/share/gnuplot/4.6/lua\"
-DCONTACT=\"gnu...@li...\"
-DHELPFILE=\"/path/to/gnuplot/inst/share/gnuplot/4.6/gnuplot.gih\"
-DGNUPLOT_X11=\"`echo gnuplot_x11 | sed 's,x,x,'`\"
-DXAPPLRESDIR=\"/etc/X11/app-defaults/\"
-DQTGNUPLOT_DATA_DIR=\"/path/to/gnuplot/inst/share/gnuplot/4.6/qt\"
-I/Library/Frameworks/QtCore.framework/Headers
-I/Library/Frameworks/QtGui.framework/Headers
-I/Library/Frameworks/QtNetwork.framework/Headers
-I/Library/Frameworks/QtSvg.framework/Headers -g -O2 -MT qt_term.o
-MD -MP -MF .deps/qt_term.Tpo -c -o qt_term.o `test -f
'qtterminal/qt_term.cpp' || echo './'`qtterminal/qt_term.cpp
In file included from ./plot.h:46,
from qtterminal/qt_term.cpp:49:
./mouse.h:189: error: variable or field ‘set_ruler’ declared void
./mouse.h:189: error: ‘_Bool’ was not declared in this scope
./mouse.h:189: error: expected primary-expression before ‘int’
./mouse.h:189: error: expected primary-expression before ‘int’
./mouse.h:197: error: ‘_Bool’ has not been declared
In file included from qtterminal/qt_term.cpp:49:
./plot.h:53: error: ‘_Bool’ does not name a type
./plot.h:54: error: ‘_Bool’ does not name a type
./plot.h:55: error: ‘_Bool’ does not name a type
In file included from ./color.h:72,
from ./term_api.h:46,
from qtterminal/qt_term.cpp:50:
./eval.h:86: error: ‘_Bool’ does not name a type
./eval.h:129: error: ‘_Bool’ does not name a type
./eval.h:148: error: ‘_Bool’ does not name a type
./eval.h:164: error: ‘_Bool’ has not been declared
In file included from qtterminal/qt_term.cpp:50:
./term_api.h:95: error: ‘_Bool’ does not name a type
./term_api.h:160: error: ‘_Bool’ does not name a type
./term_api.h:249: error: ‘_Bool’ has not been declared
./term_api.h:249: error: ‘_Bool’ has not been declared
./term_api.h:357: error: ‘_Bool’ does not name a type
./term_api.h:367: error: ‘_Bool’ does not name a type
./term_api.h:379: error: ‘_Bool’ does not name a type
./term_api.h:393: error: variable or field ‘term_check_multiplot_okay’
declared void
./term_api.h:393: error: ‘_Bool’ was not declared in this scope
./term_api.h:404: error: ‘_Bool’ has not been declared
./term_api.h:404: error: ‘_Bool’ has not been declared
./term_api.h:404: error: ‘_Bool’ has not been declared
./term_api.h:413: error: variable or field ‘ignore_enhanced’ declared void
./term_api.h:413: error: ‘_Bool’ was not declared in this scope
./term_api.h:416: error: ‘_Bool’ does not name a type
It is possible that I screwed something up during "backporting
configuration" (which is not a very well defined operation), that
there were some weird leftovers from somewhere, but it's also possible
that there are some problems in source code itself (maybe just a
missing header somewhere).
I would like to request somebody to:
- Review the patch and change parts if case that something needs to be changed.
- Confirm that the patch (either of the two) is harmless on platforms
other than Mac OS X.
- Test the patch on Mac OS X (if there is any mac volunteer on the
list at all) with different versions of Qt and different compilers.
- Send me (off-list) a zip of this patch applied + all the files that
get generated with ./prepare script, using the same version of
autotools that is usually used when creating gnuplot distribution. I
would like to figure out if there is a problem in my "backport" or in
some parts of the code. I have also found the following link with
google (claiming a bug in compiler):
http://stackoverflow.com/questions/7751411/xcode-4-error-unknown-type-name-bool-did-you-mean-bool
but the errors are not exactly the same.
I would still like to stress out that:
- the current code (with qt terminal) doesn't work out-of-the-box at all
- the attached patch kind-of-works; it always works when I run
./prepare myself and doesn't work if I do some weird juggling with
backporting and using the wrong compiler; it is still *a lot better*
than the current state though - at least it works most of the time
- there is most probably no influence in cases when qt is not built
and on non-mac platforms (both compilers that fail in cases above work
perfectly fine under exactly the same configuration, only with qt
disabled)
Mojca
|