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

Windows JDK15 VS2019 "error LNK2001: unresolved external symbol" #9978

Closed
jdekonin opened this issue Jun 22, 2020 · 4 comments · Fixed by #10353
Closed

Windows JDK15 VS2019 "error LNK2001: unresolved external symbol" #9978

jdekonin opened this issue Jun 22, 2020 · 4 comments · Fixed by #10353

Comments

@jdekonin
Copy link
Contributor

jdekonin commented Jun 22, 2020

Encountered while attempting to compile Windows JDK15 with VS2019 under #9805

internal job/Build_JDK15_x86-64_windows_Personal/2 on win16x64rt1

I get (fatal) failures like this during

link -DLL -subsystem:windows -nologo -nodefaultlib -incremental:no -debug -machine:AMD64   -libpath:"C:\Users\jenkins\workspace\Build_JDK15_x86-64_windows_Personal\build\windows-x86_64-server-release\vm" -libpath:"C:\Users\jenkins\workspace\Build_JDK15_x86-64_windows_Personal\build\windows-x86_64-server-release\vm\lib" -OUT:"C:\Users\jenkins\workspace\Build_JDK15_x86-64_windows_Personal\build\windows-x86_64-server-release\vm\j9jit29.dll" -MAP:"C:\Users\jenkins\workspace\Build_JDK15_x86-64_windows_Personal\build\windows-x86_64-server-release\vm\j9jit29.dll.map"  -DEF:"C:\Users\jenkins\workspace\Build_JDK15_x86-64_windows_Personal\build\windows-x86_64-server-release\vm\compiler\build\scripts\j9jit.def" @"C:\Users\jenkins\workspace\Build_JDK15_x86-64_windows_Personal\build\windows-x86_64-server-release\vm\j9jit29.dll.objlist" "j9jit_vm.lib" "j9codert_vm.lib" "j9util.lib" "j9utilcore.lib" "j9pool.lib" "j9avl.lib" "j9stackmap.lib" "j9hashtable.lib" "j9jit_vm.lib" "j9codert_vm.lib" "j9util.lib" "j9utilcore.lib" "j9pool.lib" "j9avl.lib" "j9stackmap.lib" "j9hashtable.lib" "j9thr.lib" "j9hookable.lib" "kernel32.lib" "oldnames.lib" "msvcrt.lib" "msvcprt.lib" "ws2_32.lib"

17:19:39     Creating library C:\Users\jenkins\workspace\Build_JDK15_x86-64_windows_Personal\build\windows-x86_64-server-release\vm\j9jit29.lib and object C:\Users\jenkins\workspace\Build_JDK15_x86-64_windows_Personal\build\windows-x86_64-server-release\vm\j9jit29.exp
17:19:39  j9hashtable.lib(hashtable.obj) : error LNK2001: unresolved external symbol memcpy
17:19:39  j9codert_vm.lib(jithash.obj) : error LNK2001: unresolved external symbol memcpy
17:19:39  j9codert_vm.lib(dlt.obj) : error LNK2001: unresolved external symbol memcpy
17:19:39  j9utilcore.lib(j9argscan.obj) : error LNK2001: unresolved external symbol memcpy
17:19:39  j9stackmap.lib(stackmap.obj) : error LNK2001: unresolved external symbol memcpy
17:19:39  OMRCodeGenerator.obj : error LNK2001: unresolved external symbol memcpy
17:19:39  OMRLinkage.obj : error LNK2001: unresolved external symbol memcpy
17:19:39  j9codert_vm.lib(decomp.obj) : error LNK2001: unresolved external symbol memcpy
17:19:39  j9codert_vm.lib(thunkcrt.obj) : error LNK2001: unresolved external symbol memcpy
...
2020-06-22T21:19:39.490Z] OMRMemoryReference.obj : error LNK2001: unresolved external symbol __imp___stdio_common_vsprintf
[2020-06-22T21:19:39.490Z] OMRCodeGenerator.obj : error LNK2001: unresolved external symbol __imp___stdio_common_vsprintf
[2020-06-22T21:19:39.490Z] OMRMemoryReference.obj : error LNK2001: unresolved external symbol __imp___stdio_common_vsprintf
...
[2020-06-22T21:19:39.491Z] OMRMemoryReference.obj : error LNK2001: unresolved external symbol __CxxFrameHandler4
[2020-06-22T21:19:39.491Z] OMRTreeEvaluator.obj : error LNK2001: unresolved external symbol __CxxFrameHandler4
[2020-06-22T21:19:39.491Z] msvcrt.lib(gshandlereh4.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
...
[2020-06-22T21:19:39.494Z] OMRMemoryReference.obj : error LNK2001: unresolved external symbol __std_exception_copy
[2020-06-22T21:19:39.494Z] X86BinaryEncoding.obj : error LNK2001: unresolved external symbol __std_exception_copy
[2020-06-22T21:19:39.494Z] OMRMemoryReference.obj : error LNK2001: unresolved external symbol __std_exception_copy
...
@pshipton
Copy link
Member

I'm guessing some support library has been renamed, such as one of "msvcrt.lib" "msvcprt.lib" "ws2_32.lib". @andrewcraik fyi

@pshipton pshipton added the jdk15 label Jun 22, 2020
@andrewcraik
Copy link
Contributor

@rpshukla can you look?

@andrewcraik
Copy link
Contributor

FYI @liqunl

@mayshukla
Copy link
Contributor

It looks like this issue might be related to changes to standard libraries in recent versions of visual studio:
https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp?view=vs-2019#upgrading-with-the-linker-options-nodefaultlib-entry-and-noentry

According to this article, there may be additional libraries we need to include. E.g. if we were including msvcrt.lib, then we may now need to include msvcrt.lib, ucrt.lib, vcruntime.lib.

mayshukla added a commit to mayshukla/openj9 that referenced this issue Aug 6, 2020
In recent versions of Visual Studio, some of the contents of msvcrt.lib have
been moved into ucrt.lib and vcruntime.lib. The makefiles were already set up
to add these 2 additional libraries to the linker command when building using
VS 2015 or 2017. This commit ensures these libraries are also included when
using VS2019.

Fixes: eclipse-openj9#9978

Signed-off-by: Ryan Shukla <ryans@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants