Skip to contentSkip to conversation

Windows: minor build fixes

PATCH New Nick Connolly 6 participants 10 messages Oct 30, 2020 – Nov 13, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Windows: minor build fixes

Don't run symlink-drivers-solibs.sh as part of 'install' because Windows doesn't support shell scripts, causing the install to fail.

Meson versions >= 0.54.0 include support for handling /implib with msvc link. Specifying it explicitly causes failures when linking against the dll. Tested using Link 14.27.29112.0 and Clang 11.0.0.

---
 config/meson.build  | 8 +++++---
 drivers/meson.build | 6 ++++--
 lib/meson.build     | 6 ++++--
 3 files changed, 13 insertions(+), 7 deletions(-)
config/meson.build +5 -3
index 258b01d06..a29693b88 100644
@@ -57,9 +57,11 @@ eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
 # driver .so files often depend upon the bus drivers for their connect bus,
 # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
 # to be in the library path, so symlink the drivers from the main lib directory.
-meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
-		get_option('libdir'),
-		pmd_subdir_opt)
+if not is_windows
+	meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
+			get_option('libdir'),
+			pmd_subdir_opt)
+endif
 
 # set the machine type and cflags for it
 if meson.is_cross_build()
drivers/meson.build +4 -2
index 4bb7e9218..6b50f7238 100644
@@ -186,8 +186,10 @@ foreach subpath:subdirs
 			lk_deps = [version_map, def_file, mingw_map]
 			if is_windows
 				if is_ms_linker
-					lk_args = ['-Wl,/def:' + def_file.full_path(),
-						'-Wl,/implib:drivers\\' + implib]
+					lk_args = ['-Wl,/def:' + def_file.full_path()]
+					if meson.version().version_compare('<0.54.0')
+						lk_args += ['-Wl,/implib:drivers\\' + implib]
+					endif
 				else
 					lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
 				endif
lib/meson.build +4 -2
index 1bb019720..ed00f8914 100644
@@ -157,8 +157,10 @@ foreach l:libraries
 				output: '@0@_mingw.map'.format(libname))
 
 			if is_ms_linker
-				lk_args = ['-Wl,/def:' + def_file.full_path(),
-					'-Wl,/implib:lib\\' + implib]
+				lk_args = ['-Wl,/def:' + def_file.full_path()]
+				if meson.version().version_compare('<0.54.0')
+					lk_args += ['-Wl,/implib:lib\\' + implib]
+				endif
 			else
 				if is_windows
 					lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 windows: minor build fixes

Don't run symlink-drivers-solibs.sh as part of 'install' because Windows doesn't support shell scripts.

Meson versions >= 0.54.0 include support for handling /implib with msvc link. Specifying it explicitly causes failures when linking against the dll. Tested using Link 14.27.29112.0 and Clang 11.0.0.

---
 config/meson.build  | 8 +++++---
 drivers/meson.build | 6 ++++--
 lib/meson.build     | 6 ++++--
 3 files changed, 13 insertions(+), 7 deletions(-)
config/meson.build +5 -3
index 258b01d06..a29693b88 100644
@@ -57,9 +57,11 @@ eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
 # driver .so files often depend upon the bus drivers for their connect bus,
 # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
 # to be in the library path, so symlink the drivers from the main lib directory.
-meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
-		get_option('libdir'),
-		pmd_subdir_opt)
+if not is_windows
+	meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
+			get_option('libdir'),
+			pmd_subdir_opt)
+endif
 
 # set the machine type and cflags for it
 if meson.is_cross_build()
drivers/meson.build +4 -2
index 4bb7e9218..6b50f7238 100644
@@ -186,8 +186,10 @@ foreach subpath:subdirs
 			lk_deps = [version_map, def_file, mingw_map]
 			if is_windows
 				if is_ms_linker
-					lk_args = ['-Wl,/def:' + def_file.full_path(),
-						'-Wl,/implib:drivers\\' + implib]
+					lk_args = ['-Wl,/def:' + def_file.full_path()]
+					if meson.version().version_compare('<0.54.0')
+						lk_args += ['-Wl,/implib:drivers\\' + implib]
+					endif
 				else
 					lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
 				endif
lib/meson.build +4 -2
index 1bb019720..ed00f8914 100644
@@ -157,8 +157,10 @@ foreach l:libraries
 				output: '@0@_mingw.map'.format(libname))
 
 			if is_ms_linker
-				lk_args = ['-Wl,/def:' + def_file.full_path(),
-					'-Wl,/implib:lib\\' + implib]
+				lk_args = ['-Wl,/def:' + def_file.full_path()]
+				if meson.version().version_compare('<0.54.0')
+					lk_args += ['-Wl,/implib:lib\\' + implib]
+				endif
 			else
 				if is_windows
 					lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
Signature · 1 line
2.25.1
#2 lore raw

Re: [dpdk-dev] [PATCH] windows: minor build fixes

Quoted 79 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Nick Connolly
Sent: 30 October 2020 17:46
To: Bruce Richardson <[email protected]>
Cc: [email protected]; Nick Connolly <[email protected]>
Subject: [dpdk-dev] [PATCH] windows: minor build fixes

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Don't run symlink-drivers-solibs.sh as part of 'install' because Windows doesn't support shell scripts.

Meson versions >= 0.54.0 include support for handling /implib with msvc link. Specifying it explicitly causes failures when linking against the dll. Tested using Link 14.27.29112.0 and Clang 11.0.0.

---
 config/meson.build  | 8 +++++---
 drivers/meson.build | 6 ++++--
 lib/meson.build     | 6 ++++--
 3 files changed, 13 insertions(+), 7 deletions(-)
config/meson.build index renamed from config/meson.build +0 -0

258b01d06..a29693b88 100644

config/meson.build +0 -0
@@ -57,9 +57,11 @@ eal_pmd_path = join_paths(get_option('prefix'),

driver_install_path) # driver .so files often depend upon the bus drivers for their connect bus, # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need # to be in the library path, so symlink the drivers from the main lib directory.

config/meson.build +5 -3
-meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
-               get_option('libdir'),
-               pmd_subdir_opt)
+if not is_windows
+       meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
+                       get_option('libdir'),
+                       pmd_subdir_opt)
+endif
 
 # set the machine type and cflags for it  if meson.is_cross_build() diff --git

a/drivers/meson.build b/drivers/meson.build index 4bb7e9218..6b50f7238 100644

drivers/meson.build +4 -2
@@ -186,8 +186,10 @@ foreach subpath:subdirs
                        lk_deps = [version_map, def_file, mingw_map]
                        if is_windows
                                if is_ms_linker
-                                       lk_args = ['-Wl,/def:' + def_file.full_path(),
-                                               '-Wl,/implib:drivers\\' + implib]
+                                       lk_args = ['-Wl,/def:' + def_file.full_path()]
+                                       if meson.version().version_compare('<0.54.0')
+                                               lk_args += ['-Wl,/implib:drivers\\' + implib]
+                                       endif
                                else
                                        lk_args = ['-Wl,--version-script=' +

mingw_map.full_path()]
endif

lib/meson.build index 1bb019720..ed00f8914 renamed from lib/meson.build +0 -0

100644

lib/meson.build +4 -2
@@ -157,8 +157,10 @@ foreach l:libraries
                                output: '@0@_mingw.map'.format(libname))
 
                        if is_ms_linker
-                               lk_args = ['-Wl,/def:' + def_file.full_path(),
-                                       '-Wl,/implib:lib\\' + implib]
+                               lk_args = ['-Wl,/def:' + def_file.full_path()]
+                               if meson.version().version_compare('<0.54.0')
+                                       lk_args += ['-Wl,/implib:lib\\' + implib]
+                               endif
                        else
                                if is_windows
                                        lk_args = ['-Wl,--version-script=' +
Quoted 3 lines

mingw_map.full_path()]
--
2.25.1

Hi,

Do we know what the motivation to rename the import library for the Windows build was in the first place? I've tried removing the renaming of the import library completely in the Windows build and the build produces valid output (a valid DLL and paired import library is generated for each RTE lib using clang build); The meson version test addition may be unnecessary here?

Kind Regards,
John Alexander.

#3 lore raw

Re: [dpdk-dev] [PATCH] windows: minor build fixes

Quoted 5 lines

Do we know what the motivation to rename the import library for the Windows build was in the first place? I've tried removing the renaming of the import library completely in the Windows build and the build produces valid output (a valid DLL and paired import library is generated for each RTE lib using clang build); The meson version test addition may be unnecessary here?

Kind Regards,
John Alexander.

I looked back through the commit history for Meson and there were a number of changes to the way that import libraries are handled between 0.47.1 and 0.54.0.  I installed the meson releases in order, but was unable to build successfully with anything before 0.54.0 - I was seeing complaints about unknown linker flags building with Clang 11.0.0 and Link 14.27.29112.0 from Visual Studio 2019.

Assuming that builds with meson 0.47.1 and Clang/Link do work, I took the conservative approach of only making the change for the version of Meson where I know that /implib is handled correctly, leaving the previous behaviour unchanged for earlier versions which I'm unable to verify.

Regards,
Nick

Tested-by Acked-by on v1 1/1
#4 lore raw

Re: [dpdk-dev] [PATCH] windows: minor build fixes

In reply to Nick Connolly
Quoted 58 lines · Nick Connolly

Don't run symlink-drivers-solibs.sh as part of 'install' because Windows doesn't support shell scripts.

Meson versions >= 0.54.0 include support for handling /implib with msvc link. Specifying it explicitly causes failures when linking against the dll. Tested using Link 14.27.29112.0 and Clang 11.0.0.

---
  config/meson.build  | 8 +++++---
  drivers/meson.build | 6 ++++--
  lib/meson.build     | 6 ++++--
  3 files changed, 13 insertions(+), 7 deletions(-)
config/meson.build +5 -3
index 258b01d06..a29693b88 100644
@@ -57,9 +57,11 @@ eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
  # driver .so files often depend upon the bus drivers for their connect bus,
  # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
  # to be in the library path, so symlink the drivers from the main lib directory.
-meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
-		get_option('libdir'),
-		pmd_subdir_opt)
+if not is_windows
+	meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
+			get_option('libdir'),
+			pmd_subdir_opt)
+endif
 
  # set the machine type and cflags for it
  if meson.is_cross_build()
drivers/meson.build +4 -2
index 4bb7e9218..6b50f7238 100644
@@ -186,8 +186,10 @@ foreach subpath:subdirs
  			lk_deps = [version_map, def_file, mingw_map]
  			if is_windows
  				if is_ms_linker
-					lk_args = ['-Wl,/def:' + def_file.full_path(),
-						'-Wl,/implib:drivers\\' + implib]
+					lk_args = ['-Wl,/def:' + def_file.full_path()]
+					if meson.version().version_compare('<0.54.0')
+						lk_args += ['-Wl,/implib:drivers\\' + implib]
+					endif
  				else
  					lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
  				endif
lib/meson.build +0 -0
index 1bb019720..ed00f8914 100644
@@ -157,8 +157,10 @@ foreach l:libraries
  				output: '@0@_mingw.map'.format(libname))
 

lib/meson.build foreach l:libraries · line 166

Quoted 10 lines
lib/meson.build +4 -2
  			if is_ms_linker
-				lk_args = ['-Wl,/def:' + def_file.full_path(),
-					'-Wl,/implib:lib\\' + implib]
+				lk_args = ['-Wl,/def:' + def_file.full_path()]
+				if meson.version().version_compare('<0.54.0')
+					lk_args += ['-Wl,/implib:lib\\' + implib]
+				endif
  			else
  				if is_windows
  					lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]

Thanks, Nick. This finally fixes this problem I've been having since I upgraded to meson v0.54.

#5 lore raw

Re: [dpdk-dev] [PATCH] windows: minor build fixes

Quoted 65 lines

Subject: Re: [dpdk-dev] [PATCH] windows: minor build fixes

config/meson.build eal_pmd_path = join_paths(get_option('prefix'),

Quoted 19 lines · Nick Connolly

Don't run symlink-drivers-solibs.sh as part of 'install' because Windows doesn't support shell scripts.

Meson versions >= 0.54.0 include support for handling /implib with msvc link. Specifying it explicitly causes failures when linking against the dll. Tested using Link 14.27.29112.0 and Clang 11.0.0.

---
  config/meson.build  | 8 +++++---
  drivers/meson.build | 6 ++++--
  lib/meson.build     | 6 ++++--
  3 files changed, 13 insertions(+), 7 deletions(-)
config/meson.build index renamed from config/meson.build +0 -0

258b01d06..a29693b88 100644

config/meson.build +0 -0
@@ -57,9 +57,11 @@ eal_pmd_path = join_paths(get_option('prefix'),

driver_install_path)

config/meson.build eal_pmd_path = join_paths(get_option('prefix'), · line 58

Quoted 2 lines
config/meson.build +0 -0
  # driver .so files often depend upon the bus drivers for their connect bus,
  # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers

need

config/meson.build eal_pmd_path = join_paths(get_option('prefix'), · line 59

Quoted 1 line
config/meson.build +0 -0
  # to be in the library path, so symlink the drivers from the main lib

directory.

Quoted 17 lines
config/meson.build +5 -3
-meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
-             get_option('libdir'),
-             pmd_subdir_opt)
+if not is_windows
+     meson.add_install_script('../buildtools/symlink-drivers-solibs.sh',
+                     get_option('libdir'),
+                     pmd_subdir_opt)
+endif
 
  # set the machine type and cflags for it
  if meson.is_cross_build()
drivers/meson.build index renamed from drivers/meson.build +0 -0

4bb7e9218..6b50f7238 100644

drivers/meson.build +0 -0
@@ -186,8 +186,10 @@ foreach subpath:subdirs
                      lk_deps = [version_map, def_file, mingw_map]

drivers/meson.build foreach subpath:subdirs · line 194

Quoted 10 lines
drivers/meson.build +4 -2
                      if is_windows
                              if is_ms_linker
-                                     lk_args = ['-Wl,/def:' + def_file.full_path(),
-                                             '-Wl,/implib:drivers\\' + implib]
+                                     lk_args = ['-Wl,/def:' + def_file.full_path()]
+                                     if meson.version().version_compare('<0.54.0')
+                                             lk_args += ['-Wl,/implib:drivers\\' + implib]
+                                     endif
                              else
                                      lk_args = ['-Wl,--version-script=' +

mingw_map.full_path()]

Quoted 8 lines
drivers/meson.build +0 -0
                              endif
lib/meson.build index renamed from lib/meson.build +0 -0

1bb019720..ed00f8914 100644

lib/meson.build +0 -0
@@ -157,8 +157,10 @@ foreach l:libraries
                              output: '@0@_mingw.map'.format(libname))
 
Quoted 14 lines
Quoted 11 lines
lib/meson.build +4 -2
                      if is_ms_linker
-                             lk_args = ['-Wl,/def:' + def_file.full_path(),
-                                     '-Wl,/implib:lib\\' + implib]
+                             lk_args = ['-Wl,/def:' + def_file.full_path()]
+                             if meson.version().version_compare('<0.54.0')
+                                     lk_args += ['-Wl,/implib:lib\\' + implib]
+                             endif
                      else
                              if is_windows
                                      lk_args =

['-Wl,--version-script=' + mingw_map.full_path()]

Thanks, Nick. This finally fixes this problem I've been having since I upgraded to meson v0.54.

Do we know why meson changed its behavior of lib file location in versions > 0.54? Was the old behavior of keeping lib files in the matching output folders incorrect?

BTW, although both are small changes, you should move the symlink-drivers-solibs.sh change to a separated patch.

Quoted 3 lines
#6 lore raw

Re: [dpdk-dev] [PATCH] windows: minor build fixes

Quoted 2 lines · Tal Shnaiderman

Do we know why meson changed its behavior of lib file location in versions > 0.54? Was the old behavior of keeping lib files in the matching output folders incorrect?

I'm not sure why meson was changed, but without the fix subsequent attempts to link with the library fail.

Quoted 2 lines

BTW, although both are small changes, you should move the symlink-drivers-solibs.sh change to a separated patch.

Ok, will do.

Regards,
Nick

#7 lore raw

PATCH v2 1/1 windows: minor build fixes

In reply to Nick Connolly

Meson versions >= 0.54.0 include support for handling /implib with msvc link. Specifying it explicitly causes failures when linking against the dll. Tested using Link 14.27.29112.0 and Clang 11.0.0.

There were a number of changes to the way that import libraries are handled between 0.47.1 and 0.54.0. Only make the change for >= 0.54.0, leaving the behaviour unchanged for earlier versions.

---
v2:
* split out config/meson.build change

 drivers/meson.build | 6 ++++--
 lib/meson.build     | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/meson.build +4 -2
index 4bb7e9218..6b50f7238 100644
@@ -186,8 +186,10 @@ foreach subpath:subdirs
 			lk_deps = [version_map, def_file, mingw_map]
 			if is_windows
 				if is_ms_linker
-					lk_args = ['-Wl,/def:' + def_file.full_path(),
-						'-Wl,/implib:drivers\\' + implib]
+					lk_args = ['-Wl,/def:' + def_file.full_path()]
+					if meson.version().version_compare('<0.54.0')
+						lk_args += ['-Wl,/implib:drivers\\' + implib]
+					endif
 				else
 					lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
 				endif
lib/meson.build +4 -2
index 1bb019720..ed00f8914 100644
@@ -157,8 +157,10 @@ foreach l:libraries
 				output: '@0@_mingw.map'.format(libname))
 
 			if is_ms_linker
-				lk_args = ['-Wl,/def:' + def_file.full_path(),
-					'-Wl,/implib:lib\\' + implib]
+				lk_args = ['-Wl,/def:' + def_file.full_path()]
+				if meson.version().version_compare('<0.54.0')
+					lk_args += ['-Wl,/implib:lib\\' + implib]
+				endif
 			else
 				if is_windows
 					lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
Signature · 1 line
2.25.1
Acked-by on v2 1/1
#8 lore raw

Re: [dpdk-dev] [EXTERNAL] [PATCH v2] windows: minor build fixes

Quoted 18 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Nick Connolly
Sent: Friday, October 30, 2020 11:45 PM
Cc: [email protected]; [email protected]; Nick Connolly <[email protected]>; ranjit.menon <[email protected]>
Subject: [EXTERNAL] [dpdk-dev] [PATCH v2] windows: minor build fixes

Meson versions >= 0.54.0 include support for handling /implib with msvc link. Specifying it explicitly causes failures when linking against the dll. Tested using Link 14.27.29112.0 and Clang 11.0.0.

There were a number of changes to the way that import libraries are handled between 0.47.1 and 0.54.0. Only make the change for >= 0.54.0, leaving the behaviour unchanged for earlier versions.

Quoted 7 lines

---
v2:
* split out config/meson.build change

#9 lore raw

Re: [dpdk-dev] [EXTERNAL] [PATCH v2] windows: minor build fixes

Quoted 10 lines
Quoted 10 lines

Meson versions >= 0.54.0 include support for handling /implib with msvc link. Specifying it explicitly causes failures when linking against the dll. Tested using Link 14.27.29112.0 and Clang 11.0.0.

There were a number of changes to the way that import libraries are handled between 0.47.1 and 0.54.0. Only make the change for >= 0.54.0, leaving the behaviour unchanged for earlier versions.

Quoted 8 lines
Quoted 6 lines

---
v2:
* split out config/meson.build change

Applied, thanks