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

[MSVC] ROOT_x86 failed due to libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char) #15336

Closed
1 task done
SyahmieS opened this issue Apr 25, 2024 · 13 comments · Fixed by #15855
Assignees
Labels

Comments

@SyahmieS
Copy link

SyahmieS commented Apr 25, 2024

Check duplicate issues.

  • Checked for duplicates

Description

Hi all,

[MSVC] ROOT_x86 failed due to failed due to libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char). It can be reproduced on this commit 1f86c24 Could you please help look at this issue? Thanks in advance!

Reproducer

Steps to reproduce the behavior:

  1. https://github.com/root-project/root C:\gitP\root-project/root
  2. Open a VS2022 x86 cmd
  3. set VSCMD_SKIP_SENDTELEMETRY=1 & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=x86 -arch=x86 & set CL= /Bcapture_repro C:\a_work_temp\rwc_project_logs\ROOT\preprocessed_repro_build & set LINK= /onfailrepro:C:\a_work_temp\rwc_project_logs\ROOT\link_repro_build
  4. cd /d C:\gitP\root-project\root\build_x86
  5. msbuild /m /p:Platform=Win32 /p:Configuration=Release ALL_BUILD.vcxproj /t:Rebuild 2>&1

Error Message: After updating the hash commit, ROOT_amd64 passed but ROOT_X86 failed with the following error:
libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char)"

What is the expected behaviour?
Project Pass

Operating System
Windows

What versions of the operating systems?
VS 2022 + Windows Server 2022 Datacenter

Architectures
86-bit

Stacktrace
No response

Plug-in formats (if applicable)
No response

Plug-in host applications (DAWs) (if applicable)
No response

Testing on the develop branch
The bug is present on the develop branch.

ROOT version

N/A

Installation method

N/A

Operating system

Windows

Additional context

No response

@SyahmieS SyahmieS added the bug label Apr 25, 2024
@SyahmieS SyahmieS changed the title [MSVC] ROOT_x86 failed due to fatal error LNK1181: cannot open input file 'libCore.lib'. [MSVC] ROOT_x86 failed due libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char) Apr 25, 2024
@bellenot
Copy link
Member

@SyahmieS it is maybe related to #15321 and #9445
I'm pretty sure that building ROOT without the following environment variables will work:

& set CL= /Bcapture_repro C:\a_work_temp\rwc_project_logs\ROOT\preprocessed_repro_build & set LINK= /onfailrepro:C:\a_work_temp\rwc_project_logs\ROOT\link_repro_build

@bellenot
Copy link
Member

I just tried with ROOT master and it works with the following commands:

set VSCMD_SKIP_SENDTELEMETRY=1 & "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -host_arch=x86 -arch=x86 & set CL= /Bcapture_repro C:\a_work_temp\rwc_project_logs\ROOT\preprocessed_repro_build & set LINK= /onfailrepro:C:\a_work_temp\rwc_project_logs\ROOT\link_repro_build
cmake -G "Visual Studio 17 2022" -A Win32 -Dtesting=ON -Droottest=ON -Droofit=off ..\..\..\git\master
msbuild /m /p:Platform=Win32 /p:Configuration=Release ALL_BUILD.vcxproj /t:Rebuild

@SyahmieS SyahmieS changed the title [MSVC] ROOT_x86 failed due libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char) [MSVC] ROOT_x86 failed due to libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char) Apr 26, 2024
@dpiparo
Copy link
Member

dpiparo commented May 24, 2024

In absence of an answer and the ability to reproduce, I am closing. Please feel free to re-open if I misunderstand the status of this issue.

@dpiparo dpiparo closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
Copy link

Hi @dpiparo, @bellenot,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely,
🤖

@spacelg
Copy link

spacelg commented Jun 7, 2024

Hi @bellenot @dpiparo , thank you for your reply. Yes, we tried to build with VS2022 17.9.6 Release and there was indeed no such issue.

However, we are actually testing an unreleased version of VS with an open source project, which means an unreleased MSVC. But this problem still exists. And we got some information from the MSVC team as follows.

Failing (latest prod/be):
??$__std_find_trivial@$$CBDD@std@@YAPBDQBD0D@Z (char const * __cdecl std::__std_find_trivial<char const ,char>(char const * const,char const * const,char))

Passing (17.9.6):
??$__std_find_trivial@$$CBDD@@YAPBDPBD0D@Z (char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char))

It looks like ROOT manually adds exports in their cmake build steps: root/core/metacling/src/CMakeLists.txt at master · root-project/root · GitHub

    ??$__std_find_trivial@$$CBDD@@YAPBDPBD0D@Z
    ??$__std_find_trivial@DD@@YAPADPAD0D@Z
    ??$__std_find_trivial@HH@@YAPAHPAH0H@Z
    ??$__std_find_trivial@IH@@YAPAIPAI0H@Z

I think the first four lines need to get updated with the new undecorated names, but I'm not sure what exactly they need or why those specific implementations are being exported right now.

Actual Result:
Creating library .\libCling.lib and object .\libCling.exp
libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char)" (??$__std_find_trivial@$$CBDD@@YAPBDPBD0D@Z)
libCling.exp : error LNK2001: unresolved external symbol "char * __cdecl __std_find_trivial<char,char>(char *,char *,char)" (??$__std_find_trivial@DD@@YAPADPAD0D@Z)
libCling.exp : error LNK2001: unresolved external symbol "int * __cdecl __std_find_trivial<int,int>(int *,int *,int)" (??$__std_find_trivial@HH@@YAPAHPAH0H@Z)
libCling.exp : error LNK2001: unresolved external symbol "unsigned int * __cdecl __std_find_trivial<unsigned int,int>(unsigned int *,unsigned int *,int)" (??$__std_find_trivial@IH@@YAPAIPAI0H@Z)
.\libCling.dll : fatal error LNK1120: 4 unresolved externals

@bellenot
Copy link
Member

bellenot commented Jun 7, 2024

Can you tell us what exact version of Visual Studio you are using? I tried ROOT master with the v17.11.0-pre.1.1 without problem. I will not be able to fix the issue until I can reproduce it...
And the correct MSVC_VERSION will be needed too

@bellenot bellenot reopened this Jun 7, 2024
@spacelg
Copy link

spacelg commented Jun 7, 2024

Thank you for your quick response, @bellenot.

The version of VS we use is not important, we just need to test the compiler MSVC inside VS, the compiler version is the latest, not release or preview. it's development version. And the correct MSVC_VERSION as below.

Microsoft (R) C/C++ Optimizing Compiler Version 19.41.34007.96 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

@bellenot
Copy link
Member

bellenot commented Jun 7, 2024

@spacelg then there is nothing we can do for the time being. We'll have to wait until the compiler is available for testing. Please ping us when it is available, so we can fix the issue before the public release.

@bellenot
Copy link
Member

bellenot commented Jun 7, 2024

@spacelg Let me try something... I'll keep you updated

@spacelg
Copy link

spacelg commented Jun 7, 2024

@bellenot , thank you very much for your reply and information, if there is any workaround info, we will try it.

@bellenot
Copy link
Member

bellenot commented Jun 7, 2024

