From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: moyoumiu@outlook.com
Subject: BUG #17967: [msvc-x86] Failed to build with error LNK2019: unresolved external symbol __BitScanReverse64 referen
Date: Wed, 07 Jun 2023 09:57:49 +0000
Message-ID: <17967-cd21e34a314141b2@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17967
Logged by: Youmiu Mo
Email address: moyoumiu@outlook.com
PostgreSQL version: 15.3
Operating system: Windows
Description:
The file `src/bin/pg_verifybackup/pg_verifybackup.c` fails to compile using
msvc under x86, there is no `_BitScanForward64` and `_BitScanReverse64`
under **x86** for head `src/include/port/pg_bitutils.h`.
### output
```log
F:\repo\postgresql\src\include\port\pg_bitutils.h(88,13): warning C4013:
'_BitScanReverse64' undefined; assuming extern returning int (compiling
source file src/bin/pg_verifybackup/pg_verifybackup.c)
[F:\repo\postgresql\pg_verifybackup.vcxproj]
pg_verifybackup.obj : error LNK2019: unresolved external symbol
__BitScanReverse64 referenced in function _manifest_files_compute_parameters
[F:\repo\postgresql\pg_verifybackup.vcxproj]
```
### related lines
https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/port/pg_bitutils.h;hb=83a61...https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/port/pg_bitutils.h;hb=83a61...
### references
https://learn.microsoft.com/en-us/cpp/intrinsics/bitscanforward-bitscanforward64?view=msvc-170#requi...https://learn.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64?view=msvc-170#requi...
### steps to reproduce
```cmd
"C:\Program Files\Microsoft Visual
Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=x86
-arch=x86
cd F:\repo\postgresql\src\tools\msvc
set PATH=F:\repo\tools;F:\tools\gnuwin32\bin;%PATH%
build RELEASE
cd F:\repo\postgresql
msbuild /m /p:Platform=Win32 /p:Configuration=Release
/p:PlatformToolset=v143 /p:WindowsTargetPlatformVersion=10.0.22621.0
pgsql.sln /verbosity:normal /t:Rebuild 2>&1
```
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, moyoumiu@outlook.com
Subject: Re: BUG #17967: [msvc-x86] Failed to build with error LNK2019: unresolved external symbol __BitScanReverse64 referen
In-Reply-To: <17967-cd21e34a314141b2@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox