0

I am trying to install the software "Seismic Unix" for Cygwin on Windows.

Under normal circumstances the issue described below would probably be fixed with downloading Cygwin again and doing just a simple reinstallation of all packages - the problem is: I can't really do that, because I am on a research ship in the South Atlantic right now and am sharing a bandwidth of 190 kb/s with 50 people. Therefore the best I can do is to download or update single packages. In order to do this, however, I first need to know what causes my error messages.

The issue arises when I am trying to make install. The error message reads:

fcat.c: In function ‘main’:
fcat.c:35:14: error: storage size of ‘buf’ isn’t known
  struct stat buf;
              ^~~
In file included from fcat.c:26:0:
/usr/local/su2/include/cwp.h:713:15: warning: implicit declaration of function  open64’ [-Wimplicit-function-declaration]
 #define open  open64
               ^
fcat.c:43:8: note: in expansion of macro ‘open’
   fd = open(av[ic], O_RDONLY);
        ^~~~
/usr/local/su2/include/cwp.h:720:15: warning: implicit declaration of function  fstat64’ [-Wimplicit-function-declaration]
 #define fstat fstat64
               ^
fcat.c:45:3: note: in expansion of macro ‘fstat’
   fstat(fd, &buf);
   ^~~~~
fcat.c:35:14: warning: unused variable ‘buf’ [-Wunused-variable]
  struct stat buf;
              ^~~
make[2]: *** [Makefile:24: /usr/local/su2/bin/fcat] Error 1
make[2]: Leaving directory '/usr/local/su2/src/cwp/main'
make[1]: *** [Makefile:8: INSTALL] Error 2
make[1]: Leaving directory '/usr/local/su2/src/cwp'
make: *** [Makefile:85: cwpstuff] Error 2
 

/usr/local/su2/ is the directory of Seismic Unix. I have a long range of packages installed that works for a similar software (called Madagascar), but apparently not for Seismic Unix. I found some posts that explained this error message arises sometimes, when gcc is not found/up to date. I checked this several times and it is up to date. Furthermore, I tried to use "rebaseall" in the Ash terminal of Cygwin, because this apparently fixes problems with single packages installed after the main installation, but so far nothing works.

Does anyone have some ideas that could help me?

Edit: thanks to steeldriver I am past the issue with make install. The config for Cygwin file that Seismic Unix install on Windows is talking about is actually in the /config folder and called Makefile.config_Cygwin_32 (see comments). That gets me past most make xxxinstall commands.

However, now there is another error message with the last step: make sfinstall. I get the following error:

make[4]: Entering directory '/usr/local/su2/src/Sfio/src/lib/sfio/Stdio_s'
cc -c -I. -I.. -O -Dvt_threaded=0  stdfgetc.c
In file included from /usr/include/sys/errno.h:11:0,
                 from /usr/include/errno.h:9,
                 from ../vthread.h:14,
                 from ../sfhdr.h:58,
                 from stdio_s.h:11,
                 from stdfgetc.c:1:
/usr/include/sys/reent.h:285:26: error: conflicting types for ‘__FILE’
 typedef struct __sFILE64 __FILE;
                          ^~~~~~
In file included from stdfgetc.c:1:0:
stdio_s.h:8:25: note: previous declaration of ‘__FILE’ was here
 typedef struct _sfio_s *__FILE;
                         ^~~~~~
make[4]: *** [Makefile:25: stdfgetc.o] Error 1
make[4]: Leaving directory '/usr/local/su2/src/Sfio/src/lib/sfio/Stdio_s'
make[3]: *** [Makefile:146: mkstdio_s] Error 2
make[3]: Leaving directory '/usr/local/su2/src/Sfio/src/lib/sfio'
make[2]: *** [Makefile:79: install] Error 2
make[2]: Leaving directory '/usr/local/su2/src/Sfio/src/lib/sfio'
make[1]: *** [Makefile:7: INSTALL] Error 2
make[1]: Leaving directory '/usr/local/su2/src/Sfio'
make: *** [Makefile:129: sfinstall] Error 2

