What happened to this site? And what's that frog about?

Critcl Config macosx bugs

F149 - Failure Feedback Forum 

Status: Severity: failure Category: Critcl Created: 2007-03-31 Updated: 2007-12-01

This concerns Critcl 2.0, more precisely its config file (v 1.12 2006/08/25 09:05:28), and more precisely still the -macosx branch. First there's a bunch of things which throw errors at [package require] time, and then there's a test for setting $universal which returns 1 when it shouldn't, causing compilation to fail.

All of the bugs are inside the

  if {[string match *-macosx $platform]} {

and the first two are in the else branch of

      if {[info exists ::env(SDKROOT)]} {

First there is a loop for initialising $sdklist, and then there is a test

         if {[llength $sdklist]} {

but $sdklist is only set if something gets [lappend]ed to it, so the test will error out in cases where it was meant to return false.

Fix#1: Insert an

        set sdklist {}

before the loop.

Then there is a problem with the [glob] of the loop. I don't have any SDKs installed (gcc seems to handle simple stuff well enough anyway), so that [glob] throws an error.

Fix#2: Add -nocomplain to the switches of [glob].

So, now $SDKROOT is set to an empty string and we happily chew along into the else branch of

    if {$SDKROOT ne ""} {

just to choke on the [lassign]. Why? Because the Config code is being evaluated in a slave interpreter, and critcl.tcl only created [lassign] in the master.

Fix#3: Rewrite that [lassign] using good old [foreach ... break], i.e.,

        foreach {v1 v2 v3} [split $::tcl_platform(osVersion) .] break

Now we get to the final bug, which I don't know how to fix (but I was at least able to get my work done by hardwiring the test result). The offending piece of code is

    catch {
        set universal [expr {[exec gcc -v -arch ppc > /dev/null 2>@stdout] eq "" \
                && [exec gcc -v -arch i386 > /dev/null 2>@stdout] eq ""}]
    }

which for me sets universal to 1 although it should be 0. The catch seems to be that gcc doesn't complain about unknown architectures; I get the following for the two [exec]s above:

  lars% gcc -v -arch ppc
  Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
  Thread model: posix
  gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
  lars% gcc -v -arch i386
  Using built-in specs.
  Thread model: posix
  gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)

This seem relevant for the following comment (found in the end of the same else branch as Fix#3 above):

        # do we actually need to check if universal is supported, give then
        # gcc check below will do it for us?
        # set info [exec lipo -info /usr/lib/libSystem.dylib]
        # set plats [split [string trim [lindex [split $info :] 2]]]

Finally, if I let $universal be 1 instead I get the following error when compiling. The error itself may well be natural when universal binaries are not supported, but the command line casuing it seems malformed: the explicit $SDKROOT and -mmacosx-version-min=$osxmin items in the command line suggest that variable substitution isn't carried out as the person who wrote the Config file expected.

  gcc -c -arch i386 -arch ppc -isysroot $SDKROOT -mmacosx-version-min=$osxmin  -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1     -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1   -DTCL_THREADS=1 -DUSE_TCL_STUBS -I/Users/lars/.critcl/universal-macosx -o /Users/lars/.critcl/universal-macosx/v20_58fdecc273235338f39746080f17f1ee_pic.o /Users/lars/.critcl/universal-macosx/v20_58fdecc273235338f39746080f17f1ee.c -O2 -DNDEBUG
  gcc: cannot specify -o with -c or -S and multiple compilations

Summary

Thanks Lars. I've applied your 3 fixes to the latest code in svn (it's a private repository until I can upgrade the equi4.com server to support svn). I've also notified Steve Landers, who is the primary author of the critcl2 changes. -jcw

(you can post a comment on this page using pw 'columnwise')

Thanks Lars - I didn't have a non-universal tolchain to test with, so that was a "best guess" and I appreciate your corrections - stevel



2007-03-31 Lars Hellstr�m

Imported

2007-06-21

(Changed: stat desc)

2007-06-21 jcw

(Changed: stat)

2007-11-20 xyutwc

want delete your site from spam bases? mail your domen andydelay(at)gmail.com. EBALOKROTA

2007-11-21 xyutne

want delete your site from spam bases? mail your domen andydelay(at)gmail.com. EBALOKROTA

2007-11-21 xyulkx

want delete your site from spam bases? mail your domen andydelay(at)gmail.com. EBALOKROTA

2007-11-21 xyuhum

want delete your site from spam bases? mail your domen andydelay(at)gmail.com. EBALOKROTA

2007-11-21 xyuhyq

want delete your site from spam bases? mail your domen andydelay(at)gmail.com. EBALOKROTA

Add a comment:

Tip: add empty lines between paragraphs and indent lines to prevent reformatting.

Your name or initials:  

Powered by Mavrig