admb-project/admb

Wrong directory name when building for VisualStudio

Closed this issue · 9 comments

I tried to build the lattest version of ADMB (13.0) on Windows and an error occured. An object could not be found after the first call to Microsoft compilator (cl version 19.33.31630).

if not exist ..\build\admb\include\contrib md ..\build\admb\include\contrib
        IF NOT EXIST ..\build\objects\win32-cl md ..\build\objects\win32-cl
        "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX86\x86\nmake.exe" _objects

Microsoft (R) Program Maintenance Utility Version 14.33.31630.0
Copyright (C) Microsoft Corporation. Tous droits réservés.

        cl /c /nologo /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc /DOPT_LIB /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I..\build\admb\include /Fo..\build\objects\vs-cl\optlp-df1b2-separable-f1b2lndt.obj df1b2-separable\f1b2lndt.cpp
f1b2lndt.cpp
D:\Path\To\Workspace\VisualStudioWorkspace\AdditionalLibraries\admb-13.0\src\df1b2-separable\f1b2lndt.cpp : fatal error C1083: Unable to open the file generated by the compiler : 'D:\Path\To\Workspace\VisualStudioWorkspace\AdditionalLibraries\admb-13.0\build\objects\vs-cl\optlp-df1b2-separable-f1b2lndt.obj' : No such file or directory

The reason was that the directory used to store the objects was named "win32-cl" instead of "vs-cl". The same error occurred for the nmake DEBUG=yes call.
After creating vs-cl and vs-cl-debug manually, the installation went through without error.

Is it a problem due to a bad manipulation on my part, or an error in the installation process?

Thanks,
Jules

Edit :

I discovered that not all makefiles define OSNAME and CXXVERSION in the same way. finally, I forced the makefiles to define the constants this way:

CXXVERSION=-cl19
OSNAME=-win32

And the whole construction process was completed correctly.

I forgot to mention that I use Visual Studio 2022 on Windows 10 and cl.exe in version 19.33.31630 for x86.

Try and use the x86 Native Tools Command Prompt for VS2022 from the Start Menu to build from source.

I used x86 Native Tools Command prompt for VS 2022 and this is what I got :

D:\PathToDir\VisualStudioWorkspace\AdditionalLibraries\admb-main>nmake

Microsoft (R) Program Maintenance Utility Version 14.33.31630.0
Copyright (C) Microsoft Corporation. Tous droits réservés.

        "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX86\x86\nmake.exe" cl-dist DEBUG=

Microsoft (R) Program Maintenance Utility Version 14.33.31630.0
Copyright (C) Microsoft Corporation. Tous droits réservés.

        nmake /nologo cl-contribs
        pushd src& nmake /nologo all
        IF NOT EXIST ..\build\admb\include md ..\build\admb\include
        copy df1b2-separable\df1b2fun.h ..\build\admb\include
        1 fichier(s) copié(s).

[...Some extra lines...]

        1 fichier(s) copié(s).
        if not exist ..\build\admb\include\contrib md ..\build\admb\include\contrib
        IF NOT EXIST ..\build\objects\win32-cl md ..\build\objects\win32-cl
        "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX86\x86\nmake.exe" _objects

Microsoft (R) Program Maintenance Utility Version 14.33.31630.0
Copyright (C) Microsoft Corporation. Tous droits réservés.

        cl /c /nologo /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc /DOPT_LIB /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I..\build\admb\include /Fo..\build\objects\vs-cl\optlp-df1b2-separable-f1b2lndt.obj df1b2-separable\f1b2lndt.cpp
f1b2lndt.cpp
D:\PathToDir\VisualStudioWorkspace\AdditionalLibraries\admb-main\src\df1b2-separable\f1b2lndt.cpp : fatal error C1083: Impossible d'ouvrir le fichier généré(e) par le compilateur : 'D:\PathToDir\VisualStudioWorkspace\AdditionalLibraries\admb-main\build\objects\vs-cl\optlp-df1b2-separable-f1b2lndt.obj' : No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX86\x86\cl.EXE"' : code retour '0x1'
Stop.

