build.bash problem

Frequently Asked Questions about ROMS usage

Moderators: arango, kate, robertson

Post Reply
Message
Author
User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

build.bash problem

#1 Unread post by kate »

I am following the tutorial: Installing ROMS in Windows XP/Vista (via Cygwin) but when i was trying to compile i get this error:

$ ./build.bash
./build.bash: line 40: $'\r': command not found
./build.bash: line 43: $'\r': command not found
./build.bash: line 46: syntax error near unexpected token `$'in\r''
'/build.bash: line 46: ` case "$1" in

does any one can help me with this, thanks in advance.
The problem here is having run svn on the Windows file system, then expecting Cygwin to parse the files. Your options are to run dos2unix on build.bash and any other troublesome files or to run svn from the same operating system on which you will run the scripts.

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: build.bash problem

#2 Unread post by lalvarez »

I have had the same problem (errors and lines) when compilling the build.bash, trying to run the upwelling example, Did you get a solution for this? How the script have to be changed to get a good compillation?

seashellingolds
Posts: 39
Joined: Wed Jun 25, 2008 2:49 am
Location: Georgia Institute of Technology

Re: build.bash problem

#3 Unread post by seashellingolds »

just see this old thread with new reply by chance.

I guess the problem is the difference between window and linux text system

Windows follows the rule of old-style typewriter. Two steps is needed to get to the next line \r (return) \n (jump to next line), while linux just has \n doing this altogether. So linux script would not recognize \r which is only valid in Windows

The solution is just simply deleting \r

glejin
Posts: 2
Joined: Sat Dec 11, 2010 3:09 pm
Location: nio

Re: build.bash problem

#4 Unread post by glejin »

I also had the same problem in Cygwin in windowsXP.As in one of the replay i tried to delete '\r'.But i am not able to see such scripts in build.bash.please help me to solve this problem.i am just trying to run the upwelling application following tutorials.

nganju
Posts: 82
Joined: Mon Aug 16, 2004 8:47 pm
Location: U.S. Geological Survey, Woods Hole
Contact:

Re: build.bash problem

#5 Unread post by nganju »

the command "dos2unix" will convert the file, as in "dos2unix build.bash"

whcsimon
Posts: 3
Joined: Wed Jun 22, 2011 1:49 pm
Location: Stanford University

Re: build.bash problem

#6 Unread post by whcsimon »

I got the same problem. Fixed it by editing using notepad++
http://notepad-plus-plus.org/

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: build.bash problem

#7 Unread post by m.hadfield »

The *best* solution, as has been reported elsewhere, is to download ROMS using Cygwin's svn command.

huangxh
Posts: 0
Joined: Sun Sep 05, 2010 4:05 pm
Location: Institute of Geology and Geophysics, CAS

Re: build.bash problem

#8 Unread post by huangxh »

This is my first time of using ROMS.

I checkout the latest version using Subversion, then, change directory to /ROMS/Bin, and run ./build.bash

Here I have a problem:
./build.bash: line 397: cd: /root/ocean/repository/trunk: no such file or directory
make: *** ... ...“clean”. stop.
make: *** ... ...makefile. stop.

I am not very familiar with Linux.
May somebody tell me what should I do? Should I change something in the file build.bash or something?

Thanks very very much!!

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: build.bash problem

#9 Unread post by m.hadfield »

(Sorry about the raw BBCode tags in the following. For some reason BBCode processing is turned off.)

[quote="huangxh"]Should I change something in the file build.bash or something?[/quote]

Indeed you should. Line 397 of build.bash is
[code] cd ${MY_ROMS_SRC}[/code]
and the directory pointed to by MY_ROMS_SRC is /root/ocean/repository/trunk, which does not exist on your system. Going back to line 102 you can see
[code] export MY_ROMS_SRC=${MY_ROOT_DIR}/trunk[/code]
and back to line 88
[code]export MY_ROOT_DIR=${HOME}/ocean/repository[/code]
So $HOME on your system appears to be "/root" which is rather odd. Are you logged in as the root user? I am no Unix expert, but I think that this is not a good idea.

Anyway, the first thing you need to do in order to build ROMS with this script is to set MY_ROMS_SRC to the directory into which you check out the code (i.e. the one that contains makefile and several subdirectories, including one called ROMS). The value of MY_ROOT_DIR doesn't matter as such, as the only place it's used is in setting MY_ROMS_SRC, so you can delete the references to it. There are a bunch of other variables in build.bash that might need to be changed.

But before you do this I suggest you consider setting up an ordinary user account and checking out ROMS into that.

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: build.bash problem

#10 Unread post by m.hadfield »

I have a further suggestion: check out a copy of the test subdirectory

https://www.myroms.org/svn/src/test/

Now go to the upwelling subdirectory, where you will find a build.bash script very similar to the one you ran before. Modify and run that script, leaving the files in your ROMS tree unmodified. I think it's cleaner that way. There are several other test cases you can run, and they come with all the necessary input files.

mengqingjun
Posts: 34
Joined: Sat Sep 08, 2012 2:15 pm
Location: Ocean University Of Cina

Re: build.bash problem

#11 Unread post by mengqingjun »

I have the same problem. I need hellp! Thanks!
I had a problem when I am compiling my ROMS downloaded via the svn。I used Cygwin.When I input the commend:"./build.bash",it showed:
"./buid.bash: line 397 cd: /home/mengqingjun/ocean/repository/trunk: No such file or directory
meke:***没有规则可以创建目标“clean”.停止
meke:***没有指明目标并且找不到“makefile”.停止”
I don't know why ,I need you help !
Many Thanks,best wishes!

Post Reply