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

Building problem. #2

Open
Anandir opened this issue Aug 10, 2018 · 6 comments
Open

Building problem. #2

Anandir opened this issue Aug 10, 2018 · 6 comments

Comments

@Anandir
Copy link

Anandir commented Aug 10, 2018

Hi :-)!
I'm trying to build the library on a Windows 10 machine with Visual Studio 2017 Build Tools and I've this error:

C:\Users\me\Projects\Find_Orb_Build\lunar>nmake -f lunar.mak BITS_32=Y DLL=Y

Microsoft (R) Program Maintenance Utility Version 14.14.26433.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl -c -nologo -W3 -Ox -MT -D_CRT_SECURE_NO_WARNINGS -EHsc -LD -DNDEBUG astcheck.cpp
astcheck.cpp
astcheck.cpp(134): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
astcheck.cpp(448): error C2084: function 'int snprintf(char *const ,const size_t,const char *const ,...)' already has a body
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\stdio.h(1940): note: see previous definition of 'snprintf'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.EXE"' : return code '0x2'
Stop.

C:\Users\me\Projects\Find_Orb_Build\lunar>

The only solution I've found is to comment out your snprintf reimplementation, but it's not a smart move and I would like to keep the code.
Do you know if there are walkaroud/fixes over this?
Thanks a lot in advance and thanks a lot for your outstanding work!

@mkruzynski
Copy link

mkruzynski commented Aug 11, 2018

I think I have similar problem. Checked with Ubuntu 12.04 LTS and Ubuntu 17.10.

~/find_orb/lunar$ make install
mkdir -p ~/include
cp afuncs.h   ~/include
cp cgi_func.h ~/include
cp comets.h   ~/include
cp date.h     ~/include
cp get_bin.h  ~/include
cp lunar.h    ~/include
cp mpc_func.h ~/include
cp showelem.h ~/include
cp vislimit.h ~/include
cp watdefs.h  ~/include
mkdir -p ~/lib
cp liblunar.a ~/lib
mkdir -p /home/users/mkruzynski/bin
cp astcheck /home/users/mkruzynski/bin
cp: cannot stat `astcheck': No such file or directory
make: *** [install] Error 1```

@Anandir
Copy link
Author

Anandir commented Aug 11, 2018

Hi @mkruzynski :-)!
I've successfully build the library on Windows with a Cygwin/Msys2 environment, with a build procedure like a Linux environment.
To do that I've follow those instructions: https://projectpluto.com/find_sou.htm .
Have you read it?

@Bill-Gray
Copy link
Owner

Bill-Gray commented Aug 11, 2018

Hi @Anandir ,
Thanks for catching this bug.
Quick, temporary workaround until I post a real fix: change line 134 to read
record_length = (int)strlen( buff);
(or you can just ignore the casting warning), and line 432 to read
#if defined(_MSC_VER) && _MSC_VER < 1900
This will ensure that a new snprintf is included as needed (only for elderly MSVCs), instead of just being added all the time. See easter.cpp for an example.
I say "quick, temporary workaround" because I really ought to make one snprintf() in one file, instead of having copies of it in easter.cpp, astcheck.cpp, and tables.cpp. That's rather embarrassing.

@Bill-Gray
Copy link
Owner

Hi @mkruzynski ,
Try a make astcheck and then a make install. I should document that better; it's a little hidden at present (you aren't the only one to have mentioned this issue). Thanks for the nudge on this.

@Anandir
Copy link
Author

Anandir commented Aug 12, 2018

Thanks @Bill-Gray for you reply!
Regarding the conversion warning (astcheck.cpp(134): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data) I will ignore it basically.
Thanks a lot for the fix.
After the fix I've got this error:

C:\Users\me\Projects\Find_Orb_Build\lunar>nmake -f lunar.mak BITS_32=Y

Microsoft (R) Program Maintenance Utility Version 14.14.26433.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        link /nologo    astcheck.obj eart2000.obj mpcorb.obj lunar.lib
astcheck.obj : error LNK2019: unresolved external symbol extract_date_from_mpc_report referenced in function "int __cdecl get_mpc_data(char const *,double *,double *,double *)" (?get_mpc_data@@YAHPEBDPEAN11@Z)
astcheck.obj : error LNK2019: unresolved external symbol get_ra_dec_from_mpc_report referenced in function "int __cdecl get_mpc_data(char const *,double *,double *,double *)" (?get_mpc_data@@YAHPEBDPEAN11@Z)
astcheck.obj : error LNK2019: unresolved external symbol "int __cdecl extract_sof_data(struct elements *,char const *,char const *)" (?extract_sof_data@@YAHPEAUelements@@PEBD1@Z) referenced in function "struct AST_DATA * __cdecl compute_day_data(long)" (?compute_day_data@@YAPEAUAST_DATA@@J@Z)
astcheck.exe : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\link.EXE"' : return code '0x460'
Stop.

C:\Users\me\Projects\Find_Orb_Build\lunar>

But I've fixed it adding those lines to the lunar.def file:

   extract_date_from_mpc_report           @91
   get_ra_dec_from_mpc_report             @92
   extract_sof_data                       @93
   lat_alt_to_parallax                    @94

I hope that this can help!

Bill-Gray added a commit that referenced this issue Aug 12, 2018
…finition of 'snprintf'), and there were a lot of new functions that were not exported in the DLL via 'lunar.def'.
@Bill-Gray
Copy link
Owner

Hi @Anandir - I've not actually been near a Windows machine lately. But based on your report, I've committed the fixes for the casting error and duplicate snprintf(), added your lines to lunar.def, and added several more for other functions that really ought to be exported. Eventually, I hope to add an snprintf.cpp and push that code into a separate file. But that can wait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants