Ebraheem Kashkoush
Ebraheem Kashkoush

Reputation: 101

couldn't load file "/usr/lib/x86_64-linux-gnu/magic/tcl/tclmagic.so"

I have a problem with running magic vlsi. The problem is

couldn't load file "/usr/lib/x86_64-linux-gnu/magic/tcl/tclmagic.so": /usr/lib/x86_64-linux-gnu/magic/tcl/tclmagic.so: undefined symbol: Tk_GetCursorFromData

I think this caused by:

 /usr/lib/x86_64-linux-gnu/magic/tcl/magic.tcl
in line 13: load /usr/lib/x86_64-linux-gnu/magic/tcl/tclmagic.so

the file /usr/lib/x86_64-linux-gnu/magic/tcl/tclmagic.so exists

The error source in running magic is from qflow in shellscript display.sh:

#!/bin/tcsh -f
#----------------------------------------------------------
# Qflow layout display script using magic-8.0
#----------------------------------------------------------
# Tim Edwards, April 2013
#----------------------------------------------------------

if ($#argv < 2) then    echo Usage:  display.sh [options] <project_path> <source_name>    exit 1 endif

# Split out options from the main arguments (no options---placeholder only) set argline=(`getopt "" $argv[1-]`) set cmdargs=`echo "$argline" | awk 'BEGIN {FS = "-- "} END {print $2}'` set argc=`echo $cmdargs | wc -w`

if ($argc == 2) then    set argv1=`echo $cmdargs | cut -d' ' -f1`    set argv2=`echo $cmdargs | cut -d' ' -f2` else    echo Usage:  display.sh [options] <project_path> <source_name>    echo   where    echo       <project_path> is the name of the project directory containing    echo                 a file called qflow_vars.sh.    echo       <source_name> is the root name of the verilog file, and    exit 1 endif

foreach option (${argline})    switch (${option})
      case --:   break    endsw end

set projectpath=$argv1 set sourcename=$argv2 set rootname=${sourcename:h}

# This script is called with the first argument <project_path>, which should
# have file "qflow_vars.sh".  Get all of our standard variable definitions
# from the qflow_vars.sh file.

if (! -f ${projectpath}/qflow_vars.sh ) then    echo "Error:  Cannot find file qflow_vars.sh in path ${projectpath}"    exit 1 endif

source ${projectpath}/qflow_vars.sh source ${techdir}/${techname}.sh cd ${projectpath}

#----------------------------------------------------------
# Copy the .magicrc file from the tech directory to the
# layout directory, if it does not have one.  This file
# automatically loads the correct technology file.
#----------------------------------------------------------

if (! -f ${layoutdir}/.magicrc ) then    if ( -f ${techdir}/${magicrc} ) then
      cp ${techdir}/${magicrc} ${layoutdir}/.magicrc    endif endif

#----------------------------------------------------------
# Done with initialization
#----------------------------------------------------------

cd ${layoutdir}

#---------------------------------------------------
# Create magic layout (.mag file) using the
# technology LEF file to determine route widths
# and other parameters.
#---------------------------------------------------

if ($techleffile == "") then    set lefcmd="lef read ${techdir}/${leffile}" else    set lefcmd="lef read ${techdir}/${techleffile}\nlef read ${techdir}/${techleffile}" endif

# Timestamp handling:  If the .mag file is more recent
# than the .def file, then print a message and do not
# overwrite.

set docreate=1 if ( -f ${rootname}.def && -f ${rootname}.mag) then    set defstamp=`stat --format="%Y" ${rootname}.def`    set magstamp=`stat --format="%Y" ${rootname}.mag`    if ( $magstamp > $defstamp ) then
      echo "Magic database file ${rootname}.mag is more recent than DEF file."
      echo "If you want to recreate the .mag file, remove or rename the existing one."
      set docreate=0    endif endif

# The following script reads in the DEF file and modifies labels so
# that they are rotated outward from the cell, since DEF files don't
# indicate label geometry.

if ( ${docreate} == 1) then ${bindir}/magic -dnull -noconsole <<EOF drc off box 0 0 0 0 snap int ${lefcmd} def read ${rootname} select top cell select area labels setlabel font FreeSans setlabel size 0.3um box grow s -[box height] box grow s 100 select area labels setlabel rotate 90 setlabel just e select top cell box height 100 select area labels setlabel rotate 270 setlabel just w select top cell box width 100 select area labels setlabel just w select top cell box grow w -[box width] box grow w 100 select area labels setlabel just e save ${sourcename} quit -noprompt EOF

endif

# Run magic and query what graphics device types are
# available.  Use OpenGL if available, fall back on
# X11, or else exit with a message

${bindir}/magic -noconsole -d <<EOF >& .magic_displays exit EOF

set magicogl=`cat .magic_displays | grep OGL | wc -l` set magicx11=`cat .magic_displays | grep X11 | wc -l`

rm -f .magic_displays

# Run magic again, this time interactively.  The script
# exits when the user exits magic.


#if ( ${magicogl} >= 1 ) then    magic -d OGL ${rootname}  if ( ${magicx11} >= 1) then    magic -d X11 ${rootname} else    echo "Magic does not support OpenGL or X11 graphics on this host." endif

#------------------------------------------------------------
# Done!
#------------------------------------------------------------

enter image description here

How can I fix this problem?

Upvotes: 1

Views: 1706

Answers (3)

Ebraheem Kashkoush
Ebraheem Kashkoush

Reputation: 101

magic- configure... : ./configure --with-tcl=/opt/ActiveTcl-8.6 --with-tk=/usr/local/lib/tk8.6

qflow- configure... : ./configure --with-magic=/usr/local/bin/magic

after install qflow

sudo apt-get magic (it will download magic 7.5 with out overwrite magic 8.0 we only need .so file from there)

open /usr/local/lib/magic/tcl/magic.tcl (as sudo)

and edit line 13 to: load -lazy /usr/lib/x86_64-linux-gnu/magic/tcl/tclmagic.so

Upvotes: 0

Tim Edwards
Tim Edwards

Reputation: 1

This is a known problem (and a very annoying one) that comes from some OS versions' runtime linker not wanting to link a file that contains a reference to an unknown routine, even if that routine is never called. In this case, Tcl is being run without Tk graphics, and so the base Tcl object library doesn't have any Tk routines defined, and the linker stops on the first such routine that shows up (Tk_GetCursorFromData). For some reason the Fedora linker (or something about my setup) doesn't do this, or else I would have fixed the problem a long time ago. As it is, I only fixed it recently, and the solution is in the most recent version of magic-8.1. Since you have Tcl/Tk 8.6, this solution should work (the solution only works with Tcl/Tk 8.6). You can update to the most recent magic version 8.1, or you can just edit the file magic.tcl (in the source, it's tcltk/magic.tcl.in, and installed, it's /usr/local/lib/magic/tcl/magic.tcl). At line 13, add the switch -lazy to the load command:

load -lazy /usr/local/lib/magic/tcl/tclmagic.so

Upvotes: 0

R. Timothy Edwards
R. Timothy Edwards

Reputation: 11

I should amend my answer, since it sounds like magic may be invoking Tcl 8.5 instead of 8.6, which may have happened if you downloaded magic as a package. The "-lazy" option to "load" was only implemented in Tcl 8.6, so it's not going to work at all in Tcl 8.5. I would suggest getting magic from opencircuitdesign.com and compiling from source, which usually has no problems on Linux systems. The autoconf script should be able to find Tcl version 8.6.

You can also just ignore the "display" option in qflow and run magic interactively. Use the "lef read" command to read in the standard cell definitions, then "def read" to read in the routed layout from qflow.

Upvotes: 1

Related Questions