Tcl Source Code

View Ticket
Login
Ticket UUID: 2016584
Title: Build failure under Solaris with --enable-dtrace
Type: Bug Version: obsolete: 8.5.3
Submitter: lrem Created on: 2008-07-12 12:29:32
Subsystem: 53. Configuration and Build Tools Assigned To: das
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2008-08-14 06:16:51
Resolution: Fixed Closed By: das
    Closed on: 2008-08-13 23:16:51
Description:
Current CVS Tcl fails to build under Solaris Express. It dies with:

stlib_ld () { /usr/ccs/bin/ld -r -o ${1%.a}.o "${@:2}" && /usr/ccs/bin/ar cr ${1} ${1%.a}.o ; } && stlib_ld libtclstub8.5.a tclStubLib.o  ; /usr/ccs/bin/ranlib libtclstub8.5.a
sh: bad substitution
*** Error code 1
make: Fatal error: Command failed for target `libtclstub8.5.a'

That's because of setting shell to sh and using bash syntax. Happens under both make and gmake. Attached simple patch fixes the issue for me.
User Comments: das added on 2008-08-14 06:16:51:

File Added - 288575: 2016584.diff

Logged In: YES 
user_id=90580
Originator: NO

did not find a better way, so fixed this as discussed by forcing the Makefile shell to bash on a Solaris DTrace-enabled build.

attached patch committed to all three branches
File Added: 2016584.diff

das added on 2008-07-19 05:02:01:
Logged In: YES 
user_id=90580
Originator: NO

kot, please do not add new bugreports to unrelated  bugs (and esp. not to several), please open a new issue. In any case it looks like you dtrace is too old to support USDT probes, not much we can do about that, your only option is likely to be to get a newer version of solaris.

kot added on 2008-07-19 03:15:29:
Logged In: YES 
user_id=173641
Originator: NO

I can't even begin compiling -- the first thing is does is trying to generated tclDTrace.h -- and that fails:

me@mxdevsrv:murex/tcl8.5.3/unix (619) make
/usr/sbin/dtrace -h  -o tclDTrace.h -s /export/home/me/tcl8.5.3/unix/../generic/tclDTrace.d
dtrace: illegal option -- h
Usage: dtrace [-32|-64] [-aACeFGHlqSvVwZ] [-b bufsz] [-c cmd] [-D name[=def]]
        [-I path] [-L path] [-o output] [-p pid] [-s script] [-U name]
        [-x opt[=val]] [-X a|c|s|t]

        [-P provider [[ predicate ] action ]]
        [-m [ provider: ] module [[ predicate ] action ]]
        [-f [[ provider: ] module: ] func [[ predicate ] action ]]
        [-n [[[ provider: ] module: ] func: ] name [[ predicate ] action ]]
        [-i probe-id [[ predicate ] action ]] [ args ... ]

        predicate -> '/' D-expression '/'
           action -> '{' D-statements '}'

        -32 generate 32-bit D programs and ELF files
        -64 generate 64-bit D programs and ELF files

        -a  claim anonymous tracing state
        -A  generate driver.conf(4) directives for anonymous tracing
        -b  set trace buffer size
        -c  run specified command and exit upon its completion
        -C  run cpp(1) preprocessor on script files
        -D  define symbol when invoking preprocessor
        -e  exit after compiling request but prior to enabling probes
        -f  enable or list probes matching the specified function name
        -F  coalesce trace output by function
        -G  generate an ELF file containing embedded dtrace program
        -H  print included files when invoking preprocessor
        -i  enable or list probes matching the specified probe id
        -I  add include directory to preprocessor search path
        -l  list probes matching specified criteria
        -L  add library directory to library search path
        -m  enable or list probes matching the specified module name
        -n  enable or list probes matching the specified probe name
        -o  set output file
        -p  grab specified process-ID and cache its symbol tables
        -P  enable or list probes matching the specified provider name
        -q  set quiet mode (only output explicitly traced data)
        -s  enable or list probes according to the specified D script
        -S  print D compiler intermediate code
        -U  undefine symbol when invoking preprocessor
        -v  set verbose mode (report stability attributes, arguments)
        -V  report DTrace API version
        -w  permit destructive actions
        -x  enable or modify compiler and tracing options
        -X  specify ISO C conformance settings for preprocessor
        -Z  permit probe descriptions that match zero probes
make: *** [tclDTrace.h] Error 2

das added on 2008-07-13 06:10:05:
Logged In: YES 
user_id=90580
Originator: NO

the stlib_ld hack is actually not needed on OSX, so only Solaris is concerned (and maybe FreeBSD once their dtrace support is finished)...

I agree that changing the Makefile.in to have e.g. SHELL = @MAKE_SHELL@ and setting up MAKE_SHELL in configure.in will work (i.e. to /bin/sh by default and to /bin/bash on Solaris with DTrace).

As I was never that happy with my stlib_ld() shell function solution to the STLIB_LD issue, I'd like to try to find a better solution first, if unsuccessful I will make the above change.

lrem added on 2008-07-13 05:30:46:
Logged In: YES 
user_id=2145062
Originator: YES

But we can safely assume bash is available on platforms where DTrace is available. At least for Solaris this is Solaris 10, which has it by default. And I suppose OSX isn't that different? Then we can just change the SHELL variable on seeing --enable-dtrace and everyone's happy.

das added on 2008-07-12 22:13:01:
Logged In: YES 
user_id=90580
Originator: NO

urk, good catch, thanks!
(note this only occurs with --enable-dtrace)
I don't think your fix is feasible in general however, we cannot assume bash is available on all platforms where tcl compiles...
I'd welcome other ideas on how we can define a STLIB_LD that has the desired effect (linking all object files into an intermediate object file and ar'ing that) and takes the same arguments as 'ar cr'... (besides relying on a separate script file)

lrem added on 2008-07-12 19:29:32:

File Added - 284440: tcl_solaris_build.patch

Attachments: