From: Derrick LIN on
Hi guys,

I am trying to compile 64-bit Tcl/Tk, I am using newest Sun Studio
suit as following:

export PATH=/usr/local/software/tcltk/tcltk-8.4.19/bin:/usr/ccs/bin:/
usr/sbin:/usr/bin:/opt/csw/bin
export CC="/opt/sunstudio12.1/bin/cc -m64"
export CXX="/opt/sunstudio12.1/bin/CC -m64 -lCrun"
export F77="/opt/sunstudio12.1/bin/f95 -m64"
export FC="/opt/sunstudio12.1/bin/f95 -m64"
export FCPICFLAGS="-m64"
export CFLAGS="-xO3 -xc99 -xlibmieee -xlibmil -nofstore -
xtarget=native"
export CXXFLAGS="-xO3 -xlibmil -nofstore -xtarget=native"
export FFLAGS="-xO3 -libmil -nofstore -xtarget=native"
export FCFLAGS=$FFLAGS
export SAFE_FFLAGS="-libmil -fstore -xtarget=native"
export LD="ld -64"
export LDFLAGS="-L/usr/local/software/tcltk/tcltk-8.4.19/lib -L/usr/
sfw/lib/amd64 -L/usr/lib/amd64"
export CPPFLAGS="-I/usr/local/software/tcltk/tcltk-8.4.19/include -I/
usr/sfw/include -I/usr/openwin/share/include"

and Tcl compiled OK, and failed 3 tests of out ~10000 test cases.

But when compiling Tk, it throws error:

/opt/sunstudio12.1/bin/cc -m64 -c -O -xO3 -xc99 -xlibmieee -xlibmil -
nofstore -xtarget=native -I/usr/local/software/tcltk/tcltk-8.4.19/
include -I/usr/sfw/include -I/usr/openwin/share/include -KPIC -I/usr/
local/software/tcltk/tcltk-8.4.19/work/tk8.4.19/unix -I/usr/local/
software/tcltk/tcltk-8.4.19/work/tk8.4.19/unix/../generic -I/usr/local/
software/tcltk/tcltk-8.4.19/work/tk8.4.19/unix/../bitmaps -I/usr/local/
software/R/R-2.11.1/work/tcl8.4.19/generic -DHAVE_LIMITS_H=1 -
DHAVE_UNISTD_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -
D_POSIX_PTHREAD_SEMANTICS=1 -D_THREAD_SAFE=1 -
DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_ATFORK=1 -
DTCL_THREADS=1 -D_REENTRANT=1 -D_POSIX_PTHREAD_SEMANTICS=1 -
DTCL_WIDE_INT_IS_LONG=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -
DSTDC_HEADERS=1 -DHAVE_PW_GECOS=1 -DTCL_NO_DEPRECATED -
DUSE_TCL_STUBS /usr/local/software/tcltk/tcltk-8.4.19/work/tk8.4.19/
unix/../generic/tkMain.c
"/usr/local/software/tcltk/tcltk-8.4.19/work/tk8.4.19/unix/../generic/
tkInt.h", line 857: syntax error before or at: Tk_ClassProcs
cc: acomp failed for /usr/local/software/tcltk/tcltk-8.4.19/work/
tk8.4.19/unix/../generic/tkMain.c
*** Error code 1
make: Fatal error: Command failed for target `tkMain.o'

I later tried tcl/tk8.5.8, but failed due to the same error (except
line is 832, target is tkTheme.o).

Thanks for any idea in advance.

Derric
From: Larry W. Virden on
On Jul 22, 12:53 am, Derrick LIN <klin...(a)gmail.com> wrote:

> "/usr/local/software/tcltk/tcltk-8.4.19/work/tk8.4.19/unix/../generic/
> tkInt.h", line 857: syntax error before or at: Tk_ClassProcs
> cc: acomp failed for /usr/local/software/tcltk/tcltk-8.4.19/work/
> tk8.4.19/unix/../generic/tkMain.c
> *** Error code 1
> make: Fatal error: Command failed for target `tkMain.o'
>
> I later tried tcl/tk8.5.8, but failed due to the same error (except
> line is 832, target is tkTheme.o).
>

Weird. I just took a look at the code. tkMain.c includes tkInt.h.
tkInt.h includes tk.h. In tk.h, Tk_ClassProcs is defined, and then
later in tkInt.h - let 832 or 857 - it uses Tk_ClassProcs.

So from a C code perspective, things look fine. And of course, some of
us have been building versions of tcl and tk on solaris for quite some
time, so that's no surprise.

What I unfortunately am unable right now to try is to try actually
compiling the code using the latest sunstudio. I first have to figure
out whether we have it in house.

Once I do that, I have to figure out how to tweak your environment
variables for my environment. That problem won't happen for the next
week, due to work requirements.

Have you tried building the code without all the 64 bit flags? Just as
a sanity check, try using only the CC variable setting, and don't
include the -m64 flag. If both packages build without problem, then
that helps narrow down the situation. If the same problem comes along,
that means that 64 bit isn't the culprit, and also narrows down the
situation.

Later, once this issue is resolved, be sure to open a bug report about
the failed test cases so that someone has the details for
investigation later.

I wonder... I notice in your msg that the -I flag order at the compile
statement seems a bit odd. Normally I would expect either not to see
the /usr/sfw/include at all, or to see it at the end of the list.
Where it is now, the Sun version of tcl.h and tk.h are being included
before the versions in generic.

Take a look in the Makefile to see where the $(CPPFLAGS) is used. Try
modifying a copy of the Makefile, moving the variable to the end of
any statement (including variable assignment statements). Then, run
the Makefile (be certain to use GNU make) and see if the build works
better.