[...more U1077 errors with returned code '0x2'...]

Thank Jules (@Ash12H) for reporting this. Please try the fixes (9055586) that are in dev-13.1 branch and let me know if it works for you.

I tried to build admb with this branch and it worked much better. All objects are created well but one last problem remains:

*** Linking: ..\..\build\ad2csv\ad2csv.obj ..\..\build\ad2csv\main.obj
cl /nologo /Fe..\..\build\admb\bin\ad2csv.exe ..\..\build\ad2csv\ad2csv.obj ..\..\build\ad2csv\main.obj "D:\DocumentsAsh\Programmation\VisualStudioWorkspace\AdditionalLibraries\admb-905558625a7a0a208c2a5abe5f7302e675229865\build\admb\lib\admb-win32-cl19.lib" /link
LINK : fatal error LNK1181: impossible d'ouvrir le fichier en entrée 'D:\DocumentsAsh\Programmation\VisualStudioWorkspace\AdditionalLibraries\admb-905558625a7a0a208c2a5abe5f7302e675229865\build\admb\lib\admb-win32-cl19.lib'

Error: Unable to build.

Link was set on admb-win32-cl19.lib but in my "build/lib" directory I have admb-win32-cl.lib (and also admbo-win32-cl.lib, admb-contrib-win32-cl.lib, admb-contribo-win32-cl.lib).

getting closer…, but there should be a admb-win32-cl19.lib in the build/admb/lib directory.

can you rebuild?

> nmake clean
> nmake

then send output of the first 5 calls to cl.exe.

also, can you send display output of just using the cl.exe compiler in the command prompt?

> cl.exe

???

cl.exe compiler:

C:\Program Files\Microsoft Visual Studio\2022\Community>cl.exe
Compilateur d'optimisation Microsoft (R) C/C++ version 19.33.31630 pour x86
Copyright (C) Microsoft Corporation. Tous droits réservés.

5 first calls to cl.exe:

cl /c /nologo /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc /DOPT_LIB /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I..\build\admb\include /Fo..\build\objects\win32-cl\optlp-df1b2-separable-f1b2lndt.obj df1b2-separable\f1b2lndt.cpp
f1b2lndt.cpp

cl /c /nologo /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc /DOPT_LIB /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I..\build\admb\include /Fo..\build\objects\win32-cl\optlp-df1b2-separable-df1b2impspf.obj df1b2-separable\df1b2impspf.cpp
df1b2impspf.cpp
df1b2-separable\df1b2impspf.cpp(99): warning C4456: la déclaration de 'lst' masque la déclaration locale précédente
df1b2-separable\df1b2impspf.cpp(55): note: voir la déclaration de 'lst'

cl /c /nologo /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc /DOPT_LIB /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I..\build\admb\include /Fo..\build\objects\win32-cl\optlp-df1b2-separable-df1b2lmn2.obj df1b2-separable\df1b2lmn2.cpp
df1b2lmn2.cpp

cl /c /nologo /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc /DOPT_LIB /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I..\build\admb\include /Fo..\build\objects\win32-cl\optlp-df1b2-separable-dflogistic.obj df1b2-separable\dflogistic.cpp
dflogistic.cpp

cl /c /nologo /O2 /W4 /wd6001 /wd4100 /wd4239 /GF /EHsc /DOPT_LIB /D_USE_MATH_DEFINES /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /I..\build\admb\include /Fo..\build\objects\win32-cl\optlp-df1b2-separable-tdev.obj df1b2-separable\tdev.cpp
tdev.cpp

Okay, please update the dev-13.1 branch, then clean and rebuild it again.

Thanks, it works perfectly on my side.

Thanks Jules (@Ash12H) for helping with testing. I am glad it finally works for you. Cheers...