tomojitakasu / RTKLIB

2.56k stars 1.62k forks source link

Segmentation fault: 11 on Mac OS X 10.12.3 #290

Open demiangomez opened 7 years ago

demiangomez commented 7 years ago

I've successfully compiled in OS X 10.12.3 (Sierra) using -lSystem.B as suggested in this issue: https://github.com/tomojitakasu/RTKLIB/issues/137. However, when I try to run rnx2rtkp I get "Segmentation fault: 11". I also tried removing -lrt (without adding -lSystem.B) and I get the same error. In Linux (Ubuntu 14.04) it works fine (without changing -lrt). I can't see anything wrong with the compilation, other than just some warnings (gcc seems not to know about -Wno-unused-but-set-variable):

`make CC=gcc all gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../rnx2rtkp.c warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option] ../rnx2rtkp.c:20:19: warning: unused variable 'rcsid' [-Wunused-const-variable] static const char rcsid[]="$Id: rnx2rtkp.c,v 1.1 2008/07/17 21:55:16 ttaka Exp $"; ^ 2 warnings generated. gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/rtkcmn.c warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option] ../../../src/rtkcmn.c:1566:21: warning: unused variable 'tp' [-Wunused-variable] struct timespec tp={0}; ^ ../../../src/rtkcmn.c:2979:21: warning: implicit declaration of function 'strtok_r' [-Wimplicit-function-declaration] for (p=s1,q=strtok_r(s2,"",&r);q;q=strtok_r(NULL,"",&r)) { ^ ../../../src/rtkcmn.c:2979:20: warning: incompatible integer to pointer conversion assigning to 'char ' from 'int' [-Wint-conversion] for (p=s1,q=strtok_r(s2,"",&r);q;q=strtok_r(NULL,"",&r)) { ^~~~~~~~ ../../../src/rtkcmn.c:2979:44: warning: incompatible integer to pointer conversion assigning to 'char ' from 'int' [-Wint-conversion] for (p=s1,q=strtok_r(s2,"",&r);q;q=strtok_r(NULL,"",&r)) { ^~~~~~ ../../../src/rtkcmn.c:122:19: warning: unused variable 'rcsid' [-Wunused-const-variable] static const char rcsid[]="$Id: rtkcmn.c,v 1.1 2008/07/17 21:48:06 ttaka Exp ttaka $"; ^ 6 warnings generated. gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/rinex.c warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option] ../../../src/rinex.c:441:52: warning: if statement has empty body [-Wempty-body] else if (strstr(label,"PRN / # OF OBS" )) ; / opt / ^ ../../../src/rinex.c:441:52: note: put the semicolon on a separate line to silence this warning ../../../src/rinex.c:87:19: warning: unused variable 'rcsid' [-Wunused-const-variable] static const char rcsid[]="$Id:$"; ^ 3 warnings generated. gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/rtkpos.c warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option] ../../../src/rtkpos.c:41:19: warning: unused variable 'rcsid' [-Wunused-const-variable] static const char rcsid[]="$Id:$"; ^ 2 warnings generated. gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/postpos.c warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option] ../../../src/postpos.c:909:40: warning: address of array 'fopt->blq' will always evaluate to 'true' [-Wpointer-bool-conversion] if (popt_.mode>PMODE_SINGLE&&fopt->blq) {


../../../src/postpos.c:33:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id: postpos.c,v 1.1 2008/07/17 21:48:06 ttaka Exp $";
                  ^
3 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/solution.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/solution.c:46:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id: solution.c,v 1.1 2008/07/17 21:48:06 ttaka Exp $";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/lambda.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/lambda.c:18:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id: lambda.c,v 1.1 2008/07/17 21:48:06 ttaka Exp $";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/geoid.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/geoid.c:18:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id: geoid.c,v 1.1 2008/07/17 21:48:06 ttaka Exp $";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/sbas.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/sbas.c:40:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id: sbas.c,v 1.1 2008/07/17 21:48:06 ttaka Exp $";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/preceph.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/preceph.c:44:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/pntpos.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/pntpos.c:22:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/ephemeris.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/ephemeris.c:57:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/options.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/options.c:22:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/ppp.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/ppp.c:42:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/ppp_ar.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/ppp_ar.c:17:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/rtcm.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/rtcm.c:48:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/rtcm2.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/rtcm2.c:15:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/rtcm3.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/rtcm3.c:29:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/rtcm3e.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/rtcm3e.c:31:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/ionex.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/ionex.c:21:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc -c -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I../../../src -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3 -g ../../../src/qzslex.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
../../../src/qzslex.c:18:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[]="$Id:$";
                  ^
2 warnings generated.
gcc   rnx2rtkp.o rtkcmn.o rinex.o rtkpos.o postpos.o solution.o lambda.o geoid.o sbas.o preceph.o pntpos.o ephemeris.o options.o ppp.o ppp_ar.o rtcm.o rtcm2.o rtcm3.o rtcm3e.o ionex.o qzslex.o  -lm -lSystem.B  -o rnx2rtkp`

when I run the provided test (or even a test of my own) I get:
`make test1
./rnx2rtkp ../../../test/data/rinex/07590920.05o ../../../test/data/rinex/30400920.05n -x 5 -o test1.pos
make: *** [test1] Segmentation fault: 11`

Any ideas of what might be going on?
Thank you,
happywmzzz commented 7 years ago

hi, check this https://github.com/blaines/RTKLIB/blob/master/src/rtkcmn.c @blaines he may find some way to fix Segmentation fault

jvromualdo commented 7 years ago

hi, I'm trying to run rnx2rtkp on mac OS X (10.12.4) and after awhile I was finally able to compile the app (-lSystem.B might have helped). Now when a run rnx2rtkp I get the same "Segmentation fault: 11". Does anyone have an idea what could it be?

thanks

astrodanco commented 7 years ago

Does anyone have an idea what could it be?

Probably yet another uninitialized variable / pointer / pointer array / string. RTKLIB is full of them.

drf5n commented 6 years ago

Check out the fork in https://github.com/rtklibexplorer/RTKLIB/tree/demo5 It compiles cleanly.