Comments (21)
I'm pretty sure this is an obscure compiler optimization issue, caused by macs using an older version of the gfortran compiler. I think it can be fixed by using a lower optimization setting.
To do that, first download this repository. Then create a file called Makevars
in the src
directory. Inside the Makevars file, put
mypackage_FFLAGS = $(FPICFLAGS) $(SHLIB_FFLAGS)
all: $(SHLIB)
dwnom3.o: dwnom3.f
$(F77) $(mypackage_FFLAGS) -O1 -pipe -g -c -o dwnom3.o dwnom3.f
Now open the terminal and run
R CMD INSTALL path/to/dwnominate-master
If you can confirm that it works after that I'll try to set up a Makevars here to make that happen automatically. Should've done that a long time ago.
Oh! And can you please tell me what you get when you run gfortran --version
in your terminal?
from dwnominate.
Thank you for the fast answer! I tried this, but I get the following errors in the terminal when running the INSTALL command:
* installing to library '/Library/Frameworks/R.framework/Versions/3.4/Resources/library'
* installing *source* package 'dwnominate' ...
** libs
gfortran -fPIC -g -O2 -c Makevars.f -o Makevars.o
Makevars.f:1:1:
mypackage_FFLAGS = $(FPICFLAGS) $(SHLIB_FFLAGS)
1
Error: Non-numeric character in statement label at (1)
Makevars.f:1:20:
mypackage_FFLAGS = $(FPICFLAGS) $(SHLIB_FFLAGS)
1
Error: Invalid character in name at (1)
Makevars.f:2:1:
all: $(SHLIB)
1
Error: Non-numeric character in statement label at (1)
Makevars.f:2:1:
all: $(SHLIB)
1
Error: Unclassifiable statement at (1)
Makevars.f:3:1:
dwnom3.o: dwnom3.f
1
Error: Non-numeric character in statement label at (1)
Makevars.f:3:1:
dwnom3.o: dwnom3.f
1
Error: Unclassifiable statement at (1)
Makevars.f:4:5:
$(F77) $(mypackage_FFLAGS) -O1 -pipe -g -c -o dwnom3.o dwnom3.f
1
Error: Non-numeric character in statement label at (1)
Makevars.f:4:5:
$(F77) $(mypackage_FFLAGS) -O1 -pipe -g -c -o dwnom3.o dwnom3.f
1
Error: Unclassifiable statement at (1)
make: *** [Makevars.o] Error 1
ERROR: compilation failed for package 'dwnominate'
* removing '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/dwnominate'
* restoring previous '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/dwnominate'
I am not sure, whether I did the part with the Makevars-file right. Is this supposed to be a .f Fortran file or does it have to have some other extension than Makevars.f
?
The gfortran --version
command gives me the following output:
GNU Fortran (GCC) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Thank you very much for your help!
from dwnominate.
Just name the file Makevars
-- no extension.
You actually have a newer gfortran version than I do. Strange.
from dwnominate.
aah, thank you. I have gotten the following error in the terminal now, though:
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library’
* installing *source* package ‘dwnominate’ ...
** libs
Makevars:4: *** missing separator. Stop.
ERROR: compilation failed for package ‘dwnominate’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/dwnominate’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/dwnominate’
Does the R CMD INSTALL path/to/dwnominate-master
command automatically compile the "dwnom3.f" file with gfortran or do I have to do this separately by calling gfortran
somehow?
I am sorry, as mentioned above, I am new to Fortran and its surroundings so my questions might be somewhat arbitrary sometimes...
from dwnominate.
I got the same error earlier when the last line of Makevars
started with spaces instead of a tab. So make sure that line starts with a tab (maybe it got copied incorrectly somehow) and try it.
I don't know all of the details about how R CMD INSTALL
finds your fortran compiler but yes it usually compiles fortran with gfortran.
I'm not so big on fortran myself-- I wrote this R package so I could avoid it. :)
from dwnominate.
Alright, now it installed something, but after trying to run it in R it still aborts after the W-NOMINATE estimation. By the way, it creates all the files it needs to create (e.g. "DW-NOMSTART.DAT" and "DWNOM21.DAT") and aborts after that.
When installing with the terminal, i have gotten a bunch of error messages, maybe this has something to do with it:
* installing to library '/Library/Frameworks/R.framework/Versions/3.4/Resources/library'
* installing *source* package 'dwnominate' ...
** libs
gfortran -fPIC -O1 -pipe -g -c -o dwnom3.o dwnom3.f
dwnom3.f:6848:72:
10 ASSIGN 30 TO NEXT
1
Warning: Deleted feature: ASSIGN statement at (1)
dwnom3.f:6853:16:
20 GO TO NEXT, (30, 40, 70, 80)
1
Warning: Deleted feature: Assigned GOTO statement at (1)
dwnom3.f:6855:72:
ASSIGN 40 TO NEXT
1
Warning: Deleted feature: ASSIGN statement at (1)
dwnom3.f:6861:72:
ASSIGN 70 TO NEXT
1
Warning: Deleted feature: ASSIGN statement at (1)
dwnom3.f:6865:72:
ASSIGN 80 TO NEXT
1
Warning: Deleted feature: ASSIGN statement at (1)
dwnom3.f:5684:46:
& ' specified. ', MSGLEN, MSGSAV, MSGLEN)
1
Warning: Rank mismatch in argument 'str2' at (1) (scalar and rank-1)
dwnom3.f:6443:37:
& '1. ', MSGLEN, MSGSAV, MSGLEN)
1
Warning: Rank mismatch in argument 'str2' at (1) (scalar and rank-1)
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o dwnominate.so dwnom3.o -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: could not create compact unwind for _search_: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _dwnominate_: stack subq instruction is too different from dwarf stack size
installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/dwnominate/libs
** R
** preparing package for lazy loading
** help
No man pages found in package 'dwnominate'
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (dwnominate)
from dwnominate.
Can you send me the data and script you're using? Then I could see if it runs for me, suggesting a compiler issue. If I get the segfault too then the problem is probably somewhere else.
In the meantime you can try replacing -O1
with -O0
(no compiler optimization at all) and see if that works.
from dwnominate.
I have sent it to your email. I tried the --O0 version as well, which did not work as well...
from dwnominate.
Alright. The example worked for me. (You were testing this with just the two sessions, right?) I'm using gfortran 5, so if you're able to switch your gfortran version that's worth a try.
I'll experiment with gfortran 6 to see if I can find the issue, but I have no idea how long that'll take me.
from dwnominate.
Alright, good to hear that it at least could work with my data. ;) Yes, I was testing it with two sessions, I have data for the last 20 years.
I installed gfortran 5.2 and uninstalled my version first, but got the same errors when running R CMD INSTALL
and my R session still aborted at the same point.
from dwnominate.
Which macos do you use by the way (I use 10.12.5)? Maybe it has something to do with that? Or with the R version (I use 3.4.1 now).
from dwnominate.
I'm on Linux (Ubuntu 16.04), and I also have R 3.4.1. My specific gfortran version is 5.4.0.
from dwnominate.
Oh, so if you use Linux, it might be a problem with mac? I think gfortran 5.4 does not exist for mac, at least not here.
from dwnominate.
OK, I got some advice from my local fortran guru.
Add -fbacktrace
to the last line of Makevars. Then when you run this and get the segfault it should print out some useful information about what went wrong.
You can also try running ulimit -s unlimited
in a terminal, and then run R in that terminal and try dwnominate there, which will help if your operating system is not allowing dwnominate to use the resources it requires.
from dwnominate.
Alright, this is what the terminal printed when using -fbacktrace
in the last line of Makevars:
* installing to library '/Library/Frameworks/R.framework/Versions/3.4/Resources/library'
* installing *source* package 'dwnominate' ...
** libs
gfortran -fPIC -O1 -pipe -g -c -o dwnom3.o dwnom3.f -fbacktrace
dwnom3.f:6848:72:
10 ASSIGN 30 TO NEXT
1
Warning: Deleted feature: ASSIGN statement at (1)
dwnom3.f:6853:16:
20 GO TO NEXT, (30, 40, 70, 80)
1
Warning: Deleted feature: Assigned GOTO statement at (1)
dwnom3.f:6855:72:
ASSIGN 40 TO NEXT
1
Warning: Deleted feature: ASSIGN statement at (1)
dwnom3.f:6861:72:
ASSIGN 70 TO NEXT
1
Warning: Deleted feature: ASSIGN statement at (1)
dwnom3.f:6865:72:
ASSIGN 80 TO NEXT
1
Warning: Deleted feature: ASSIGN statement at (1)
dwnom3.f:5684:46:
& ' specified. ', MSGLEN, MSGSAV, MSGLEN)
1
Warning: Rank mismatch in argument 'str2' at (1) (scalar and rank-1)
dwnom3.f:6443:37:
& '1. ', MSGLEN, MSGSAV, MSGLEN)
1
Warning: Rank mismatch in argument 'str2' at (1) (scalar and rank-1)
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o dwnominate.so dwnom3.o -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: could not create compact unwind for _search_: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _dwnominate_: stack subq instruction is too different from dwarf stack size
installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/dwnominate/libs
** R
** preparing package for lazy loading
** help
No man pages found in package 'dwnominate'
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (dwnominate)
I'm not sure whether it is that much different from the output I got before.
from dwnominate.
This is interesting! I was not able to change the ulimit (it might not be possible on mac), but I nevertheless ran everything in an R session in the Terminal. And this did not just break down like R does, but it gave me a specific error message:
Writing input files...
r
r
l
l
s
r
t
N
2 1 1 2 2 5
At line 157 of file dwnom3.f
Fortran runtime error: Expected REAL for item 2 in formatted transfer, got CHARACTER
(15F8.4)
^
Maybe this helps you find out where the problem is?
Thank you!
from dwnominate.
Can you send me your DW-NOMSTART.DAT
file? It looks like it's not being read or written correctly.
For example, here's what my DW-NOMSTART.DAT
looked like when I ran your example:
rollcall_input.dat
rollcall_output.dat
legislator_input.dat
legislator_output.dat
session_info.num
rollcall_matrix.vt3
transposed_rollcall_matrix.vt3
NOMINAL DYNAMIC-WEIGHTED MULTIDIMENSIONAL UNFOLDING
2 1 1 2 2 5
5.9539 0.3463
from dwnominate.
I sent it to you by email. I also attached all the other data that dwnominate
created.
from dwnominate.
I didn't get the email, can you send it again?
from dwnominate.
I have it on good authority that the code will run correctly if you get the version of gfortran described in this stackoverflow question.
I'm going to wait to hear more from the gfortran people before deciding what to do with this. And I'll try to get a Mac for testing so we don't have to go back and forth via email anymore.
from dwnominate.
from dwnominate.
Related Issues (20)
- Major Error 20 HOT 1
- Fortran errors aren't passed to R HOT 3
- Weights Parameter Output HOT 4
- Need more explanation of starting estimates
- Build broken on Windows HOT 12
- Error: NAs in foreign function call (arg 14) HOT 11
- No license for DW-NOMINATE.FOR HOT 1
- Installation fails on Mac (gfortran problem) HOT 3
- Problem with polarity HOT 1
- Issue with installation HOT 2
- Rewrite DW-NOMINATE in R HOT 2
- FAQ disappeared from the website
- Remove extra lapack dependency on Windows
- BLAS/LAPACK routine 'DSYEV DORGLQRowwiseD' gave error code -5
- Running dwnominate on the Swedish parliament HOT 2
- Dependency basicspace was removed from CRAN HOT 1
- Segfault with more than 111 sessions
- Can't reproduce official DW-NOMINATE scores HOT 5
- Fortran shouldn't write to stdout HOT 1
- segfault in dwnominate on Mac OS HOT 19
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dwnominate.