trilinos / Trilinos

Primary repository for the Trilinos Project
https://trilinos.org/
Other
1.21k stars 563 forks source link

Thyra: Unresolved external symbol on linking phase building on Windows with shared libraries #13355

Open sskutnik opened 2 months ago

sskutnik commented 2 months ago

Bug Report

@bartlettroscoe

Description

I am attempting to compile Trillinos 14.4 on Windows (Windows Server 2019) using MSVC 2022. Doing this without shared libraries works fine (i.e., we routinely use Trilinos in our Windows build, wherein Trilinos is built / used without shared libraries). However, if I enable shared libraries, I'm running into the following unresolved symbol issue in linking:

FAILED: packages/thyra/core/src/thyracore.dll packages/thyra/core/src/thyracore.lib
C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C "C:\toolchains\serial\bin\cmake.exe -E __create_def E:\toolchains\windows\2k19\build\packages\thyra\core\src\CMakeFiles\thyracore.dir\.\exports.def E:\toolchains\windows\2k19\build\packages\thyra\core\src\CMakeFiles\thyracore.dir\.\exports.def.objs && cd E:\toolchains\windows\2k19\build" && C:\toolchains\serial\bin\cmake.exe -E vs_link_dll --intdir=packages\thyra\core\src\CMakeFiles\thyracore.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\thyracore.rsp  /out:packages\thyra\core\src\thyracore.dll /implib:packages\thyra\core\src\thyracore.lib /pdb:packages\thyra\core\src\thyracore.pdb /dll /version:14.4 /machine:x64 /INCREMENTAL:NO  /DEF:packages\thyra\core\src\CMakeFiles\thyracore.dir\.\exports.def && cd ."
LINK: command "C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\thyracore.rsp /out:packages\thyra\core\src\thyracore.dll /implib:packages\thyra\core\src\thyracore.lib /pdb:packages\thyra\core\src\thyracore.pdb /dll /version:14.4 /machine:x64 /INCREMENTAL:NO /DEF:packages\thyra\core\src\CMakeFiles\thyracore.dir\.\exports.def /MANIFEST:EMBED,ID=2" failed (exit code 1120) with the following output:
   Creating library packages\thyra\core\src\thyracore.lib and object packages\thyra\core\src\thyracore.exp
Thyra_DefaultSerialDenseLinearOpWithSolve.cpp.obj : error LNK2019: unresolved external symbol "class Teuchos::Tuple<char,3> const RTOpPack::transpMap" (?transpMap@RTOpPack@@3V?$Tuple@D$02@Teuchos@@B) referenced in function "void __cdecl RTOpPack::getrs<double>(class RTOpPack::ConstSubMultiVectorView<double> const &,class Teuchos::ArrayView<int const > const &,enum RTOpPack::ETransp,class Teuchos::Ptr<class RTOpPack::SubMultiVectorView<double> const > const &)" (??$getrs@N@RTOpPack@@YAXAEBV?$ConstSubMultiVectorView@N@0@AEBV?$ArrayView@$$CBH@Teuchos@@W4ETransp@0@AEBV?$Ptr@$$CBV?$SubMultiVectorView@N@RTOpPack@@@3@@Z)
packages\thyra\core\src\thyracore.dll : fatal error LNK1120: 1 unresolved externals

Note that I'm trying to enable shared libraries because I'm trying to allow an external project to link to ours via shared libraries (wherein our project depends on Trilinos).

Steps to Reproduce

  1. SHA1: 975307431d60d0859ebaa27c9169cbb1d4287513
  2. Configure script: Trilinos.txt
  3. Configure log: config.log
  4. Build log: build.log
  5. Input deck: N/A
bartlettroscoe commented 2 months ago

Hello @sskutnik, thanks for the bug report. I would have to study the code to see what the the problem might be but it would be hard without reproducing the problem myself. Unfortunately, I don't have a convenient way to reproduce errors with MSVC++ on Windows.

Due to constrained support budgets and lack of recent pull from internal customers, Trilinos is not currently testing or supporting Trilinos builds on Windows (even though CMake supports Windows just fine and that was actually one of the reasons that Trilinos switched over to CMake in 2008, ironically.)

According to official Trilinos policy:

we can accept PRs that address problems on non-supported compilers and platforms but can't directly support these platforms.

Please let me know what you would like to do about this.

sskutnik commented 2 months ago

@bartlettroscoe Thanks; I will try to look into this a bit more on my end as time permits and report back if I find anything.