Unidata / UDUNITS-2

API and utility for arithmetic manipulation of units of physical quantities
http://www.unidata.ucar.edu/software/udunits
Other
62 stars 36 forks source link

fix appveyor build #64

Closed ocefpaf closed 6 years ago

ocefpaf commented 6 years ago

This PR revives AppVeyor but, contrary to the green status, the build is failing with:

[ 94%] Building C object prog/CMakeFiles/udunits2.dir/XGetopt.c.obj
XGetopt.c
[100%] Linking C executable udunits2.exe
LINK: command "C:\PROGRA~2\MI0E91~1.0\VC\bin\amd64\link.exe /nologo @CMakeFiles\udunits2.dir\objects1.rsp /out:udunits2.exe /implib:udunits2.lib /pdb:C:\Miniconda36-x64\conda-bld\udunits2_1528730419962\work\build\prog\udunits2.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console -LIBPATH:C:\Miniconda36-x64\conda-bld\udunits2_1528730419962\work\build\lib ..\lib\udunits2.lib C:\Miniconda36-x64\conda-bld\udunits2_1528730419962\_h_env\Library\lib\expat.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:udunits2.exe.manifest" failed (exit code 1120) with the following output:
udunits2.c.obj : error LNK2019: unresolved external symbol default_udunits2_xml_path referenced in function decodeCommandLine
udunits2.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'C:\Miniconda36-x64\conda-bld\udunits2_1528730419962\_h_env\Library\bin\cmake.exe' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
Traceback (most recent call last):
  File "C:\Miniconda36-x64\Scripts\conda-build-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Miniconda36-x64\lib\site-packages\conda_build\cli\main_build.py", line 420, in main
    execute(sys.argv[1:])
  File "C:\Miniconda36-x64\lib\site-packages\conda_build\cli\main_build.py", line 411, in execute
    verify=args.verify)
  File "C:\Miniconda36-x64\lib\site-packages\conda_build\api.py", line 200, in build
    notest=notest, need_source_download=need_source_download, variants=variants)
  File "C:\Miniconda36-x64\lib\site-packages\conda_build\build.py", line 2177, in build_tree
    notest=notest,
  File "C:\Miniconda36-x64\lib\site-packages\conda_build\build.py", line 1385, in build
    windows.build(m, build_file, stats=build_stats)
  File "C:\Miniconda36-x64\lib\site-packages\conda_build\windows.py", line 297, in build
    check_call_env(cmd, cwd=src_dir, stats=stats)
  File "C:\Miniconda36-x64\lib\site-packages\conda_build\utils.py", line 310, in check_call_env
    return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
  File "C:\Miniconda36-x64\lib\site-packages\conda_build\utils.py", line 290, in _func_defaulting_env_to_os_environ
    raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['cmd.exe', '/c', 'bld.bat']' returned non-zero exit status 1.

I have no idea why AppVeyor is reporting a green status when the last message is subprocess.CalledProcessError: Command '['cmd.exe', '/c', 'bld.bat']' returned non-zero exit status 1. @msarahan is this a bug in conda-build? Or am I using it wrong? This used to failed as expected some time ago :-/

msarahan commented 6 years ago

I don't think it is a conda-build bug. We had an internal user report this also a little while back. I looked into it, but didn't see anything amiss. You may want to add

if %ERRORLEVEL% NEQ 0 exit 1

just below your conda-build call.

ocefpaf commented 6 years ago

You may want to add if %ERRORLEVEL% NEQ 0 exit 1

Thanks. Just send a commit to test that.

ocefpaf commented 6 years ago

@msarahan same thing :-(

https://ci.appveyor.com/project/ocefpaf/udunits-2/build/1.0.17

msarahan commented 6 years ago

That's annoying.

Here's what conda-build does:

outer try: https://github.com/conda/conda-build/blob/master/conda_build/build.py#L2120 inner subprocess call: https://github.com/conda/conda-build/blob/master/conda_build/build.py#L1417 except: https://github.com/conda/conda-build/blob/master/conda_build/build.py#L2249

There is nothing that catches that subprocess exception, FWICT. It absolutely should be erroring out, and it is, based on https://ci.appveyor.com/project/ocefpaf/udunits-2/build/1.0.17#L598

but somehow appveyor isn't reading that status correctly. Maybe try forcing appveyor to treat it as cmd.exe, not powershell?

ocefpaf commented 6 years ago

Maybe try forcing appveyor to treat it as cmd.exe, not powershell?

That could be it. Not sure how to force that though. I'll read up the docs later. Thanks!

semmerson commented 6 years ago

@ocefpaf & @msarahan, Hang on. I've made default_udunits2_xml_path() static because the public function ut_get_xml_path() should have been used by the udunits2 program, instead. This might obviate the problem.

semmerson commented 6 years ago

@ocefpaf Besides the apparent "success" problem, the Appveyor test fails because the udunits2 program can't find the installed database. See log.txt.

Can you fix this?