BUG #17967: [msvc-x86] Failed to build with error LNK2019: unresolved external symbol __BitScanReverse64 referen

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #17967: [msvc-x86] Failed to build with error LNK2019: unresolved external symbol __BitScanReverse64 referen
Дата
Msg-id 17967-cd21e34a314141b2@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #17967: [msvc-x86] Failed to build with error LNK2019: unresolved external symbol __BitScanReverse64 referen  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-bugs
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=83a611a259d41e305364b8de58f6b33a63cbda66#l88
 

https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/port/pg_bitutils.h;hb=83a611a259d41e305364b8de58f6b33a63cbda66#l159
 

### references
https://learn.microsoft.com/en-us/cpp/intrinsics/bitscanforward-bitscanforward64?view=msvc-170#requirements
 
https://learn.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64?view=msvc-170#requirements
 

### 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
```


В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17965: SIGSEGV from LLVM13 JIT when executing SQL.
Следующее
От: Mathias Kunter
Дата:
Сообщение: Re: BUG #17964: Missed query planner optimization