I'm working with an older proprietary FORTRAN legacy code from specific corporation (so can't post much source code), I'm having an issue with the file interactions. My compiler bash shell Install is calling make newspaper which calls a series of other functions via the makefile bash shell to create newspaper. However, when newspaper is then called within Install with an input file to compare to an output file newspaper then returns not found. I've tried opening the file newspaper to look at it for the error.
I've tried converting newspaper into text, simply yielding a text file filled with numbers. I need to read the file as "code" to figure out whats going wrong and causing not found to crop up.
For Clarification:
newspaperis a binary file as when doingless newspaperin the terminal my Linux operator said its a binary file- the calling of
newspaperinsideInstallhas the following formatnewspaper < xfile1R.in > f1.testthis is followed bydiff xfile1R.out f1.test > f1.dif - gfortran is the compiler being used in Ubuntu, the c drive is a mounted drive
- little endian should be the binary format used according to this site
I'm a noob when it comes to Linux and FORTRAN, I may just be making a rookie mistake, would really appreciate any advice, im not sure if this is a Linux or FORTRAN issue.
roman@DESKTOP-QKJTF3S:/mnt/c/Users/roman/Documents/NEWSPAPER/Newspaper/Newspaper$ sh ./Install.sh
cat makefile.sh >makefile
chmod a+x makefile
make: 'newspaper' is up to date.
./Install.sh: 10: newspaper: not found
./Install.sh: 12: newspaper: not found
./Install.sh: 14: newspaper: not found
./Install.sh: 16: newspaper: not found
./Install.sh: 18: newspaper: not found
./Install.sh: 20: newspaper: not found
84 -rwxrwxrwx 1 roman roman 83071 Feb 17 16:08 f1.dif
152 -rwxrwxrwx 1 roman roman 153543 Feb 17 16:08 f2.dif
108 -rwxrwxrwx 1 roman roman 109718 Feb 17 16:08 f3.dif
232 -rwxrwxrwx 1 roman roman 236209 Feb 17 16:08 f4.dif
164 -rwxrwxrwx 1 roman roman 166612 Feb 17 16:08 f5.dif
48 -rwxrwxrwx 1 roman roman 48898 Feb 17 16:08 f6.dif
./Install.sh: 31: Syntax error: newline unexpected
Edit 1: tried file newspaper to check PATH
roman@DESKTOP-QKJTF3S:/mnt/c/Users/roman/Documents/NEWSPAPER/Newspaper/Newspaper$ file newspaper
newspaper: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=8ac6de30da50639d7e3ea55a09416b049a5291c0, for GNU/Linux 3.2.0, not stripped
Edit 2: Make file fix?
#
# Makefile for newspaper
#
OBJF =
sfun1.o
sfun2.o
sfun3.o
sfun4.o
sfun5.o
sfun6.o
sfun7.o
FLAGS = -O2 -static -std=legacy
COMP = gfortran
newspaper: $(OBJF)
$(COMP) $(FLAGS) -o newspaper $(OBJF)
.f.o:
$(COMP) $(FLAGS) -c $< -o $*.o
Edit 3: Install error
#! /bin/csh -f
make flops
./newspaper < xfile1R.in > f1.test
diff xfile1R.out f1.test > f1.dif
./newspaper < xfile2R.in > f2.test
diff xfile2R.out f2.test > f2.dif
./newspaper < xfile3R.in > f3.test
diff xfile3R.out f3.test > f3.dif
./newspaper < xfile4R.in > f4.test
diff xfile4R.out f4.test > f4.dif
./newspaper < xfile5R.in > f5.test
diff xfile5R.out f5.test > f5.dif
./newspaper < xfile6.in > f6.test
diff xfile6.out f6.test > f6.dif
ls -als *.dif
User input for directory to put executable
if ( $1 == '' ) then
echo " "
echo -n "Enter directory for executable file: "
set Edir = $<
else
set Edir = $1
endif
if ( $Edir != '' ) then
mv newspaper $Edir
endif
Edit 4: More Syntax error, same error
./Install.sh: 30: Syntax error: newline unexpected
roman@DESKTOP-QKJTF3S:/mnt/c/Users/roman/Documents/NEWSPAPER/Newspaper/Newspaper$ ./
-bash: ./: Is a directory
roman@DESKTOP-QKJTF3S:
Edit 5: csh check
roman@DESKTOP-QKJTF3S:/mnt/c/Users/roman/Documents/NEWSPAPER/Newspaper/Newspaper$ sudo apt-get install csh
Reading package lists... Done
Building dependency tree
Reading state information... Done
csh is already the newest version (20110502-5).
0 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.
Edit 6: It worked!! Courtesy to @steeldriver for guiding myself the noob
164 -rwxrwxrwx 1 roman roman 164829 Feb 17 21:36 f1.dif
304 -rwxrwxrwx 1 roman roman 307257 Feb 17 21:36 f2.dif
216 -rwxrwxrwx 1 roman roman 217791 Feb 17 21:36 f3.dif
460 -rwxrwxrwx 1 roman roman 468651 Feb 17 21:36 f4.dif
324 -rwxrwxrwx 1 roman roman 331213 Feb 17 21:36 f5.dif
96 -rwxrwxrwx 1 roman roman 96955 Feb 17 21:36 f6.dif
Enter directory for executable file: ./Outputs
roman@DESKTOP-QKJTF3S:/mnt/c/Users/roman/
PATH? Isnewspapera statically or dynamically linked executable (what doesldd newspapersay)? – steeldriver Feb 17 '22 at 23:38PATHdoinglswill listnewspaperas in the directory. I didldd newspaperits not a dynamic executable (should it be a dynamic executable?) – The Immortal Feb 17 '22 at 23:49lslistsnewspaperdoesn't tell you that the directory is on yourPATH. Didmakesay'newspaper' is up to datethe very first time that you ran it? If so it may be an old binary that was built for a different machine architecture. Check withfile newspaper. – steeldriver Feb 17 '22 at 23:56makedoes say'newspaper' is up to dateevery time I run it. The file creatednewspaperthere's three with the same name, one is has the extension 'file' the other a 'bash shell' and the last is a 'application'. The bash shell and one with a 'file' extension are identical – The Immortal Feb 18 '22 at 00:10x86-64? Have you tried running./newspaperdirectly in the terminal (instead of viamake)? – steeldriver Feb 18 '22 at 00:57./newspaperin the terminal thenewspaperwith the Application extension is launched, this successfully runsnewspaperthe application but it requires all the inputs etc. to be input manually in the terminal, (inputs exceed 300 different values), I'm wanting to useinstallso I can input a file that is read, used, and the results are then compared to other output files. – The Immortal Feb 18 '22 at 01:18newspaperis not in yourPATH. You can either add it, or modify the Makefile to prepend./to the binary name. See Why do we use "./" (dot slash) to execute a file in Linux/UNIX?. – steeldriver Feb 18 '22 at 01:21PATH. Thanks for all your help steel – The Immortal Feb 18 '22 at 02:06Install.shfile:./newspaper < xfile1R.in > f1.test– steeldriver Feb 18 '22 at 02:09Installcode in Edit 3, I'm getting a syntax error on line 31 (which is the line whereelseis) is that because there isn't a path set in line 30? The terminal doesn't ask me to input a path for the executable, when I'm fairly sure it should given the echo statement – The Immortal Feb 18 '22 at 02:20./in response to the"Enter directory for executable file: "prompt. No need to modify the file itself. Also possibly correct the shebang from#\!to#!. – steeldriver Feb 18 '22 at 02:30Installdoes the same as before not even giving me a chance to make a response, nor printing the prompt to the terminal. I put the terminal output in Edit 4. (be aware there's still the rwxrwx output stuff from before directly above the syntax error but no need to include in edit 4) – The Immortal Feb 18 '22 at 02:39Syntax error: newline unexpectedsuggests that the script is being run by a different shell (perhapsdash). – steeldriver Feb 18 '22 at 02:53sh. Don't do that. Fix the shebang, then run it with./Install. Neither sh nor bash are any good for csh scripts, regardless of how old they are. – steeldriver Feb 18 '22 at 03:32