All Forums |
Register |
Login |
Search |
Subscriptions |
My Profile |
Inbox |
Tool Warehouse |
FAQs |
Resources |
Help |
Member List |
Address Book |
Logout |
|
|
Why won't my scripts work???????
|
Logged in as: Guest |
Users viewing this topic: none |
|
Login |
|
|
Why won't my scripts work??????? - Dec. 3, '05, 1:18:52 AM
|
|
|
marcdevon
Posts: 4
Joined: Dec. 2, '05,
Status: offline
|
Dear Group
I am so frustrated with SFU. A make script that I use to build some ported applications, which easily worked using Cygwin, doesn't work on with SFU . What I do is set the path name in C , Bash, or Korn Shell. The make script itself will partially run but all other scripts and files that it references are not recognized even though they are within the directly in the PATH that I defined or in a sub-folder. Basically, I get an error message that readss ""filename": No such file or directory". What's going wong? Why does SFU have to be such a pain in the a$$? Any help would be GREATLY appreciated.
Marcus
< Message edited by marcdevon -- Dec. 3, '05, 1:34:31 AM >
|
|
|
RE: Why won't my scripts work??????? - Dec. 3, '05, 3:25:00 AM
|
|
|
Rodney
Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
|
You will need to provide at least one example of what you find is not working.
Scripts are run all the time, so your example is important for use to determine what you need to change.
|
|
|
RE: Why won't my scripts work??????? - Dec. 3, '05, 8:57:29 AM
|
|
|
marcdevon
Posts: 4
Joined: Dec. 2, '05,
Status: offline
|
Thanks for the reply. This not my script per se but it is a makefile that is used to build Radiance, a rendering program written by Greg Ward. Here is a cut and paste of it. I hope that it isnt too long:
#!/bin/csh -f
# RCSid $Id: makeall,v 1.21 2005/09/21 17:17:23 greg Exp $
#
# Make all the Radiance programs
#
if ( $#argv < 1 ) then
echo "Usage: makeall install [clean] [make options]"
echo " or: makeall clean"
echo " or: makeall library"
exit 1
endif
if ( "$1" == library ) then
source installib
cp -f src/*/*.{cal,tab,hex} $ldir
echo ""
echo "Set the environment variable RAYPATH=.:$ldir"
echo 'For C-shell users, put the following into ~/.cshrc'
echo " setenv RAYPATH .:$ldir"
echo 'For Bourne shell users, put the following into $HOME/.profile'
echo " RAYPATH=.:$ldir"
echo " export RAYPATH"
echo ""
exit 0
endif
set srcdirs=( common rt meta cv gen ot px hd util cal )
if ( "$1" == install ) then
cat << _EOF_
`cat src/rt/VERSION` INSTALLATION
This script rebuilds all of the Radiance programs and installs
them on your system. You should read the file README before running
this script. You can type ^C (followed by return) at any time to abort.
You must first answer the following questions.
_EOF_
if ( ! $?EDITOR ) then
echo -n "What is your preferred editor [vi]? "
set ans="$<"
if ( "$ans" != "" ) then
setenv EDITOR "$ans"
else
setenv EDITOR vi
endif
endif
again1:
echo -n "Where do you want the executables [/usr/local/bin]? "
set idir=$<
(echo $idir) >/dev/null
if ( $status ) then
goto again1
endif
set idir=$idir
if ( "$idir" == "" ) then
set idir=/usr/local/bin
else if ( "$idir" !~ /* ) then
echo "Directory must be relative to root, please reenter"
goto again1
endif
if ( ! -d $idir ) then
mkdir $idir
if ( $status ) then
echo "Cannot create directory, please reenter"
goto again1
endif
endif
if ( ! -d $idir/dev ) then
mkdir $idir/dev
if ( $status ) then
echo "Cannot create subdirectory, please reenter"
goto again1
endif
endif
set inpath=0
foreach i ( $path )
if ( "$i" == "$idir" ) then
set inpath=1
break
endif
end
set rmake=$idir/rmake
if ( "`ls -tL $rmake $0 |& head -1`" == $rmake ) then
goto gotrmake
endif
set newrmake
more src/common/copyright.h
echo -n "Do you understand and accept the terms of this agreement [n]? "
set ans="$<"
if ( "$ans" !~ [yY]* ) exit
set special=
set arch=
set opt=
set mach=
set compat=
set extras=
set esuffix=
cat << _EOF_
Please select your system type from the following list:
1) Sun Solaris
2) HP workstation
3) Silicon Graphics
4) AIX (RS/6000)
5) BSDI BSD/386
6) Linux
7) MacOS X
8) FreeBSD
9) Cygwin
10) Other
_EOF_
echo -n "Choice? "
set arch="$<"
switch ("$arch")
case 1: # SPARC Station
set arch=sun
set mach="-I/usr/openwin/include -L/usr/openwin/lib -DNOSTEREO"
set opt="-O"
set compat="strcmp.o"
breaksw
case 2: # HP workstation
set mach=""
set opt="-O -Aa -D_HPUX_SOURCE"
set compat="strcmp.o"
set arch=hpux
breaksw
case 3: # Silicon Graphics
set arch=sgi
switch (`uname -r`)
case 3.*:
set mach="-noprototypes"
set opt="-O"
set special="sgi"
set compat="strcmp.o"
breaksw
case 4.*:
set mach=""
set opt="-O2"
set compat="strcmp.o"
set extras='"MLIB=-lfastm -lm"'
breaksw
default: # 5.x or later
ln -s `which wish` $idir/wish4.0
set path=($idir $path)
set mach="-w"
set opt="-O2"
set special="ogl"
set compat="strcmp.o"
breaksw
endsw
breaksw
case 4: # AIX
set opt="-O"
set compat="erf.o strcmp.o"
set arch=PowerPC
breaksw
case 5: # BSDI BSD/386
set mach="-DBSD -L/usr/X11/lib -I/usr/X11/include"
set opt="-O"
set arch=IBMPC
set compat="erf.o strcmp.o"
breaksw
case 6: # Linux
set mach="-Dlinux -D_FILE_OFFSET_BITS=64 -Dfseeko=fseek -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO"
set opt="-O2"
set arch=IBMPC
set compat="erf.o"
set extras=CC=gcc
breaksw
case 7: # MacOS X
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
set opt="-O2"
set arch=PowerPC
set extras="CC=cc CONFIGURE_ARCH=powerpc"
set special="ogl"
breaksw
case 8: # FreeBSD
set mach="-DBSD -DNOSTEREO -Dfreebsd -I/usr/X11R6/include -L/usr/X11R6/lib"
set opt="-O"
set compat="erf.o"
set extras='CC=cc MLIB="-lcompat -lm"'
set arch=IBMPC
breaksw
case 9: # Cygwin
set mach="-Dfreebsd -L/usr/lib -L/usr/X11R6/lib -I/usr/include/X11 -I/usr/X11R6/include -DNOSTEREO"
set opt="-O2"
set arch=IBMPC
set compat="erf.o"
set extras="CC=gcc"
set special="ogl"
set esuffix=".exe"
breaksw
case 10: # Other
set opt="-O"
set compat="erf.o strcmp.o"
echo -n "Are you using the GNU C compiler [n]? "
if ( "$<" =~ [yY]* ) then
set extras="CC=gcc"
endif
set arch=other
breaksw
default:
echo "Illegal choice\!"
echo "Installation aborted."
exit 1
breaksw
endsw
source installib
sed 's/[ ]*$//' > $rmake << _EOF_
#!/bin/sh
exec make "SPECIAL=$special" \
"OPT=$opt" \
"MACH=$mach" \
ARCH=$arch "COMPAT=$compat" \
INSTDIR=$idir \
LIBDIR=$ldir \
ESUFFIX=$esuffix \
$extras "\$@" -f Rmakefile
_EOF_
chmod 755 $rmake
chmod 644 src/*/Rmakefile src/rt/devtable.c
gotrmake:
echo "Current rmake command is:"
cat $rmake
echo -n "Do you want to change it? "
set ans="$<"
if ( "$ans" =~ [yY]* ) then
cp $rmake /tmp/rmake$$
$EDITOR $rmake
if ( `cat $rmake /tmp/rmake$$ | grep OPT= | uniq | wc -l` == 2 ) set newrmake
rm -f /tmp/rmake$$
endif
if ( ! -d src/lib ) then
mkdir src/lib
endif
if ( $?newrmake ) then
echo 'New rmake command -- running "makeall clean"...'
csh -f $0 clean
endif
cd src
echo "Making programs..."
set errs=0
foreach i ( $srcdirs )
pushd $i
echo "In directory $i..."
$rmake -k $*
@ errs += $status
popd
end
if ( $errs ) then
echo "There were some errors."
else
echo "Done."
endif
cd ..
if (! $inpath ) then
echo ""
echo "Add $idir to the beginning of your execution path:"
echo 'For C-shell users, put the following into ~/.cshrc'
echo " set path=( $idir "'$path )'
echo 'For Bourne shell users, put the following into $HOME/.profile'
echo " PATH=$idir"':$PATH'
echo " export PATH"
endif
else
cd src
foreach i ( $srcdirs )
pushd $i
echo "In directory $i..."
make -f Rmakefile $*
popd
end
cd ..
foreach i ( $* )
if ( "$i" == clean ) then
echo "Removing library archives..."
rm -f src/lib/*.{a,o,la}
endif
end
echo "Done."
endif
exit 0
The first sign of a problem comes when it says that it can not find src/common/copyright.h. Basically, this script is in the folder, "ray", which I place with the folder "SFU. If I am correct, SFU is the root directory. I set the PATH by the following in Korn Shell:
export PATH="$PATH:/ray"
When I do this, I can begin to run this makefile. However, as I previously mentioned, the first problem arises when I receive the folllowing error message:
src/common/copyright.h: No such file or directory
Once I have set the PATH, shouldn't it automatically search the subdirectories of the PATH that I have set. It says that it can not find src/common/copyright.h. Heck, I have even gone to the extent of set /ray/src/common as a PATH. This still doesn't work.
This error dosn't completely hault the script. It list the error and proceeds but I know that this is a problem. The fatal error comes when I receive the error message:
installib: No such file or directory.
installib is a script that the main makefile calls to install the basic library files for Radiance. This script lies in the same directory as the makefile. It should be able to execute this script but it says that it can not find it. I am stumped. I have successfully run this makefile using Linu and Cygwin but SFU, no dice. Please help.
Marcus
< Message edited by marcdevon -- Dec. 3, '05, 9:13:56 AM >
|
|
|
RE: Why won't my scripts work??????? - Dec. 3, '05, 5:34:08 PM
|
|
|
markfunk
Posts: 670
Joined: Mar. 31, '03,
Status: offline
|
You are running this makeall script in the directory
where the src/ directory is, right ?
This should be the directory where the file "installlib" exists.
What you should do is add the line "set verbose"
to this script on line 6.
Then run it and watch what commands are executed.
And you'll see which line of the script the errors are coming from
and you should be able to figure out what's wrong.
I'm not sure how setting PATH will fix your current problems.
|
|
|
RE: Why won't my scripts work??????? - Dec. 4, '05, 6:08:48 AM
|
|
|
jon493
Posts: 56
Joined: Oct. 14, '05,
Status: offline
|
<rant>
OOOOOOOOOOO, scripting troubles, and that too with tcsh! I can already feel my (UPDATE: your )a$$$$$$$$$$$$$$$$$$ hurting. Was that enough $'s?
</rant>
Sorry. Now let us get to business.
While we are playing with path, did you try
export PATH=.:$PATH
to set the current directory in PATH?
I am also not sure what PATH would do but still?
< Message edited by jon493 -- Dec. 4, '05, 6:09:58 AM >
|
|
|
RE: Why won't my scripts work??????? - Dec. 9, '05, 4:12:22 PM
|
|
|
marcdevon
Posts: 4
Joined: Dec. 2, '05,
Status: offline
|
Thanks everyone for their help. I have found why my scripts won't run. I admit that I am not a UNIX expert. I think my problem had something to do with the difference in behavior between Linux/Cygwin shells and SFU. My understanding is that SFU is UNIX-like. When I read through the installation manual for compiling the program, it gave instructions as to how to install for UNIX users. It was:
./makeall install
When I tried this, the script ran.
Thanks again
Marcus
|
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
|
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts |
|
|
|