Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strmode not found in cygwin #329

Open
DEQjpowell opened this issue May 3, 2021 · 6 comments
Open

strmode not found in cygwin #329

DEQjpowell opened this issue May 3, 2021 · 6 comments
Labels
help wanted ❤️ we'd love your help!

Comments

@DEQjpowell
Copy link

DEQjpowell commented May 3, 2021

I see at the end of

#145

that a fix for “conflicting types for 'strmode'” was checked in at

18f93ac

and it appears to be committed into 1.5.0. So what I expect:

install.packages(“fs”)

installs fs correctly on Cygwin. What I get instead:

: Selection: 75
: trying URL 'https://ftp.osuosl.org/pub/cran/src/contrib/fs_1.5.0.tar.gz'
: Content type 'application/x-gzip' length 796244 bytes (777 KB)
: ==================================================
: downloaded 777 KB

: /tmp/RtmpekZitb/R.INSTALL594291a2fb2/fs/src/unix/getmode.cc:32:(.text+0x77):
: relocation truncated to fit: R_X86_64_PC32 against undefined symbol
: `strmode'
:
: collect2: error: ld returned 1 exit status
: make: *** [/usr/lib/R/share/make/shlib.mk:6: fs.dll] Error 1
: ERROR: compilation failed for package ‘fs’
: * removing ‘/usr/lib/R/site-library/fs’

Can you help? This has been blocking me from using R on Cygwin for many moons.

Thank you,

  • JP

Background:

:
:
: setmode isn't a standard library function; it's a libbsd
: function. That's only the same thing on BSD-derived systems like OS X,
: which that man page is from. Pass the -lbsd argument to get the linker
: to find it on Linux.
(https://stackoverflow.com/questions/15608116/gnu-undefined-reference-to-setmode)

I also tried this:

: install.packages('fs',repos='http://cran.us.r-project.org')

James Powell, Ph.D. Candidate
NRS3 MOVES Modeler, Air Technical Services
Oregon Department of Environmental Quality
700 NE Multnomah St. Suite 600, Portland OR 97212
Phone: 503-235-3679
Email: James.Powell (at) deq.state.or.us
Pronouns: him/his

@jordanFC
Copy link

I'm also having this exact issue as well. Basically everywhere I try to install fs I am failing at this point (see: #338)

@user3477071
Copy link

user3477071 commented Nov 19, 2021

Get source code of 'fs' from CRAN
$ wget -P /tmp http://lib.stat.cmu.edu/R/CRAN/src/contrib/fs_1.5.0.tar.gz

Extract the source

$ cd /tmp
$ tar zxvf fs_1.5.0.tar.gz

Edit /tmp/fs/src/Makevars to replace

ifeq ($(UNAME), Linux)
OBJECTS +=  bsd/setmode.o bsd/strmode.o bsd/reallocarray.o
endif

with

UNIX := $(if $(filter $(UNAME), Linux AIX OS400),UNIX)
CYGWIN := $(if $(findstring CYGWIN, $(shell echo $(UNAME) | \
                tr '[\:lower\:]', '[\:upper\:]')),UNIX)

ifeq ($(or $(UNIX), $(CYGWIN)),UNIX)
OBJECTS += bsd/setmode.o bsd/strmode.o bsd/reallocarray.o
endif

Build manually and install

$ cd /tmp
$ R CMD install fs

@gaborcsardi
Copy link
Member

cygwin is not a platform that we support out of the box, but if you have a patch I will consider it.

@gaborcsardi gaborcsardi added the help wanted ❤️ we'd love your help! label Dec 8, 2021
@georgedemmy
Copy link

This patch fixes the Cygwin problem (tested fs 1.5.2). It just adds the check for CYGWIN in uname after the Linux and friends check fails. It is the very last check in Makevars before the rules.

diff --git a/src/Makevars b/src/Makevars
index a1915d7c..d087cf59 100644
--- a/src/Makevars
+++ b/src/Makevars
@@ -17,7 +17,11 @@ endif
 ifeq ($(UNAME), OpenBSD)
 PKG_LIBS += -lkvm
 endif
-ifneq ($(filter $(UNAME), Linux AIX OS400),)
+
+CYGWIN := $(findstring CYGWIN, $(shell echo $(UNAME) | \
+	    tr '[:lower:]' '[:upper:]'))
+
+ifneq ($(or $(filter $(UNAME), Linux AIX OS400), $(CYGWIN)),)
 OBJECTS +=  bsd/setmode.o bsd/strmode.o bsd/reallocarray.o
 endif

@gaborcsardi
Copy link
Member

@georgedemmy Thanks! Would you like to submit a PR? (No pressure. :))

@georgedemmy
Copy link

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted ❤️ we'd love your help!
Projects
None yet
Development

No branches or pull requests

5 participants