So you can try to filer out the symbols using the CMake variable CMAKE_CXX_COMPILER_VERSION. For example (core/metacling/src/CMakeLists.txt, lines 196-208):

    if(MSVC_VERSION GREATER_EQUAL 1938 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.41.34007.96")
      set(cling_exports ${cling_exports}
        ??$__std_find_trivial@$$CBDD@@YAPBDPBD0D@Z
        ??$__std_find_trivial@DD@@YAPADPAD0D@Z
        ??$__std_find_trivial@HH@@YAPAHPAH0H@Z
        ??$__std_find_trivial@IH@@YAPAIPAI0H@Z
        ___std_find_trivial_1@12
        ___std_find_trivial_2@12
        ___std_find_trivial_4@12
        ___std_find_trivial_8@16
      )
    endif()

@spacelg
Copy link

spacelg commented Jun 11, 2024

Hi @bellenot , thank you very much for the workaround you provided, after testing, it works for us.

@bellenot
Copy link
Member

You're very welcome! And thanks for the feedback!

@bellenot bellenot reopened this Jun 14, 2024
bellenot added a commit to bellenot/root that referenced this issue Jun 14, 2024
Fixes root-project#15336
Fix the following compilation errors with Visual Studio v17.10 on x86
```
libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char)" (??$__std_find_trivial@$$CBDD@@YAPBDPBD0D@Z) [C:\
root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "char * __cdecl __std_find_trivial<char,char>(char *,char *,char)" (??$__std_find_trivial@DD@@YAPADPAD0D@Z) [C:\root-dev\build\x86\release\co
re\metacling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "int * __cdecl __std_find_trivial<int,int>(int *,int *,int)" (??$__std_find_trivial@HH@@YAPAHPAH0H@Z) [C:\root-dev\build\x86\release\core\met
acling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "unsigned int * __cdecl __std_find_trivial<unsigned int,int>(unsigned int *,unsigned int *,int)" (??$__std_find_trivial@IH@@YAPAIPAI0H@Z) [C:
\root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
C:\root-dev\build\x86\release\bin\libCling.dll : fatal error LNK1120: 4 unresolved externals [C:\root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
```
bellenot added a commit that referenced this issue Jun 14, 2024
Fixes #15336
Fix the following compilation errors with Visual Studio v17.10 on x86
```
libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char)" (??$__std_find_trivial@$$CBDD@@YAPBDPBD0D@Z) [C:\
root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "char * __cdecl __std_find_trivial<char,char>(char *,char *,char)" (??$__std_find_trivial@DD@@YAPADPAD0D@Z) [C:\root-dev\build\x86\release\co
re\metacling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "int * __cdecl __std_find_trivial<int,int>(int *,int *,int)" (??$__std_find_trivial@HH@@YAPAHPAH0H@Z) [C:\root-dev\build\x86\release\core\met
acling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "unsigned int * __cdecl __std_find_trivial<unsigned int,int>(unsigned int *,unsigned int *,int)" (??$__std_find_trivial@IH@@YAPAIPAI0H@Z) [C:
\root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
C:\root-dev\build\x86\release\bin\libCling.dll : fatal error LNK1120: 4 unresolved externals [C:\root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
```
bellenot added a commit to bellenot/root that referenced this issue Jun 14, 2024
Fixes root-project#15336
Fix the following compilation errors with Visual Studio v17.10 on x86
```
libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char)" (??$__std_find_trivial@$$CBDD@@YAPBDPBD0D@Z) [C:\
root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "char * __cdecl __std_find_trivial<char,char>(char *,char *,char)" (??$__std_find_trivial@DD@@YAPADPAD0D@Z) [C:\root-dev\build\x86\release\co
re\metacling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "int * __cdecl __std_find_trivial<int,int>(int *,int *,int)" (??$__std_find_trivial@HH@@YAPAHPAH0H@Z) [C:\root-dev\build\x86\release\core\met
acling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "unsigned int * __cdecl __std_find_trivial<unsigned int,int>(unsigned int *,unsigned int *,int)" (??$__std_find_trivial@IH@@YAPAIPAI0H@Z) [C:
\root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
C:\root-dev\build\x86\release\bin\libCling.dll : fatal error LNK1120: 4 unresolved externals [C:\root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
```
dpiparo pushed a commit that referenced this issue Jun 15, 2024
Fixes #15336
Fix the following compilation errors with Visual Studio v17.10 on x86
```
libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char)" (??$__std_find_trivial@$$CBDD@@YAPBDPBD0D@Z) [C:\
root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "char * __cdecl __std_find_trivial<char,char>(char *,char *,char)" (??$__std_find_trivial@DD@@YAPADPAD0D@Z) [C:\root-dev\build\x86\release\co
re\metacling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "int * __cdecl __std_find_trivial<int,int>(int *,int *,int)" (??$__std_find_trivial@HH@@YAPAHPAH0H@Z) [C:\root-dev\build\x86\release\core\met
acling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "unsigned int * __cdecl __std_find_trivial<unsigned int,int>(unsigned int *,unsigned int *,int)" (??$__std_find_trivial@IH@@YAPAIPAI0H@Z) [C:
\root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
C:\root-dev\build\x86\release\bin\libCling.dll : fatal error LNK1120: 4 unresolved externals [C:\root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
```
silverweed pushed a commit to silverweed/root that referenced this issue Aug 19, 2024
Fixes root-project#15336
Fix the following compilation errors with Visual Studio v17.10 on x86
```
libCling.exp : error LNK2001: unresolved external symbol "char const * __cdecl __std_find_trivial<char const ,char>(char const *,char const *,char)" (??$__std_find_trivial@$$CBDD@@YAPBDPBD0D@Z) [C:\
root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "char * __cdecl __std_find_trivial<char,char>(char *,char *,char)" (??$__std_find_trivial@DD@@YAPADPAD0D@Z) [C:\root-dev\build\x86\release\co
re\metacling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "int * __cdecl __std_find_trivial<int,int>(int *,int *,int)" (??$__std_find_trivial@HH@@YAPAHPAH0H@Z) [C:\root-dev\build\x86\release\core\met
acling\src\Cling.vcxproj]
libCling.exp : error LNK2001: unresolved external symbol "unsigned int * __cdecl __std_find_trivial<unsigned int,int>(unsigned int *,unsigned int *,int)" (??$__std_find_trivial@IH@@YAPAIPAI0H@Z) [C:
\root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
C:\root-dev\build\x86\release\bin\libCling.dll : fatal error LNK1120: 4 unresolved externals [C:\root-dev\build\x86\release\core\metacling\src\Cling.vcxproj]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Issues
Development

Successfully merging a pull request may close this issue.

4 participants