瑞士星历程序swetest-Windows和Ubuntu中的不同输出

时间:2019-07-27 08:04:15

标签: c windows ubuntu-18.04 pyephem

我一直使用瑞士星历软件附带的SWETEST程序来计算经度方面各个行星的位置。到目前为止,我一直在使用Windows10,并且已经获得了与流行的商业软件可比的价值。

最近,我尝试将应用程序移至Ubuntu(特别是Google Colab随附的Ubuntu VM),第一个挑战是与Windows不同,该站点上没有Linux可执行文件。他们提供C代码和Makefile进行编译。

我使用了Colab gcc(Ubuntu 7.4.0-1ubuntu1〜18.04.1)7.4.0上可用的gcc和Make文件来编译该文件。有一些警告,但程序已按预期编译并执行。

问题是Windows版本中生成的经度值与Ubuntu版本中生成的经度值不同。差异不大,但仍然很大。尤其对于方兴未艾的人。

可以在this URL

看到实际的汇编

是否有解决此问题的方法,如果可以,我应该从哪里开始?

下面给出了make命令的输出

cc   -c -g -Wall -fPIC         swetest.c     
swetest.c: In function ‘main’:
swetest.c:1377:9: warning: format not a string literal and no format arguments [-Wformat-security]
  printf(stimeout);
         ^~~~~~~~
swetest.c:1712:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
    if (hpos_meth == 1)
    ^~
swetest.c:1714:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
      if (ipl == SE_FIXSTAR)
      ^~
swetest.c:1833:12: warning: format not a string literal and no format arguments [-Wformat-security]
     printf(smod);
            ^~~~
swetest.c: In function ‘print_line’:
swetest.c:2017:32: warning: format not a string literal and no format arguments [-Wformat-security]
         if (is_label) { printf(slon); break; }
                                ^~~~
swetest.c:2026:32: warning: format not a string literal and no format arguments [-Wformat-security]
         if (is_label) { printf(slon); break; }
                                ^~~~
swetest.c:2046:32: warning: format not a string literal and no format arguments [-Wformat-security]
         if (is_label) { printf(slon); break; }
                                ^~~~
cc   -c -g -Wall -fPIC         swedate.c     
cc   -c -g -Wall -fPIC         swehouse.c     
cc   -c -g -Wall -fPIC         swejpl.c     
cc   -c -g -Wall -fPIC         swemmoon.c     
cc   -c -g -Wall -fPIC         swemplan.c     
cc   -c -g -Wall -fPIC         swepcalc.c     
cc   -c -g -Wall -fPIC         sweph.c     
cc   -c -g -Wall -fPIC         swepdate.c     
cc   -c -g -Wall -fPIC         swephlib.c     
swephlib.c: In function ‘swe_get_astro_models’:
swephlib.c:4271:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_PREC_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4271:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_PREC_DEFAULT) imod = 0; break;
                                            ^~~~~
swephlib.c:4273:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_PREC_DEFAULT_SHORT) imod = 0; break;
  ^~
swephlib.c:4273:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_PREC_DEFAULT_SHORT) imod = 0; break;
                                                  ^~~~~
swephlib.c:4275:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_NUT_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4275:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_NUT_DEFAULT) imod = 0; break;
                                           ^~~~~
swephlib.c:4277:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_SIDT_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4277:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_SIDT_DEFAULT) imod = 0; break;
                                            ^~~~~
swephlib.c:4279:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_BIAS_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4279:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_BIAS_DEFAULT) imod = 0; break;
                                            ^~~~~
swephlib.c:4281:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_JPLHOR_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4281:46: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_JPLHOR_DEFAULT) imod = 0; break;
                                              ^~~~~
swephlib.c:4283:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_JPLHORA_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4283:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_JPLHORA_DEFAULT) imod = 0; break;
                                               ^~~~~
swephlib.c:4285:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (imod == SEMOD_DELTAT_DEFAULT) imod = 0; break;
  ^~
swephlib.c:4285:46: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (imod == SEMOD_DELTAT_DEFAULT) imod = 0; break;
                                              ^~~~~
cc   -c -g -Wall -fPIC         swecl.c     
swecl.c: In function ‘swe_rise_trans_true_hor’:
swecl.c:4444:11: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
           if (!do_fixstar)
           ^~
swecl.c:4447:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
      if (rsmi & SE_BIT_GEOCTR_NO_ECL_LAT)
      ^~
cc   -c -g -Wall -fPIC         swehel.c     
swehel.c: In function ‘calc_rise_and_set’:
swehel.c:478:1: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
 else
 ^~~~
swehel.c:484:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
   iflag = epheflag|SEFLG_SPEED|SEFLG_EQUATORIAL;
   ^~~~~
ar r libswe.a   swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o swepcalc.o sweph.o swepdate.o swephlib.o swecl.o swehel.o
ar: creating libswe.a
cc   -g -Wall -fPIC        -o swetest swetest.o -L. -lswe -lm -ldl

1 个答案:

答案 0 :(得分:0)

此练习背后的动机-在Ubuntu中重新编译程序-是出于从Windows迁移到Unix / Ubuntu平台的需求或愿望,尤其是在托管的VM环境(例如Google Colab)上。现在已经通过完全不同的途径实现了相同的目标。

有一个名为pyswisseph的Python程序包,如果安装了该程序包,则可以直接调用必要和相关的函数来获得相同的结果。

一个演示如何完成此操作的示例Colab笔记本为shared here