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

[netcdf-c:x86-windows] link problem - MPI #14263

Closed
vjandasek opened this issue Oct 27, 2020 · 13 comments · Fixed by #14421
Closed

[netcdf-c:x86-windows] link problem - MPI #14263

vjandasek opened this issue Oct 27, 2020 · 13 comments · Fixed by #14421
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@vjandasek
Copy link

vjandasek commented Oct 27, 2020

Host Environment

  • OS: Windows 10, build 19041.572
  • Compiler: 19.27.29112

To Reproduce
Steps to reproduce the behavior:
vcpkg install netcdf-c[core]:x86-windows

Failure logs

[139/140] cmd.exe /C "cd . && D:\Dokumenty\Projects\lib\vcpkg\downloads\tools\cmake-3.18.4-windows\cmake-3.18.4-win32-x86\bin\cmake.exe -E vs_link_dll --intdir=liblib\CMakeFiles\netcdf.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1427~1.291\bin\Hostx64\x86\link.exe  @CMakeFiles\netcdf.rsp  /out:liblib\netcdf.dll /implib:liblib\netcdf.lib /pdb:liblib\netcdf.pdb /dll /version:18.0 /machine:X86 /LARGEADDRESSAWARE /STACK:40000000 /nologo    /debug /INCREMENTAL  /NODEFAULTLIB:MSVCRT  && cd ."
FAILED: liblib/netcdf.dll liblib/netcdf.lib 
cmd.exe /C "cd . && D:\Dokumenty\Projects\lib\vcpkg\downloads\tools\cmake-3.18.4-windows\cmake-3.18.4-win32-x86\bin\cmake.exe -E vs_link_dll --intdir=liblib\CMakeFiles\netcdf.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1427~1.291\bin\Hostx64\x86\link.exe  @CMakeFiles\netcdf.rsp  /out:liblib\netcdf.dll /implib:liblib\netcdf.lib /pdb:liblib\netcdf.pdb /dll /version:18.0 /machine:X86 /LARGEADDRESSAWARE /STACK:40000000 /nologo    /debug /INCREMENTAL  /NODEFAULTLIB:MSVCRT  && cd ."
LINK Pass 1: command "C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1427~1.291\bin\Hostx64\x86\link.exe @CMakeFiles\netcdf.rsp /out:liblib\netcdf.dll /implib:liblib\netcdf.lib /pdb:liblib\netcdf.pdb /dll /version:18.0 /machine:X86 /LARGEADDRESSAWARE /STACK:40000000 /nologo /debug /INCREMENTAL /NODEFAULTLIB:MSVCRT /MANIFEST /MANIFESTFILE:liblib\CMakeFiles\netcdf.dir/intermediate.manifest liblib\CMakeFiles\netcdf.dir/manifest.res" failed (exit code 1120) with the following output:
   Creating library liblib\netcdf.lib and object liblib\netcdf.exp
dinfermodel.c.obj : error LNK2019: unresolved external symbol _MPI_Error_class@8 referenced in function _openmagic
dinfermodel.c.obj : error LNK2019: unresolved external symbol _MPI_File_open@20 referenced in function _openmagic
dinfermodel.c.obj : error LNK2019: unresolved external symbol _MPI_File_close@4 referenced in function _closemagic
dinfermodel.c.obj : error LNK2019: unresolved external symbol _MPI_File_get_size@8 referenced in function _openmagic
dinfermodel.c.obj : error LNK2019: unresolved external symbol _MPI_File_read_at_all@28 referenced in function _readmagic
hdf5file.c.obj : error LNK2019: unresolved external symbol _MPI_Comm_free@4 referenced in function _nc4_close_netcdf4_file
hdf5create.c.obj : error LNK2001: unresolved external symbol _MPI_Comm_free@4
hdf5open.c.obj : error LNK2001: unresolved external symbol _MPI_Comm_free@4
hdf5file.c.obj : error LNK2019: unresolved external symbol _MPI_Info_free@4 referenced in function _nc4_close_netcdf4_file
hdf5create.c.obj : error LNK2001: unresolved external symbol _MPI_Info_free@4
hdf5open.c.obj : error LNK2001: unresolved external symbol _MPI_Info_free@4
hdf5create.c.obj : error LNK2019: unresolved external symbol _MPI_Comm_dup@8 referenced in function _nc4_create_file
hdf5open.c.obj : error LNK2001: unresolved external symbol _MPI_Comm_dup@8
hdf5create.c.obj : error LNK2019: unresolved external symbol _MPI_Info_dup@8 referenced in function _nc4_create_file
hdf5open.c.obj : error LNK2001: unresolved external symbol _MPI_Info_dup@8
hdf5var.c.obj : error LNK2019: unresolved external symbol _MPI_Allreduce@24 referenced in function _NC4_put_vars
liblib\netcdf.dll : fatal error LNK1120: 10 unresolved externals
ninja: build stopped: subcommand failed.
@NancyLi1013 NancyLi1013 added the requires:repro The issue is not currently repro-able label Oct 28, 2020
@NancyLi1013
Copy link
Contributor