Does anybody know what to do here? After I didn't at first I tried every step again with a freshly untarred source tarball, but the error message still stands.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
  • Have you built it on cygwin before? My feeling is that its a build configuration problem (I downloaded the source,and noticed it only has a generic Makefile.config plus one for Darwin). I was able to get rid of the struct stat error by adding a __CYGWIN__ variable to the CFLAGS i.e. make "CFLAGS=-D __CYGWIN__" install (you could achieve the same by editing the Makefile.config file directly). – steeldriver Jan 18 '18 at 18:46
  • See also Seismic Unix install on Windows although the advice to "uncomment every line in the Makefile.config that says CYGWIN" doesn't seem to apply to the version I downloaded (cwp_su_all_44R14.tgz) since there are no such lines - it may help for your version – steeldriver Jan 18 '18 at 18:51
  • My bad - there is in fact a configs/Makefile.config_Cygwin_32 file - on my cygwin64 system, that seemed to work for me (without the errors you are reporting) i.e. just by cp configs/Makefile.config_Cygwin_32 Makefile.config then make install. You may wish to backup your original Makefile.config first. – steeldriver Jan 18 '18 at 19:20
  • Ah, thanks, I will try that! I noticed as well that there are no CYGWIN lines in the Makefile.config file, I'll search for that configs/Makefile.config_Cygwin_32 file – Tobitobitobi Jan 18 '18 at 19:49
  • It should be right there in the configs subdirectory of the main src dir - just copy it to the src dir and run make remake (rather than make install - that potentially will mix object files that were built with the wrong architecture flags). Or start over from a freshly untarred source tarball to be sure. – steeldriver Jan 18 '18 at 19:53
  • That actually brought me quite far, make install worked! Now I just got an error for the very last step (make sfinstall: "conflicting types for ‘__FILE’ typedef struct __sFILE64 __FILE; In file included from stdfgetc.c:1:0:stdio_s.h:8:25: note: previous declaration of ‘__FILE’ was here typedef struct _sfio_s"), but I will use your most recent advice and start over from a freshly untarred source tarball - which I didn't do for my last try. Thanks a lot! – Tobitobitobi Jan 18 '18 at 21:30
  • cygwin 64 or 32 bit ? – matzeri Jan 28 '18 at 18:39
  • It's cygwin 64 bit – Tobitobitobi Jan 29 '18 at 22:50

1 Answers1

0

The following procedure works on 64 bit cygwin

cp configs/Makefile.config_Cygwin_32 Makefile.config

patch the Makefile.config as

--- configs/Makefile.config_Cygwin_32   2015-03-17 16:36:38.000000000 +0100
+++ Makefile.config     2018-01-28 19:37:35.224138200 +0100
@@ -34,7 +34,7 @@
 LINEHDRFLAG =
 XDRFLAG = # -DSUXDR
 ENDIANFLAG = -DCWP_LITTLE_ENDIAN
-LARGE_FILE_FLAG = # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
+LARGE_FILE_FLAG =  -D_FILE_OFFSET_BITS=64 # -D_LARGEFILE64_SOURCE

 CWP_FLAGS = $(LARGE_FILE_FLAG) $(ENDIANFLAG) $(XDRFLAG) $(LINEHDRFLAG)

@@ -59,10 +59,10 @@
 # use both X11 path conventions
 #-----------------------------------------------------------------------

-IX11 = /usr/X11/include
-LX11 = /usr/X11/lib
-IMOTIF = /usr/X11R6/include
-LMOTIF = /usr/X11R6/lib
+IX11 = /usr/include/X11
+LX11 = /usr/lib
+IMOTIF = /usr/include/X11
+LMOTIF = /usr/lib

 LD_LIBRARY_PATH += $(CWPROOT)/lib:${LX11}:${LMOTIF}

@@ -91,7 +91,7 @@

 CC = gcc
 #OPTC = -g  -std=c99 -Wall -pedantic -Wno-long-long
-OPTC = -O  -std=c99 -Wall -pedantic -Wno-long-long
+OPTC = -O   -Wall -pedantic -Wno-long-long
 CFLAGS = -I$I $(OPTC) $(CWP_FLAGS) -D_BSD_SOURCE -D_POSIX_SOURCE

 FC = gfortran

Additional patch for make sfinstall

    --- Sfio/src/lib/sfio/Stdio_b/sfstdio.h~        2018-01-28 20:36:09.022523600 +0100
+++ Sfio/src/lib/sfio/Stdio_b/sfstdio.h 2018-01-28 21:21:12.331496700 +0100
@@ -26,7 +26,7 @@

  /* Linux7.2 requires __FILE in wchar.h - we fake it here */
  #include       "FEATURE/sfio"
 -#if _typ___FILE
 +#if defined(_typ___FILE) && !defined(__CYGWIN__)
  typedef FILE   *__FILE;
  #endif

--- Sfio/src/lib/sfio/Stdio_s/stdio_s.h~        2002-09-14 03:01:15.000000000 +0200
+++ Sfio/src/lib/sfio/Stdio_s/stdio_s.h 2018-01-28 20:33:16.400954500 +0100
@@ -4,7 +4,7 @@

 #include       "FEATURE/sfio"

-#if _typ___FILE /* Redhat7.3 requires __FILE in wchar.h */
+#if defined(_typ___FILE) && !defined(__CYGWIN__) /* Redhat7.3 requires __FILE in wchar.h */
 typedef struct _sfio_s *__FILE;
 #endif
matzeri
  • 961
  • Okay, I can do the changes for the Makefile.config file, but neither sfstdio.h nor stdio_s.h are existing. Do you mean I have to create them before any make-command and put the lines you wrote in them? – Tobitobitobi Jan 29 '18 at 23:20
  • I used cwp_su_all_44R14.tgz. The files are Sfio/src/lib/sfio/Stdio_s/stdio_s.h and Sfio/src/lib/sfio/Stdio_b/sfstdio.h and cause a problem during the make sfinstall. Are you using another version ? – matzeri Jan 30 '18 at 06:24
  • I use cwp_su_all_44R14.tgz as well. I now found Sfio/src/lib/sfio/Stdio_s/stdio_s.h but there is no sfstdio.h file in Sfio/src/lib/sfio/Stdio_b/, only a Sfstdio.c. The only .h file that is there is no_stdio.h – Tobitobitobi Jan 30 '18 at 16:09
  • Ah, but apparently the Sfstdio.c file is used to generate sfstdio.h. I can probably change Sfstdio.c to alter the way sfstdio.h is created – Tobitobitobi Jan 30 '18 at 16:15
  • I tried it, but received the error message when entering make install: make[3]: execvp: chmod: Permission denied make[3]: *** [Makefile:50: /usr/local/su/bin/suedit] Error 127 make[3]: Leaving directory '/usr/local/su/src/su/main/headers' make[2]: *** [Makefile:15: INSTALL] Error 2 make[2]: Leaving directory '/usr/local/su/src/su/main' make[1]: *** [Makefile:8: INSTALL] Error 2 make[1]: Leaving directory '/usr/local/su/src/su' make: *** [Makefile:92: sustuff] Error 2 – Tobitobitobi Jan 30 '18 at 17:49
  • ...although I have to admit that I used notepad++ from windows to do the changes in the cygwin folder, not inside the Linux environment. Is that a problem? Can you tell me what you used to edit it? Thanks! – Tobitobitobi Jan 30 '18 at 17:59
  • Although I'm pretty sure I used EOF settings for Unix inside notepad++ for Windows – Tobitobitobi Jan 30 '18 at 18:56
  • I am using vim. You can always convert file using d2u filename – matzeri Jan 31 '18 at 16:50