Closed eahmadis closed 7 years ago
OK - this is a dynamic linking error - so it is a bit different than the syntax stuff we have dealt with thus far. Will need to look a bit more.
I think maybe we could get more info on this -- what lines precede the error you are getting? It is saying that some function it is trying to link is missing. If we can find that function we may be able to see what's up.
As you noted on the stack overflow link (http://stackoverflow.com/questions/27593029/c-compile-collect2-error-ld-returned-1-exit-status) -- this can be due to a mix of executables and source code in a single archive (definitely possible here). So, the "make clean" could work, but I think that make clean may not automatically clean everything depending on how all the folders and sub-folders are compiled.
Attached is the log report file, so that you see other things that might help in figuring out this issue.
Thanks! The types of added info I was referring to above are things like:
readcontrol_wdm.f:(.text+0x44c): undefined reference to `s_copy'
getAtdep/getatdep.a(readcontrol_wdm.o):readcontrol_wdm.f:(.text+0x50a): more undefined references to `s_copy' follow
collect2: error: ld returned 1 exit status
I think you may be on the right track with the "make clean", as this error seems to indicate that some executable is being called that was compiled elsewhere. see: https://gcc.gnu.org/ml/fortran/2007-08/msg00532.html -- "make clean" tells the makefile to remove all precompiled files and start from scratch (when the compiler sees a file is already compiled it just moves on).
So, to test, I did this:
rm /opt/model/p53/p532c-ubuntu/code/src/postproc/postutils/sumin/getAtdep/getatdep.a
rm /opt/model/p53/p532c-ubuntu/code/src/postproc/postutils/sumin_QA/getAtdep/getatdep.a
Which eliminated the "collect2" errors, BUT, the getatdep.a was not compiled, so it came with a new error. So, I think that we just need to figure out how to trigger the compilation of "getatdep.f", which should then generate "getatdep.a".
In addition to removing getatdep.a I also needed to remove "main.o" in those directories, since it was preventing the recompile of main.o -- which in turn was calling getatdep.a.
rm /opt/model/p53/p532c-ubuntu/code/src/postproc/postutils/sumin_QA/getAtdep/main.o
Thanks Rob.
I see "main.f" files in those two folders and not "main.o". Is there something that I'm missing?
I removed them from the tree, hence they are missing. However, they may not compile now that getatdep.a is gone -- so we need to figure out how to compile getatdep.a and we should be in business.
No I meant I don't see them even on my local machine.
That's just an indication that they weren't compiled - the file main.o will be generated from main.f
On Tue, Apr 11, 2017 at 10:02 AM eascesharif notifications@github.com wrote:
No I meant I don't see them even on my local machine.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/rburghol/cbp_wsm/issues/4#issuecomment-293272861, or mute the thread https://github.com/notifications/unsubscribe-auth/AEXAItoYURdxKfPDnrWTim67MI2Krvv1ks5ru4fcgaJpZM4M00Hf .
My question's why we get different errors by running the same model (main.o was generated on your computer but not on mine)? Also, how should I get rid of the last collect2 error because I still get it (obviously because I didn't remove anything for the third collect2 error) and I don't have "main.o"? Should I remove "sumout.a" since it's shown right on top of this collect2 error in the log report file (attached)?
main.o was generated on your computer but not on mine)? This is likely because I forced compilation trying to see if I could get sumout.a to compile -- this should not be a concern - sorry if that comment was misleading.
Also, how should I get rid of the last collect2 error .. Should I remove "sumout.a" since it's shown right on top of this collect2 error in the log report file (attached)?
Yup - most definitely - as in other cases there appear to be multiple copies of the same file referenced in multiple places.
Ok. that's gone too for me. Here's my most recent log file. What I get (obviously) is "f77: error: No such file or directory". Thought to take these away?
Cool - in order to solve those final errors we just have to figure out how to compile "getatdep.a" and "sumout.a". I am trying to compile sumout.a manually, and what I am finding is that because they are compiled with the "-c" flag, it supresses errors. If I go to the directory and compile one at a time I am getting more errors - again the simple one with "lu" var needing a character length:
Error: Entity with assumed character length at (1) must be a dummy argument or a PARAMETER
Change:
character*(*) lu ! land use name
To:
character*3 lu ! land use name
Once I made that change in "", I can recompile and get an ok sumout.a file
Now, we need to apply the same to /getAtdep - but we need to know the proper character length of pradscen line. Did you run into that before? I copied your fix for lu from an earlier issue. See below for my how to trigger a manual compilation so that you can see the errors.
cd /opt/model/p53/p532c-ubuntu/code/src/postproc/postutils/sumin/getAtdep
$ ./compile f77
readcontrol_wdm.f:15:36:
character*(*) pradscen, psscen, sepscen
1
Error: Entity with assumed character length at (1) must be a dummy argument or a PARAMETER
readcontrol_wdm.f:15:45:
character*(*) pradscen, psscen, sepscen
1
Error: Entity with assumed character length at (1) must be a dummy argument or a PARAMETER
Thanks Rob. Do I need to edit those three .a files (getAtdep and sumout) that we removed? I saved a copy of each, but not sure if they're what you were referring to because they don't look editable.
Also, I looked into the model manual to find out about pradscen. Here's what it says:
"pradscen, metscen, atdepscen, etc: The directory name above ./input/scenario/climate/datatype/ to be used to store the output."
I see ./input/scenario/climate/met/ and ./input/scenario/climate/prad/ in the model directory on my computer.
Do I need to edit those three .a files (getAtdep and sumout) that we removed
No, these are what will be generated when we succeed in compiling after we fix the errors. The files that need to be edited are the ".f" files that have the variable declarations in them. You can find the errors by going into the sub-directory in question and compiling them manually, for example, to compile sumout.a you would fix the "character*3 lu" error in any ".f" file that it appears, then do:
cd code/src/calibration_utils/EOF_to_EOS_factors/sumout
./compile f77
Similarly, for the getatdep.a you need to fix the declaration pradscen... syntax in all ".f" files that it appears in, and do:
cd code/src/postproc/postutils/sumin/getAtdep/
./compile f77
Let me know if this is enough detail to get you started.
Cool. So, all we need to do now is to figure out what the length of those parameters is (assuming that we don't get other errors later on). Right?
That is my hope! And by using fgrep it appears that they are all 25 characters:
fgrep pradscen code/src/* -R | grep character
code/src/calibration_utils/penn_state_urban_model/readcontrol_lwdm.f: character*25 pradscen
code/src/lug/lug.inc: character*25 metscen,pradscen
code/src/postproc/data/main_pssep.f: character*25 pradscen, psscen, sepscen
code/src/postproc/data/temp: character*25 pradscen, psscen, sepscen
code/src/postproc/data/main.f: character*25 pradscen, psscen, sepscen
code/src/postproc/data/readcontrol_wdm.f: character*(*) pradscen, psscen, sepscen
...
./compile f77 compiled all the three and I didn't get any error when compiling the model. Here's the full log report:
However, I still get the same error when running the model.
Good stuff- I need a couple things to be able to help -- I don't recall what error you get when running the model :)
The error that I get when running the model is (copied a few lines before too):
HSPF simulation completed. ../../..//run/useful/random.ksh: Command not found. At line 15 of file main.f (unit = 5, file = 'stdin') Fortran runtime error: End of file ‘../../..//config/blank_wdm/river.wdm’ -> ‘PL1_5910_0001.wdm’ Land Loads and transfer wdms for p532cal_062211 PL1_5910_0001 1985 2005
PROBLEM FILE WRITTEN
Problem opening following file ../../../output/etm/p532cal_062211/A24037toPL1_5910_0001.etm
PROBLEM in etm
PROBLEM FILE WRITTEN
Problem opening following file ../../../output/etm/p532cal_062211/A24037toPL1_5910_0001.etm
OK - let's open a new thread for this. We will need you to list all of the commands that you are using to run the model as well - and where you are running from.
Had to apply this fix to: readcontrol_wdm.f
cd postproc/postutils/sumin/getAtdep/ nano ./readcontrol_wdm.f
Chnage (from "<" to ">")
< character*(*) pradscen, psscen, sepscen
---
> character*25 pradscen, psscen, sepscen
Great! do you get any compiling error now?
I just realized that the code directory was copied in there twice, (code/code) so I had to remove the original, maybe now there will be no errors.
oh ok. let me know once you get no compiling error.
Thanks! - no compile errors now :) - running the model simulation for stmary. See the other thread, closing this back up.
Here's another error that I get when compiling p532c:
"collect2: error: ld returned 1 exit status"