Hi @vjandasek
Thanks for posting this issue.

Have you tried the latest version in vcpkg? netcdf-c had been updated to 4.7.4 in master branch 4 days ago.

I cannot reproduce this on my machine.

@vjandasek
Copy link
Author

Hello @NancyLi1013,

thanks for the hint. However, I have run git pull, bootstrap-vcpkg.bat, vcpkg update, vcpkg upgrade and then tried vcpkg install netcdf-c already multiple times, still getting the same error. I can build the x64-windows without problems, but the x86-windows keeps producing the link error.
vcpkg search netcdf-c gives me netcdf-c 4.7.4, so I suppose vcpkg really is downloads the correct version.
Should I try to delete some cache or reinstall other packages?

@NancyLi1013
Copy link
Contributor

Should I try to delete some cache or reinstall other packages?

Yes, it would be better to reinstall the dependencies and delete the related caches. Then try to rebuild this.

Here is the build result from my machine:

Starting package 4/4: netcdf-c:x86-windows
Building package netcdf-c[core]:x86-windows...
-- Downloading https://github.com/Unidata/netcdf-c/archive/26fba54a58fa02af92d84441ed90b417c1d08161.tar.gz...
-- Extracting source F:/vcpkg/downloads/Unidata-netcdf-c-26fba54a58fa02af92d84441ed90b417c1d08161.tar.gz
-- Applying patch no-install-deps.patch
-- Applying patch config-pkg-location.patch
-- Applying patch use_targets.patch
-- Applying patch fix-dependency-libmath.patch
-- Using source at F:/vcpkg/buildtrees/netcdf-c/src/17c1d08161-e4ef00dd1e.clean
-- Configuring x86-windows-dbg
-- Configuring x86-windows-rel
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Installing: F:/vcpkg/packages/netcdf-c_x86-windows/share/netcdf-c/usage
-- Installing: F:/vcpkg/packages/netcdf-c_x86-windows/share/netcdf-c/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package netcdf-c[core]:x86-windows... done
Installing package netcdf-c[core]:x86-windows...
Installing package netcdf-c[core]:x86-windows... done
Elapsed time for package netcdf-c:x86-windows: 4.497 min

Total elapsed time: 15.75 min

The package netcdf-c provides CMake targets:

    find_package(netCDF CONFIG REQUIRED)
    target_link_libraries(main PRIVATE netcdf)

@Neumann-A
Copy link
Contributor

if you have hdf5[parallel] installed you need to build all dependend libraries with MPI enabled

@vjandasek
Copy link
Author

vjandasek commented Oct 29, 2020

Thanks for pointing out the hdf5[parallel] - I really had it installed. Without it, netcdf-c was possible to install. However, even with clean vcpkg installation, only hdf5[parallel], I was not able to get netcdf-c compiled.

@NancyLi1013 NancyLi1013 added category:port-bug The issue is with a library, which is something the port should already support and removed requires:repro The issue is not currently repro-able labels Nov 2, 2020
@NancyLi1013
Copy link
Contributor

You can try to add mpi as one of dependencies for netcdf-c, it can build successfully.

@vjandasek
Copy link
Author

@NancyLi1013 How should I do this please?

@NancyLi1013
Copy link
Contributor

You can update the Build-Depends

Build-Depends: hdf5, curl

as

Build-Depends: hdf5, curl, mpi

@NancyLi1013
Copy link
Contributor

Hi @vjandasek
I submitted a PR #14421 to fix this issue. Could you please try to rebuild and help confirm if this can work for you?

Thanks.

@vjandasek
Copy link
Author

Hi @NancyLi1013,

