Sorry, I forgot the attachment in my first message.

"p. meyer" wrote:
> 
> Hi all,
> 
> I tried to build Ptolemy 0.7.1p1 from scratch (including GNU Tools) on
> SUN Sparcstation4 Solaris2.5.1 and I didn't succeed because ptlang
> failed to compile the ACS domain stars (files with corona statement
> only). Segmentation Fault message is generated. What's the problem?
> Could someone help me, please?
> 
> Many Thanks in advance.
> 
> Yours sincerely,
> [EMAIL PROTECTED]
> 

Hi:

That sounds like you hit the ACS ptlang bug which will occur only if your shell
lacks the PWD variable (e.g. Bourne shell). On Solaris this bug will cause
ptlang to crash with SIGSEGV when trying to process ACS stars (see comments in
the attachment). I already sent the attached stuff in January and the 2nd patch
(pt0.7.1p1.ptlang.patch.gz) will fix that ptlang bug.

Best regards,

Wolfgang.
-- 
Wolfgang Reimer (Dr.-Ing.)
 
Technische Universität Ilmenau  -  Ilmenau Technical University
Address: TU Ilmenau, FEI/IKM, PF 100565, 98684 Ilmenau, GERMANY
http://ikmcip1.e-technik.tu-ilmenau.de  Phone: +49-3677-69-2619
mailto:[EMAIL PROTECTED]   Fax  : +49-3677-69-1195

V I R T U A L     P H O T O N I C S     I N C O R P O R A T E D
mailto:[EMAIL PROTECTED]                http://www.vp-bned.com


Christopher Hylands wrote:
> 
> 0.7.1 shipped with egcs-1.0.2, which corresponds with:
>       gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
> 
> I was able to build an internal development version with egcs-1.1
> (19980901) under NT, but I have not tried it under Solaris yet.
> 
> I don't know why, but someone at Sun decided that if strlen() gets a
> null pointer, then the entire process should crash.  I guess they felt
> that the performance hit of testing for null pointers was too great.
> I'm not sure I agree with this.  I'm not sure, but I vaguely remember
> that this was a change, and that passing NULL to strlen did not cause
> problems in SunOS4.x
> 
> In any case, ACS is a fairly young domain, and we made changes to
> ptlang to support ACS.  The rest of ptlang has not changed very much,
> so it likely that we introduced an ACS/ptlang bug.
> 
> Running gdb is the right thing to do.  When the segfault happens, you
> should type 'bt' so that we can get a stack trace and see where the
> error occurred.  If you get a backtrace, send it to me, and I'll see
> if I can make heads or tails out of it.  You can use 'up' and 'down'
> to traverse the stack and see what source code lines were called.
> 
> In the interim, I'll rebuild my internal tree to use egcs-1.1 and see
> if I can replicate the bug.  If I can't, you may need to install the
> older version of egcs that we have on our website with the 0.7.1
> sources, or try to upgrade to egcs-1.1, which could cause other
> problems.
> 
> -Christopher
> 
> --------
> 
>     Hi,
> 
>     I was able to obtain the pt 0.7.1 package from ptolemy.eecs.berkeley.edu
> 
>     and succeed in building most of the available tools.  There is one
>     problem
>     that I hope someone can help me out with.  The platform is Solaris 2.5.1
> 
>     using the latest version of egcs (19980803), flex, and bison.
> 
>     Looking at the log file, I found that the commands
> 
>        "$SRC/bin.sol2.5/ptlang $SRC/src/domains/acs/stars/ACSAdd.pl"
>        "$SRC/bin.sol2.5/ptlang $SRC/src/domains/acs/stars/ACSPrinter.pl"
> 
>     generated "Segmentation Fault".  The ptlang command has no problem
>     parsing the other .pl files like ACSAdd.pl, ACSGain.pl,
>     ACSPrinterFixSim.pl, and ACSAddFPCGC.pl.  I ran
> 
>        "gdb $SRC/bin.sol2.5/ptlang $SRC/src/domains/acs/stars/ACSAdd.pl"
> 
>     and got the following results:
> 
>       (gdb) r ACSPrinter.pl
>       Starting program: /a/ptolemy/obj.sol2.5/ptlang/ptlang ACSPrinter.pl
> 
>       Breakpoint 1, main (argc=2, argv=0xeffffb04) at
>     ../../src/ptlang/ptlang.y:2609
>       2609            if (argc < 2 || argc > 3) {
>       (gdb) n
>       2613            if (argc == 3) {
>       (gdb) n
>       2622                    inputFile = argv[1];
>       (gdb) n
>       2624            if ((yyin = fopen (inputFile, "r")) == NULL) {
>       (gdb) n
>       2628            yyparse ();
>       (gdb) n
> 
>       Program received signal SIGSEGV, Segmentation fault.
>       0xef723ddc in strlen ()
> 
>     Here is the content of ACSPrinter.pl
> 
>     ----------------------------------------------------------------------
>     defcorona {
>         name { Printer }
>         domain { ACS }
>         desc {
>     Print out one sample from each input port per line.  The "fileName"
>     state specifies the file to be written; the special names
>     &lt;stdout&gt; and &lt;cout&gt;, which specify the standard output
>     stream, and &lt;stderr&gt; and &lt;cerr&gt;, which specify the
>     standard error stream, are also supported.
>         }
>         version { @(#)ACSPrinter.pl 1.1 03/09/98 }
>         author { James Lundblad }
>         copyright {
>     Copyright (c) 1998 The Regents of the University of California.
>     All rights reserved.
>     See the file $PTOLEMY/copyright for copyright notice,
>     limitation of liability, and disclaimer of warranty provisions.
>         }
>         location { ACS main library }
>         inmulti {
>             name { input }
>             type { ANYTYPE }
>         }
> 
>     }
>     ----------------------------------------------------------------------
> 
>     Thanks for any pointer,
> 
>     Dinh
>     [EMAIL PROTECTED]

Dear Christopher:

First I would like to send 2 new patches (relative to Ptolemy0.7.1p1).
The second one resolves the above quoted problem reported by Dinh Le. I
appended some comments regarding these patches in the end of this
message. BTW, when I looked into the directory
ftp://ptolemy.eecs.berkeley.edu/pub/ptolemy/ptolemy0.7.1/html/reimer0898/
which contains my previous patches, I noticed that the file README in
this directory is not readable to all.

The second part of my message is concerning the Ptolemy Miniconference.
As it turned out lately, my schedule has changed and I will be in
California to attend the Optical Fiber Communication Conference (OFC)
starting February 21. So I am happy to let you know that after all I
will join my friend and colleague Olaf Lenzmann from Virtual Photonics
(former BNeD) in order to take part at the Ptolemy Miniconference. As
you know Olaf will give a talk on simulation of photonic communication
networks and we will also give a poster session on the new GUI draft
(with demonstration). Since I know that there are not enough parking
lots on campus I would like to park our car on a location which has
enough parking lots and use the campus shuttle then. Please, could you
suggest a good parking location near a pickup area of the shuttle?

I am already looking forward to see you again.

Best regards,

Wolfgang.

*********************** Begin of Comments ******************

These patches should be applied relative to the vanilla Ptolemy 0.7.1p1
sources. Changes which concern the Linux platform only are marked using
capital L (for Linux) and changes which concern all platforms are marked
using capital A (for all platforms).

1. pt0.7.1p1.config+pigiLoader.patch-3.gz
   (L) This patch replaces the patch
       pt0.7.1p1.config+pigiLoader.patch.gz which I sent in
       August '98. In addition to the changes of the latter
       version of this patch, this new patch introduces
       further changes to mk/config-linux.mk only:
       Egcs 1.1 or newer with compiler flag -march=pentiumpro
       will really generate code for i686 which won't run on
       i486 and i586 machines. That is why I changed the
       OPTIMIZER flags so that code scheduling will be
       optimized for i686 but the code will still run on i486
       and i586, too. Egcs1.1 and newer does not have
       internal compiler errors (ICEs) any longer which
       prevented old gcc2.7.2 and egcs 1.0.x from compiling
       some Ptolemy c++ files with -O2 or -O3. Now the file 
       mk/config-linux.mk will check the egcs version and will
       disable the optimizer-bug work around so that all
       Ptolemy files will be compiled with full optimization if
       egcs1.1 or newer is detected. If you have already applied
       the previous patch from 08/98 then alternatively you
       could simply replace your mk/config-linux.mk by the new
       one I attached to this message.

2. pt0.7.1p1.ptlang.patch.gz
   (A) Fixes a bug (see thread "Problem using ptlang in the
       pt0.7.1 package" in the Ptolemy news group) in line
       1669 of src/ptlang/ptlang.y:
          srcDirectory = getenv("PWD");
       If a shell lacking the PWD variable (e.g. Bourne shell)
       is used then the variable srcDirectory will be set to
       zero (null pointer). So the fprintf() function in the
       following line is called with a null pointer as
       argument. This in turn will cause a SIGSEGV crash in
       strlen() (which is called from inside fprintf) on
       systems like Solaris which do not tolerate a null
       pointer as argument to strlen(). However, even on
       systems which do tolerate a null pointer at that point,
       the resulting code generated by ptlang would be wrong.
       So the shell-does-not-have-PWD problem needs a general
       fix. One solution (as used in this patch) is to use the
       getcwd() function instead of the getenv() function.


******************* End of Comments ***************************
-- 
Wolfgang Reimer (Dr.-Ing.)
 
T U I  --  Technical University of Ilmenau,  GERMANY, Thuringia
Address: TU Ilmenau, FEI/IKM, PF 100565, 98684 Ilmenau, GERMANY
http://ikmcip1.e-technik.tu-ilmenau.de  Phone: +49-3677-69-2619
mailto:[EMAIL PROTECTED]   Fax  : +49-3677-69-1195

B  N  e  D        ---        V i r t u a l    P h o t o n i c s
mailto:[EMAIL PROTECTED]                      http://www.BNeD.com

pt0.7.1p1.config+pigiLoader.patch-3.gz

pt0.7.1p1.ptlang.patch.gz

# Copyright (c) 1994-1998 The Regents of the University of California.
# All rights reserved.
# 
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and its documentation for any purpose, provided that the
# above copyright notice and the following two paragraphs appear in all
# copies of this software.
# 
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
# ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
# THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# 
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
# PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
# CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
# ENHANCEMENTS, OR MODIFICATIONS.
# 
#                                               PT_COPYRIGHT_VERSION_2
#                                               COPYRIGHTENDKEY
#
# Config file to build on Linux
#
# @(#)config-linux.mk   1.39 06/08/98

# Author:  Alberto Vignani, FIAT Research Center, TORINO
# Modified by:  Neal Becker ([EMAIL PROTECTED])
#               Dirk Forchel ([EMAIL PROTECTED])
#               Wolfgang Reimer ([EMAIL PROTECTED])


# --------------------------------------------------------------------
# |  Please see the file ``config-default.mk'' in this directory!    |
# --------------------------------------------------------------------
include $(ROOT)/mk/config-default.mk

PT_GPP_V := $(filter egcs-%,$(shell g++ --version))
ifeq ("$(PT_GPP_V)","")
    # This is GNU g++.
    include $(ROOT)/mk/config-g++.mk
else
    # This is egcs.
    include $(ROOT)/mk/config-egcs.mk
    PT_EGCS = yes
    ifeq ("$(firstword $(sort egcs-2.91.57 $(PT_GPP_V)))","egcs-2.91.57")
        # egcs 1.1 does not have optimizer bugs any longer
        USE_GPLUSPLUS =
    else
        # The versions 1.0.2 and 1.0.3a of egcs cannot compile
        # the file DEWiNeS_Tcl_Animation.cc with -O2 or higher. So we can
        # check for this error in the makefile.
        PT_EGCS_OPT_ERROR = yes
    endif
endif

# Get the g++ definitions for shared libraries; we override some below.
# Comment the next line out if you don't want shared libraries.
ifndef BUILD_STATIC_BINARIES
    include $(ROOT)/mk/config-g++.shared.mk
endif

#
# Programs to use
#
RANLIB = ranlib

# Use gcc everywhere including in octtools
CC = gcc

ifeq ($(PT_EGCS),yes)
    PT_GCC_V := $(filter egcs-%,$(shell gcc --version))
    ifneq ("$(PT_GPP_V)","$(PT_GCC_V)")
        # We want to use the same compiler version (egcs) for c and c++
        # files. RH5.1 comes with egcs-1.0.2 (named g++) as c++ compiler
        # and two c compilers: the old gcc-2.7.2.3 (named gcc) end
        # egcs-1.0.2 (named egcs). 
        CC = egcs
        OCT_CC = egcs -fwritable-strings
    endif
endif

# for dynamic loading
DLLIB = -ldl

# where the Gnu library is
# GNULIB = $(PTOLEMY)/gnu/$(PTARCH)/lib
GNULIB = /usr/lib

# linker to use for pigi and interpreter.
LINKER = $(CPLUSPLUS)

ifeq ($(USE_SHARED_LIBS),yes)
    # Use Position Independent Code to build shared libraries
    C_SHAREDFLAGS = -fpic
    CC_SHAREDFLAGS = -fpic
    RANLIB = true
else
    SHARED_COMPILERDIR = $(GNULIB)
    SHARED_COMPILERDIR_FLAG = -L$(SHARED_COMPILERDIR)
    INC_LINK_FLAGS = -shared $(SHARED_COMPILERDIR_FLAG)
    SHARED_LIBRARY_PATH = 
$(X11_LIBDIR):$(SHARED_COMPILERDIR):$(PTOLEMY)/tcltk/itcl.$(PTARCH)/lib/itcl
    SHARED_LIBRARY_R_LIST = -Wl,-R,$(SHARED_LIBRARY_PATH)
endif

# Command to build C++ shared libraries
SHARED_LIBRARY_COMMAND = $(CC) -shared $(SHARED_COMPILERDIR_FLAG) -o
 
# Command to build C shared libraries
CSHARED_LIBRARY_COMMAND = $(CC) -shared $(SHARED_COMPILERDIR_FLAG) -o

# linker for C utilities.  If we are using shared libraries, then
# we want to avoid involving libg++.so, so we use gcc to link.
CLINKER = $(CC)

# domains/ipus/islang uses BISONFLEXLIBS
BISONFLEXLIB =  -fl

# In config-$PTARCH.mk, we set the following variables.  We need to 
# use only the following variables so that we can use them elsewhere, say
# for non-optimized compiles.
# OPTIMIZER - The setting for the optimizer, usually -O2.
# MEMLOG    - Formerly used to log memory allocation and deallocation.
# WARNINGS  - Flags that print warnings.
# ARCHFLAGS - Architecture dependent flags, useful for determining which
#             OS we are on.  Often of the form -DPTSOL2_4.
# LOCALCCFLAGS - Other architecture dependent flags that apply to all releases
#             of the OS for this architecture for c++
# LOCALCFLAGS - Other architecture dependent flags that apply to all releases
#             of the OS for this architecture for c++
# USERFLAGS - Ptolemy makefiles should never set this, but the user can set it.

#       Don't use -pipe, it makes life worse on small-memory systems.
#       Don't use -m486, it's the default, except for those with the
#       Pentium optimized compiler; for them -m486 makes things worse.
#OPTIMIZER =    -m486 -pipe
ifeq ($(PT_EGCS),yes)
    OPTIMIZER = -O3 -march=i486 -mcpu=pentiumpro -fomit-frame-pointer# -pipe
else
    OPTIMIZER = -O3 -fomit-frame-pointer# -pipe
endif

# -Wsynth is new in g++-2.6.x, however 2.5.x does not support it
# Under gxx-2.7.0 -Wcast-qual will drown you with warnings from libg++ includes
WARNINGS =      -Wall -Wcast-align -Wsynth# -Wcast-qual 

# need _REENTRANT to get thread aware code
ARCHFLAGS =     -Dlinux -D_REENTRANT

# need _PTHREAD_1003_1c for PosixThread.cc to conform with POSIX 1003.1c
# need EXTRAOPTS for pigiLoader.cc to compile user stars with same optimization
LOCALCCFLAGS =  -D_PTHREAD_1003_1c -DEXTRAOPTS="\"$(OPTIMIZER) -fpic\""
GPPFLAGS =      $(OPTIMIZER) $(MEMLOG) $(WARNINGS) \
                        $(ARCHFLAGS) $(LOCALCCFLAGS) $(USERFLAGS)

# need -DI_UNISTD for rman to find the declaration of getopt()
LOCALCFLAGS =   -DI_UNISTD
CFLAGS =        $(OPTIMIZER) $(MEMLOG) $(WARNINGS) \
                        $(ARCHFLAGS) $(LOCALCFLAGS) $(USERFLAGS)


#
# Variables for the linker
#
# system libraries for linking .o files from C files only
CSYSLIBS=$(SHARED_COMPILERDIR_FLAG) -lm $(DLLIB) #-lieee

# system libraries (libraries from the environment)
# we don't need -lg++: old GNU g++ links with -lg++ automatically and
# egcs does not need libg++ any longer.
SYSLIBS=$(CSYSLIBS) #-lg++


# Ask ld to strip symbolic information, otherwise, expect a 32Mb pigiRpc
LINKSTRIPFLAGS=-Wl,-s

#LINKFLAGS=-L$(LIBDIR) $(LINKSTRIPFLAGS)# -static
#LINKFLAGS_D=-L$(LIBDIR) -g -static
LINKFLAGS=-L$(LIBDIR) $(SHARED_LIBRARY_R_LIST) $(LINKSTRIPFLAGS) -rdynamic # -static
LINKFLAGS_D=-L$(LIBDIR) $(SHARED_LIBRARY_R_LIST) -g -rdynamic #-static

# octtools/attache uses this
TERMLIB_LIBSPEC = -ltermcap
CURSES_LIBSPEC = -lncurses
# You may need to do something like:
#CURSES_LIBSPEC = -lcurses

#
# Variables for miscellaneous programs
#
# Used by xv
# -DXLIB_ILLEGAL_ACCESS is need for X11R6 to compile xv.c:rd_str_cl()
XV_CC =         $(CC) -DXLIB_ILLEGAL_ACCESS $(X11_INCSPEC) $(X11_LIBSPEC)
# You may need to do something like:
# XV_CC =       $(CC) -DXLIB_ILLEGAL_ACCESS $(X11_INCSPEC) $(X11_LIBSPEC) \
#               -traditional -DDIRENT
#
# Directories to use
#
# 'standard' (SLS-Debian) locations
#
#X11_INCSPEC = -I/usr/X386/include/X11
#X11INCL     = -I/usr/X386/include/X11
#X11_LIBSPEC = -L/usr/X386/lib/X11 -lX11
#
# X11R6
#
#X11_INCSPEC =  -I$(ROOT)/src/compat -I/usr/sww/X11R6/include
#X11_LIBSPEC =  -L/usr/sww/X11R6/lib -lX11
# Use -lSM -lICE for X11R6, don't use then for X11R5
X11EXT_LIBSPEC=-lXext -lSM -lICE
#
# Slackware >=1.2 locations
#
#X11INCL     = -I/usr/X11/include
X11_INCSPEC = -I/usr/X11R6/include
X11_LIBDIR  = /usr/X11R6/lib
X11_LIBSPEC = -L$(X11_LIBDIR) -lX11

# Flag that cc expects to create statically linked binaries.
# Binaries that are shipped should be statically linked.
# Note that currently vem is built with cc, not gcc, so vem uses
# this flag. See also config-g++.mk
CC_STATIC = #-static

# Matlab architecture
MATARCH = lnx86

# If you have MATLAB then you can set the environment variable MATLABDIR
# to the MATLAB root directory.
ifdef MATLABDIR
    # Check if MATLABDIR points to a MATLAB directory
    # MATLAB 4 has a static libmat.a whereas MATLAB 5 has a DLL libmat.so 
    INCLUDE_MATLAB := $(shell \
        if [ -r "$(MATLABDIR)/extern/lib/$(MATARCH)/libmat.a" -o -r 
"$(MATLABDIR)/extern/lib/$(MATARCH)/libmat.so" ]; \
        then echo yes; else echo no; echo \
        'Warning: $$MATLABDIR is not a MATLAB root dir! Ignoring setting.' \
        >&2; fi)
else
    INCLUDE_MATLAB = no
endif
# Shared library option to search MATLAB's Linux DLLs
MATLABEXTRAOPTS = -Wl,-R,$(MATLABDIR)/sys/$(MATARCH)

# If you have Mathematica then you can set the environment variable
# MATHEMATICADIR to the Mathematica root directory.
ifdef MATHEMATICADIR
    # FIXME: One should check if MATHEMATICADIR points to the right location
    INCLUDE_MATHEMATICA = yes
else
    INCLUDE_MATHEMATICA = no
endif
INCLUDE_PN_DOMAIN = no


Reply via email to