tomojitakasu / RTKLIB

2.5k stars 1.59k forks source link

Compiling str2str on Windows #694

Open coalcandy opened 1 year ago

coalcandy commented 1 year ago

Hi! Sorry for this (probably) noob question, I've tried a lot of things, but haven't managed to compile str2str on Windows. I have tested out strsvr and now I want to harness this power from the command line.

  1. When using >> vi makefile as suggested in the manual, from Cygwin64 I get

$ vi makefile E1187: Failed to source defaults.vim Press ENTER or type command to continue

If I press enter, the makefile is opened, but I can't do anything with it, except replace text.

  1. I also tried using GNU Make

    $ make cc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DENAGLO -DENAGAL -DENAQZS -DENACMP -DTRACE -DNFREQ=3 -DNEXOBS=3 -g ../str2str.c ../str2str.c:26:19: warning: ‘rcsid’ defined but not used [-Wunused-const-variable=] 26 | static const char rcsid[]="$Id:$"; | ^~~~~ cc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DENAGLO -DENAGAL -DENAQZS -DENACMP -DTRACE -DNFREQ=3 -DNEXOBS=3 -g ../../../src/stream.c ../../../src/stream.c: In function ‘readfile’: ../../../src/stream.c:628:5: error: unknown type name ‘fd_set’ 628 | fd_set rs; | ^~ ../../../src/stream.c:639:9: warning: implicit declaration of function ‘FD_ZERO’ [-Wimplicit-function-declaration] 639 | FD_ZERO(&rs); FD_SET(0,&rs); | ^~~ ../../../src/stream.c:639:23: warning: implicit declaration of function ‘FD_SET’ [-Wimplicit-function-declaration] 639 | FD_ZERO(&rs); FD_SET(0,&rs); | ^~ ../../../src/stream.c:640:14: warning: implicit declaration of function ‘select’ [-Wimplicit-function-declaration] 640 | if (!select(1,&rs,NULL,NULL,&tv)) return 0; | ^~ ../../../src/stream.c: In function ‘accept_nb’: ../../../src/stream.c:834:5: error: unknown type name ‘fd_set’ 834 | fd_set rs; | ^~ ../../../src/stream.c: In function ‘connect_nb’: ../../../src/stream.c:856:5: error: unknown type name ‘fd_set’ 856 | fd_set rs,ws; | ^~ ../../../src/stream.c: In function ‘recv_nb’: ../../../src/stream.c:874:5: error: unknown type name ‘fd_set’ 874 | fd_set rs; | ^~ ../../../src/stream.c: In function ‘send_nb’: ../../../src/stream.c:884:5: error: unknown type name ‘fd_set’ 884 | fd_set ws; | ^~ At top level: ../../../src/stream.c:64:19: warning: ‘rcsid’ defined but not used [-Wunused-const-variable=] 64 | static const char rcsid[]="$Id$"; | ^~~~~ make: *** [makefile:22: stream.o] Error 1

The manual suggests making edits to the makefile to suit the platform. I would be very thankful for some pointers on how to figure out what edits I need to do. Thanks in advance!

DanielMamaev commented 4 months ago

Hi. I managed to do it the following way.

  1. I downloaded and installed gcc-11.3.0-64.exe . From this site http://www.equation.com/servlet/equation.cmd?fa=fortran After installation, I checked that it works. gcc --version

  2. After that, I made the following changes to the makefile. Path to makefile RTKLIB_2.4.3_b34\app\consapp\str2str\gcc\makefile.

CC = gcc

OPTION = -DENAGLO -DENAGAL -DENAQZS -DENACMP -DENAIRN -DTRACE -DNFREQ=5 -DNEXOBS=3 -DSVR_REUSEADDR -DWIN32

LDLIBS  = -lm -lpthread -lwinmm -lws2_32
  1. Make sure that there are no files in the gcc folder except the makefile.
  2. Run make