I tried both the update of Build-Depends and the changes from your pull request, however with no luck.

The update of the Build-Depends produces the same message as before.
The changes from your pull request do the following:

CMake Error at scripts/cmake/vcpkg_apply_patches.cmake:55 (message):
Applying patch failed. error: corrupt patch at line 19

@NancyLi1013
Copy link
Contributor

Thanks for your update. I will check this again on my local.

@NancyLi1013
Copy link
Contributor

Hi @vjandasek

It seems that there are something wrong with the patch.

Could you please help provide the install process here or try to clone a new repo based on #14421 to test this?

I try to install this again on my machine based on the PR #14421 and there is no any error.

Before install netcdf-c, I have installed hdf5[parallel].

PS F:\14421\vcpkg> .\vcpkg.exe install netcdf-c
Computing installation plan...
The following packages will be built and installed:
  * curl[core,non-http,schannel,ssl,sspi,winssl]:x86-windows
    netcdf-c[core]:x86-windows
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x86-windows...
Starting package 1/2: curl:x86-windows
Building package curl[core,non-http,schannel,ssl,sspi,winssl]:x86-windows...
-- Downloading https://github.com/curl/curl/archive/315ee3fe75dade912b48a21ceec9ccda0230d937.tar.gz...
-- Extracting source F:/14421/vcpkg/downloads/curl-curl-315ee3fe75dade912b48a21ceec9ccda0230d937.tar.gz
-- Applying patch 0002_fix_uwp.patch
-- Applying patch 0004_nghttp2_staticlib.patch
-- Applying patch 0005_remove_imp_suffix.patch
-- Applying patch 0006_fix_tool_depends.patch
-- Applying patch 0007_disable_tool_export_curl_target.patch
-- Applying patch 0009_fix_openssl_config.patch
-- Applying patch 0010_fix_othertests_cmake.patch
-- Applying patch 0011_fix_static_build.patch
-- Using source at F:/14421/vcpkg/buildtrees/curl/src/da0230d937-b280319101.clean
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Installing: F:/14421/vcpkg/packages/curl_x86-windows/share/curl/curl-config
-- Installing: F:/14421/vcpkg/packages/curl_x86-windows/share/curl/vcpkg-cmake-wrapper.cmake
-- Installing: F:/14421/vcpkg/packages/curl_x86-windows/share/curl/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package curl[core,non-http,schannel,ssl,sspi,winssl]:x86-windows... done
Installing package curl[core,non-http,schannel,ssl,sspi,winssl]:x86-windows...
Installing package curl[core,non-http,schannel,ssl,sspi,winssl]:x86-windows... done
Elapsed time for package curl:x86-windows: 5.338 min
Starting package 2/2: netcdf-c:x86-windows
Building package netcdf-c[core]:x86-windows...
-- Downloading https://github.com/Unidata/netcdf-c/archive/26fba54a58fa02af92d84441ed90b417c1d08161.tar.gz...
-- Extracting source F:/14421/vcpkg/downloads/Unidata-netcdf-c-26fba54a58fa02af92d84441ed90b417c1d08161.tar.gz
-- Applying patch no-install-deps.patch
-- Applying patch config-pkg-location.patch
-- Applying patch use_targets.patch
-- Applying patch fix-dependency-libmath.patch
-- Applying patch fix-linkage-error.patch
-- Using source at F:/14421/vcpkg/buildtrees/netcdf-c/src/17c1d08161-2a03551a83
-- Configuring x86-windows-dbg
-- Configuring x86-windows-rel
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Installing: F:/14421/vcpkg/packages/netcdf-c_x86-windows/share/netcdf-c/usage
-- Installing: F:/14421/vcpkg/packages/netcdf-c_x86-windows/share/netcdf-c/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package netcdf-c[core]:x86-windows... done
Installing package netcdf-c[core]:x86-windows...
Installing package netcdf-c[core]:x86-windows... done
Elapsed time for package netcdf-c:x86-windows: 6.24 min

Total elapsed time: 11.78 min

The package netcdf-c provides CMake targets:

    find_package(netCDF CONFIG REQUIRED)
    target_link_libraries(main PRIVATE netcdf)

@vjandasek
Copy link
Author

Hi @NancyLi1013,

sorry, I probably did something incorrectly last time. I retried with fresh vcpkg, checked out your branch and now it works without any problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants