On 2021/06/17 10:31, David Holmes wrote:
Hi Yasumasa,

On 17/06/2021 11:28 am, Yasumasa Suenaga wrote:
Hi,

I can build current HEAD of upstream (02c9bf087e5) successfully both fastdebug 
and release build.
I use VS 2019 (16.10.1) on WSL 1 Ubuntu 20.04 .

We use 16.9.3 with no problem, but it does seem that the prototype is missing 
the static storage class modifier to match the definition (otherwise it is 
assumed externa).

I'm not sure, but I guess the problem may be gone if we remove build/ directory 
before running configure.
(Vitaly seems to run `make clean` instead of `rm -fR build`)

I've encountered some issue when HotSpot source was changed, then I could solve 
the most of problem when I do it.


Thanks,

Yasumasa


I filed:

https://bugs.openjdk.java.net/browse/JDK-8268927

and am testing a trivial fix to add 'static' which will hopefully fix Vitaly's 
problem.

Thanks,
David


Thanks,

Yasumasa


On 2021/06/17 10:04, David Holmes wrote:
Hi Vitaly,

On 17/06/2021 9:47 am, Vitaly Provodin wrote:
Hi all,

Building OpenJDK on Windows I am faced with the following error

---------------------------8<---------------------------
os_windows.obj : error LNK2019: unresolved external symbol "int __cdecl 
convert_to_unicode(char const *,wchar_t * *)" (?convert_to_unicode@@YAHPEBDPEAPEA_W@Z) 
referenced in function "public: static void __cdecl os::set_native_thread_name(char const 
*)" (?set_native_thread_name@os@@SAXPEBD@Z)

That is strange. convert_to_unicode is a static function in os_windows.cpp so 
there is no reason for the linker to have any issue as far as I can see - and 
we have not seen any build issues locally. ???

I wonder if the forward declaration / prototype also needs to state static? can 
you try this change:

diff --git a/src/hotspot/os/windows/os_windows.cpp 
b/src/hotspot/os/windows/os_windows.cpp
index 6e996b11993..affe8a10265 100644
--- a/src/hotspot/os/windows/os_windows.cpp
+++ b/src/hotspot/os/windows/os_windows.cpp
@@ -892,7 +892,7 @@ static SetThreadDescriptionFnPtr _SetThreadDescription = 
NULL;
  DEBUG_ONLY(static GetThreadDescriptionFnPtr _GetThreadDescription = NULL;)

  // forward decl.
-errno_t convert_to_unicode(char const* char_path, LPWSTR* unicode_path);
+static errno_t convert_to_unicode(char const* char_path, LPWSTR* unicode_path);

  void os::set_native_thread_name(const char *name) {

Otherwise the simple fix would be to move the definition of convert_to_unicode 
to be ahead of set_native_thread_name() and get rid of the prototype.

But again I have no idea why we would not have seen this build problem locally. 
I will file a bug.

Thanks,
David
-----

c:\buildagent\work\d0555747f6bd5c6\build\windows-x86_64-server-release\support\modules_libs\java.base\server\jvm.dll
 : fatal error LNK1120: 1 unresolved externals
make[3]: *** [lib/CompileJvm.gmk:144: 
/cygdrive/c/buildagent/work/d0555747f6bd5c6/build/windows-x86_64-server-release/support/modules_libs/java.base/server/jvm.dll]
 Error 1
make[2]: *** [make/Main.gmk:252: hotspot-server-libs] Error 2
make[2]: *** Waiting for unfinished jobs....
ERROR: Build failed for targets 'clean images test-image' in configuration 
'windows-x86_64-server-release' (exit code 2)
---------------------------8<---------------------------

The issue was integrated with the patch 
https://github.com/openjdk/jdk/commit/9f3c7e74ff00a7550742ed8b9d6671c2d4bb6041 
that fixes https://bugs.openjdk.java.net/browse/JDK-8238649 Call new Win32 API 
SetThreadDescription in os::set_native_thread_name
After reverting this commit the build completes successfully

Note Visual Studio 2019 Developer Command Prompt v16.8.5 is used for building

Is this issue actual for me only? - could not find any mentions about it (in 
maillists, JBS)
Could you please advice how it can be resolved?

Thanks in advance,
Vitaly

Reply via email to