doc: update parameters to use for mlx5 on Windows
PATCH 1/1 doc: update parameters to use for mlx5 on Windows
The linker parameters to use with MSVC and Clang differ. Showing explicitly what to use with each in the documentation.
--- doc/guides/platform/mlx5.rst | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
doc/guides/platform/mlx5.rst +16 -4
@@ -268,14 +268,26 @@ configured by the ``ibverbs_link`` build option: Compilation on Windows ~~~~~~~~~~~~~~~~~~~~~~ -The DevX SDK location must be set through CFLAGS/LDFLAGS, -either:: +The DevX SDK location must be set through CFLAGS/LDFLAGS. +When compiling with MSVC, use either:: - meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" "-Dc_link_args=-L\"%DEVX_LIB_PATH%\"" ... + meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" + "-Dc_link_args=-LIBPATH:\"%DEVX_LIB_PATH%\"" -Denable_stdatomic=true ... or:: - set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-L"%DEVX_LIB_PATH%" && meson.exe setup ... + set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-LIBPATH:"%DEVX_LIB_PATH%" && + meson.exe setup -Denable_stdatomic=true ... + +When compiling with Clang, use either:: + + meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" + "-Dc_link_args=-Wl,-LIBPATH:\"%DEVX_LIB_PATH%\"" ... + +or:: + + set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-Wl,-LIBPATH:"%DEVX_LIB_PATH%" && + meson.exe setup ... .. _mlx5_common_env:
Signature · 1 line
2.49.0.vfs.0.0
Hi,
Quoted 14 lines · Andre Muezerie
The linker parameters to use with MSVC and Clang differ. Showing explicitly what to use with each in the documentation.
Signed-off-by Andre Muezerie <[email protected]>--- doc/guides/platform/mlx5.rst | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)doc/guides/platform/mlx5.rst +0
-0@@ -268,14 +268,26 @@ configured by the ``ibverbs_link`` build option: Compilation on Windows
doc/guides/platform/mlx5.rst configured by the ``ibverbs_link`` build option: · line 275
Quoted 10 lines
doc/guides/platform/mlx5.rst +4
-3~~~~~~~~~~~~~~~~~~~~~~ -The DevX SDK location must be set through CFLAGS/LDFLAGS, -either:: +The DevX SDK location must be set through CFLAGS/LDFLAGS. +When compiling with MSVC, use either:: - meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" "-Dc_link_args=-L\"%DEVX_LIB_PATH%\"" ... + meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" + "-Dc_link_args=-LIBPATH:\"%DEVX_LIB_PATH%\"" -Denable_stdatomic=true ...
This long command line can be split for readability, using caret as line break:
meson.exe setup ^ "-Dc_args=-I\"%DEVX_INC_PATH%\"" ^ "-Dc_link_args=-LIBPATH:\"%DEVX_LIB_PATH%\"" ^ -Denable_stdatomic=true ^ ...
The same applies to commands for clang.
doc/guides/platform/mlx5.rst configured by the ``ibverbs_link`` build option: · line 280
Quoted 6 lines
doc/guides/platform/mlx5.rst +2
-1or:: - set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-L"%DEVX_LIB_PATH%" && meson.exe setup ... + set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-LIBPATH:"%DEVX_LIB_PATH%" && + meson.exe setup -Denable_stdatomic=true ...
&& are not really needed here and
it can be splitted into multiple lines for readability:
set CFLAGS=-I"%DEVX_INC_PATH%" set LDFLAGS=-LIBPATH:"%DEVX_LIB_PATH%" meson.exe setup -Denable_stdatomic=true ...
The same applies to commands for clang.
doc/guides/platform/mlx5.rst configured by the ``ibverbs_link`` build option: · line 285
Quoted 5 lines
doc/guides/platform/mlx5.rst +5
-0+ +When compiling with Clang, use either:: + + meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" + "-Dc_link_args=-Wl,-LIBPATH:\"%DEVX_LIB_PATH%\"" ...
Shouldn't clang linker parameters stay as it was previously i.e., "-L..."?
doc/guides/platform/mlx5.rst configured by the ``ibverbs_link`` build option: · line 293
Quoted 8 lines
doc/guides/platform/mlx5.rst +5
-0+ +or:: + + set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-Wl,-LIBPATH:"%DEVX_LIB_PATH%" && + meson.exe setup ... .. _mlx5_common_env:
Best regards,
Dariusz Sosnowski
Quoted 53 lines · Dariusz Sosnowski
Hi,
Quoted 14 lines · Andre Muezerie
The linker parameters to use with MSVC and Clang differ. Showing explicitly what to use with each in the documentation.
Signed-off-by Andre Muezerie <[email protected]>--- doc/guides/platform/mlx5.rst | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)doc/guides/platform/mlx5.rst +0
-0@@ -268,14 +268,26 @@ configured by the ``ibverbs_link`` build option: Compilation on Windowsdoc/guides/platform/mlx5.rst configured by the ``ibverbs_link`` build option: · line 275
Quoted 10 lines
doc/guides/platform/mlx5.rst +4
-3~~~~~~~~~~~~~~~~~~~~~~ -The DevX SDK location must be set through CFLAGS/LDFLAGS, -either:: +The DevX SDK location must be set through CFLAGS/LDFLAGS. +When compiling with MSVC, use either:: - meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" "-Dc_link_args=-L\"%DEVX_LIB_PATH%\"" ... + meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" + "-Dc_link_args=-LIBPATH:\"%DEVX_LIB_PATH%\"" -Denable_stdatomic=true ...This long command line can be split for readability, using caret as line break:
meson.exe setup ^ "-Dc_args=-I\"%DEVX_INC_PATH%\"" ^ "-Dc_link_args=-LIBPATH:\"%DEVX_LIB_PATH%\"" ^ -Denable_stdatomic=true ^ ...The same applies to commands for clang.
doc/guides/platform/mlx5.rst configured by the ``ibverbs_link`` build option: · line 280
Quoted 6 lines
doc/guides/platform/mlx5.rst +2
-1or:: - set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-L"%DEVX_LIB_PATH%" && meson.exe setup ... + set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-LIBPATH:"%DEVX_LIB_PATH%" && + meson.exe setup -Denable_stdatomic=true ...&& are not really needed here and
it can be splitted into multiple lines for readability:set CFLAGS=-I"%DEVX_INC_PATH%" set LDFLAGS=-LIBPATH:"%DEVX_LIB_PATH%" meson.exe setup -Denable_stdatomic=true ...
Quoted 8 lines
The same applies to commands for clang.
doc/guides/platform/mlx5.rst configured by the ``ibverbs_link`` build option: · line 285
Quoted 5 lines
doc/guides/platform/mlx5.rst +5
-0+ +When compiling with Clang, use either:: + + meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" + "-Dc_link_args=-Wl,-LIBPATH:\"%DEVX_LIB_PATH%\"" ...
Thanks, that indeed makes the commands easier to read.
Quoted 1 line
Shouldn't clang linker parameters stay as it was previously i.e., "-L..."?
Not on Windows. It can be confirmed by looking at build\meson-logs\meson-log.txt, where it can be seen that the -L option ends up being ignored:
Sanity check compiler command line: clang sanitycheckc.c -o sanitycheckc.exe -IV:\soft\MLNX_WinOF2_DevX_SDK\inc -D_FILE_OFFSET_BITS=64 -Wl,-LV:\soft\MLNX_WinOF2_DevX_SDK\lib Sanity check compile stdout:
LINK : warning LNK4044: unrecognized option '/LV:\soft\MLNX_WinOF2_DevX_SDK\lib'; ignored
As a result the lib mlx5devx is not found:
Has header "mlx5devx.h" : YES
Library mlx5devx found: NO
I'll send out a new version of this patch with the changes suggested.
Best regards,
Andre Muezerie
Quoted 12 lines
doc/guides/platform/mlx5.rst configured by the ``ibverbs_link`` build option: · line 293
Quoted 9 lines
doc/guides/platform/mlx5.rst +5
-0+ +or:: + + set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-Wl,-LIBPATH:"%DEVX_LIB_PATH%" && + meson.exe setup ... .. _mlx5_common_env:Best regards,
Dariusz Sosnowski
PATCH v2 1/1 doc: update parameters to use for mlx5 on Windows
In reply to Andre MuezerieThe linker parameters to use with MSVC and Clang differ. Showing explicitly what to use with each in the documentation.
--- doc/guides/platform/mlx5.rst | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
doc/guides/platform/mlx5.rst +23 -4
@@ -268,14 +268,33 @@ configured by the ``ibverbs_link`` build option: Compilation on Windows ~~~~~~~~~~~~~~~~~~~~~~ -The DevX SDK location must be set through CFLAGS/LDFLAGS, -either:: +The DevX SDK location must be set through CFLAGS/LDFLAGS. +When compiling with MSVC, use either:: - meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" "-Dc_link_args=-L\"%DEVX_LIB_PATH%\"" ... + meson.exe setup ^ + "-Dc_args=-I\"%DEVX_INC_PATH%\"" ^ + "-Dc_link_args=-LIBPATH:\"%DEVX_LIB_PATH%\"" ^ + -Denable_stdatomic=true ^ + ... or:: - set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-L"%DEVX_LIB_PATH%" && meson.exe setup ... + set CFLAGS=-I"%DEVX_INC_PATH%" + set LDFLAGS=-LIBPATH:"%DEVX_LIB_PATH%" + meson.exe setup -Denable_stdatomic=true ... + +When compiling with Clang, use either:: + + meson.exe setup ^ + "-Dc_args=-I\"%DEVX_INC_PATH%\"" ^ + "-Dc_link_args=-Wl,-LIBPATH:\"%DEVX_LIB_PATH%\"" ^ + ... + +or:: + + set CFLAGS=-I"%DEVX_INC_PATH%" + set LDFLAGS=-Wl,-LIBPATH:"%DEVX_LIB_PATH%" + meson.exe setup ... .. _mlx5_common_env:
Signature · 1 line
2.50.1.vfs.0.0
[email protected] <[email protected]>
+Manit Mahajan <[email protected]>
+Andrew Bailey <[email protected]>
Thank you for this we will modify our Clang and MSVC build pipelines at UNH.
Quoted 56 lines · Andre Muezerie
The linker parameters to use with MSVC and Clang differ. Showing explicitly what to use with each in the documentation.
Signed-off-by Andre Muezerie <[email protected]>--- doc/guides/platform/mlx5.rst | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)doc/guides/platform/mlx5.rst +2
-3@@ -268,14 +268,33 @@ configured by the ``ibverbs_link`` build option: Compilation on Windows ~~~~~~~~~~~~~~~~~~~~~~ -The DevX SDK location must be set through CFLAGS/LDFLAGS, -either:: +The DevX SDK location must be set through CFLAGS/LDFLAGS. +When compiling with MSVC, use either:: - meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"""-Dc_link_args=-L\"%DEVX_LIB_PATH%\"" ...
doc/guides/platform/mlx5.rst +5
-1+ meson.exe setup ^ + "-Dc_args=-I\"%DEVX_INC_PATH%\"" ^ + "-Dc_link_args=-LIBPATH:\"%DEVX_LIB_PATH%\"" ^ + -Denable_stdatomic=true ^ + ... or:: - set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-L"%DEVX_LIB_PATH%" &&meson.exe setup ...
doc/guides/platform/mlx5.rst +16
-1+ set CFLAGS=-I"%DEVX_INC_PATH%" + set LDFLAGS=-LIBPATH:"%DEVX_LIB_PATH%" + meson.exe setup -Denable_stdatomic=true ... + +When compiling with Clang, use either:: + + meson.exe setup ^ + "-Dc_args=-I\"%DEVX_INC_PATH%\"" ^ + "-Dc_link_args=-Wl,-LIBPATH:\"%DEVX_LIB_PATH%\"" ^ + ... + +or:: + + set CFLAGS=-I"%DEVX_INC_PATH%" + set LDFLAGS=-Wl,-LIBPATH:"%DEVX_LIB_PATH%" + meson.exe setup ... .. _mlx5_common_env: --2.50.1.vfs.0.0
Quoted 1 line · Andre Muezerie
On Tue, Jul 15, 2025 at 02:03:45PM +0200, Dariusz Sosnowski wrote:
*snip*
Quoted 5 lines
Quoted 1 line
Shouldn't clang linker parameters stay as it was previously i.e., "-L..."?
Not on Windows. It can be confirmed by looking at build\meson-logs\meson-log.txt, where it can be seen that the -L option ends up being ignored:
Quoted 8 lines
Sanity check compiler command line: clang
sanitycheckc.c-o sanitycheckc.exe -IV:\soft\MLNX_WinOF2_DevX_SDK\inc -D_FILE_OFFSET_BITS=64 -Wl,-LV:\soft\MLNX_WinOF2_DevX_SDK\lib Sanity check compile stdout:
LINK : warning LNK4044: unrecognized option '/LV:\soft\MLNX_WinOF2_DevX_SDK\lib'; ignoredAs a result the lib mlx5devx is not found:
Has header "
mlx5devx.h" : YES
Library mlx5devx found: NO
In our local Windows builds with clang providing LDFLAGS="-L..." works and mlx5devx library is reported as found.
However, only Visual Studio Build Tools are installed,
not full Visual Studio package.
It seems that either meson or clang chooses lld, instead of MS linker. I'll verify what happens there and let you know.
*snip*
Quoted 21 lines · Andre Muezerie
The linker parameters to use with MSVC and Clang differ. Showing explicitly what to use with each in the documentation.
Signed-off-by Andre Muezerie <[email protected]>--- doc/guides/platform/mlx5.rst | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)doc/guides/platform/mlx5.rst +2
-2@@ -268,14 +268,33 @@ configured by the ``ibverbs_link`` build option: Compilation on Windows ~~~~~~~~~~~~~~~~~~~~~~ -The DevX SDK location must be set through CFLAGS/LDFLAGS, -either:: +The DevX SDK location must be set through CFLAGS/LDFLAGS. +When compiling with MSVC, use either::
doc/guides/platform/mlx5.rst configured by the ``ibverbs_link`` build option: · line 278
Quoted 10 lines
doc/guides/platform/mlx5.rst +5
-2- meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" "-Dc_link_args=-L\"%DEVX_LIB_PATH%\"" ... + meson.exe setup ^ + "-Dc_args=-I\"%DEVX_INC_PATH%\"" ^ + "-Dc_link_args=-LIBPATH:\"%DEVX_LIB_PATH%\"" ^ + -Denable_stdatomic=true ^ + ... or:: - set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-L"%DEVX_LIB_PATH%" && meson.exe setup ...
I checked the old version of setting LDFLAGS to "-L..." and:
- as you mentioned on previous patch, does not work (-LIBPATH is required) - this is with meson 1.5.2
- but works with meson 0.57.2 (used in our local builds)
In both cases, MS linker is detected.
Older meson fixes up the flags before passing them linker. I'm not sure which meson version changed that behavior.
Regardless of that, "-LIBPATH:..." works on both versions I checked and seems the truly correct way. Let's add this in the docs.
Quoted 22 lines
doc/guides/platform/mlx5.rst +16
-0+ set CFLAGS=-I"%DEVX_INC_PATH%" + set LDFLAGS=-LIBPATH:"%DEVX_LIB_PATH%" + meson.exe setup -Denable_stdatomic=true ... + +When compiling with Clang, use either:: + + meson.exe setup ^ + "-Dc_args=-I\"%DEVX_INC_PATH%\"" ^ + "-Dc_link_args=-Wl,-LIBPATH:\"%DEVX_LIB_PATH%\"" ^ + ... + +or:: + + set CFLAGS=-I"%DEVX_INC_PATH%" + set LDFLAGS=-Wl,-LIBPATH:"%DEVX_LIB_PATH%" + meson.exe setup ... .. _mlx5_common_env:Signature · 1 line
2.50.1.vfs.0.0
15/07/2025 16:14, Andre Muezerie:
Quoted 4 lines
The linker parameters to use with MSVC and Clang differ. Showing explicitly what to use with each in the documentation.
Signed-off-by Andre Muezerie <[email protected]>
Applied, thanks.