[xcrysden] Mac OS X (Intel) problems with xcrysden

Sohrab Ismail-Beigi xcrysden@democritos.it
Fri, 25 May 2007 00:35:49 -0400


Echoing Martin Gmitra, I'm also having serious problems with xcrysden  
on Mac OS X (Intel 10.4.9).  Here are the problems, summarized:

(1) I downloaded the binary xcrysden off the website.  The "ftnunit"  
program simply doesn't run as planned, and produces the error

dyld: Library not loaded: /usr/local/lib/libg2c.0.dylib
   Referenced from: /Users/sohrab/codes/XCrySDen-1.4.1bin/bin/ftnunit
   Reason: image not found
Trace/BPT trap

(2) This problem does not seem to be too severe.  However, when one  
executes "xcrysden" it bombs out with the following errors (Martin  
Gmitra found the same)

Running on platform: macosx
Executing: /Users/sohrab/codes/XCrySDen-1.4.1bin/bin/ftnunit

*** the hardware supports the stereo ***

Error in startup script: Togl: couldn't get visual
     while executing
"togl .mesa "
     (procedure "PlaceGlobWin" line 113)
     invoked from within
"PlaceGlobWin 0 [expr round(650 * $fac1)] [expr round(650 * $fac1)]"
     (procedure "ViewMol" line 26)
     invoked from within
"ViewMol ."
     invoked from within
"if { [llength $argv] > 2 } {
     parseComLinArg [lrange $argv 2 end]
} else {
     ViewMol .
}"
     (file "/Users/sohrab/codes/XCrySDen-1.4.1bin/Tcl/xcInit.tcl"  
line 532)

I have tried playing around *a lot* with the line inside the Tcl/ 
Viewer.tcl that calls this "togl" command and nothing helps; e.g.  
removing all the options still fails.

(3) I then decided to bite the bullet and download the xcrysden  
source code (1.4.1) without libraries.  It took a lot of trickery to  
compile it, but finally it compiled.  The fortran ftnunit now runs  
nicely.  However, now the error is different:

/Users/sohrab/codes/XCrySDen-1.4.1s/xcrysden: line 200: 21461 Bus error

As this was not very helpful, I recompiled with debugging (-g) on.  I  
noticed that the xcrysden wrapper was calling the bin/xcrys program  
via " ${XCRYSDEN_TOPDIR}/bin/xcrys ${XCRYSDEN_TOPDIR}/Tcl/xcInit.tcl  
$USE -- $XCRYSDEN_TOPDIR $XCRYSDEN_SCRATCH $ARGS >/dev/null", so I  
just launched gdb with the same.  Here is the result of running it,  
and doing the backtrace (bt):

% gdb bin/xcrys
.....
(gdb) run Tcl/xcInit.tcl -- /Users/sohrab/codes/XCrySDen-1.4.1s tmp
Starting program: /Users/sohrab/codes/XCrySDen-1.4.1s/bin/xcrys Tcl/ 
xcInit.tcl -- /Users/sohrab/codes/XCrySDen-1.4.1s tmp
Reading symbols for shared libraries ..+ 
+......................................................................+ 
+...+ done
Reading symbols for shared libraries . done
Running on platform: unix
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Taking settings for 1280x800 screen-resolution !!!
-------------------
Small  Font Size set to:   10
Normal Font Size set to:   12
Executing: /Users/sohrab/codes/XCrySDen-1.4.1s/bin/ftnunit

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000ac0
0x92b1bf5c in glLightfv ()

(gdb) bt
#0  0x92b1bf5c in glLightfv ()
#1  0x000369f0 in LoadLights () at lighting.c:414
#2  0x0003ce4a in XC_SetGLparamCmd (clientData=0x778108,  
interp=0x5e3408, argc=6, argv=0xbfffe3e0) at xcGLparam.c:733
#3  0x9ac9c1a3 in TclInvokeStringCommand ()
#4  0x9ac9e915 in TclEvalObjvInternal ()
#5  0x9acc1666 in TclExecuteByteCode ()
#6  0x9acc644e in TclCompEvalObj ()
#7  0x9aced26d in TclObjInterpProc ()
#8  0x9ac9e915 in TclEvalObjvInternal ()
#9  0x9ac9ec1c in Tcl_EvalEx ()
#10 0x9ac9f6e4 in Tcl_EvalObjEx ()
#11 0x9aca276d in Tcl_EvalObjCmd ()
#12 0x9ac9e915 in TclEvalObjvInternal ()
#13 0x9ac9ec1c in Tcl_EvalEx ()
#14 0x9acdc93a in Tcl_FSEvalFile ()
#15 0x9acdca1e in Tcl_EvalFile ()
#16 0x9ad73335 in Tk_MainEx ()
#17 0x00002d36 in main (argc=5, argv=0xbffff54c) at xcAppInit.c:424

I checked the "flLightfv()" on the web, and everything seems quite  
kosher about how it is being called in lighting.c.  The arguments are  
all quite legal.  So I'm quite stuck.

(4) I found some suggestions on previous emails from the list with  
similar problems to create a "togl.tcl" file with simple contents like

# BEGIN SCRIPT
togl .t \
     -rgba           true  \
     -redsize        1     \
< ... more stuff ... >
     -time           100
pack .t
# END SCRIPT

and to run xcrysden on this :  bin/xcrys togl.tcl.  The result is  
(backtrace)

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x5c637273
#0  0x004a9cb7 in XQueryExtension ()
#1  0x004345f3 in glXQueryExtension ()
#2  0x0008da51 in Togl_CreateWindow (tkwin=0x1183308,  
parent=18425224, instanceData=0x61a9d0) at togl.c:1639
#3  0x9ad9d1ad in Tk_MakeWindowExist ()
#4  0x0008d932 in Togl_Cmd (clientData=0x778108, interp=0x5e3408,  
argc=42, argv=0x7c3f08) at togl.c:1402
#5  0x9ac9c1a3 in TclInvokeStringCommand ()
#6  0x9ac9e915 in TclEvalObjvInternal ()
#7  0x9ac9ec1c in Tcl_EvalEx ()
#8  0x9acdc93a in Tcl_FSEvalFile ()
#9  0x9acdca1e in Tcl_EvalFile ()
#10 0x9ad73335 in Tk_MainEx ()
#11 0x00002d36 in main (argc=2, argv=0xbffff5b8) at xcAppInit.c:424

(5) I also tried endless permutations of libraries ---- I'm currently  
using the Apple X11 ones but I've also tried the XDarwin ones (i.e.  
completely changing what /usr/X11R6 and /etc/X11 contain by hand,  
etc.)  Nothing helps here.

Does anybody have any ideas?