Skip to contentSkip to conversation

devtools: fix build test config inheritance from env

PATCH Superseded Thomas Monjalon 5 participants 15 messages Nov 9, 2020 – Nov 12, 2020 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: fix build test config inheritance from env

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

DPDK_MESON_OPTIONS might take a global initial value from environment to customize a build test from the shell. Example:
DPDK_MESON_OPTIONS="b_lto=true"
Some target-specific options can be added in the configuration file:
DPDK_MESON_OPTIONS="$DPDK_MESON_OPTIONS kernel_dir=$MYKERNEL"

Fixes 272236741258 ("devtools: load target-specific compilation environment")
---
 devtools/test-meson-builds.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
devtools/test-meson-builds.sh +3 -3
index 0c95d1cc98..6d265f6ab3 100755
@@ -38,10 +38,10 @@ else
 fi
 
 default_path=$PATH
-default_pkgpath=$PKG_CONFIG_PATH
 default_cppflags=$CPPFLAGS
 default_cflags=$CFLAGS
 default_ldflags=$LDFLAGS
+default_meson_options=$DPDK_MESON_OPTIONS
 
 check_cc_flags () # <flag to check> <flag2> ...
 {
@@ -53,11 +53,11 @@ load_env () # <target compiler>
 {
 	targetcc=$1
 	export PATH=$default_path
-	export PKG_CONFIG_PATH=$default_pkgpath
+	export PKG_CONFIG_PATH= # global default makes no sense
 	export CPPFLAGS=$default_cppflags
 	export CFLAGS=$default_cflags
 	export LDFLAGS=$default_ldflags
-	unset DPDK_MESON_OPTIONS
+	export DPDK_MESON_OPTIONS=$default_meson_options
 	if [ -n "$target_override" ] ; then
 		DPDK_TARGET=$target_override
 	elif command -v $targetcc >/dev/null 2>&1 ; then
Signature · 1 line
2.28.0
#1 lore raw
Quoted 11 lines · Thomas Monjalon

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

DPDK_MESON_OPTIONS might take a global initial value from environment to customize a build test from the shell. Example:
DPDK_MESON_OPTIONS="b_lto=true"
Some target-specific options can be added in the configuration file:
DPDK_MESON_OPTIONS="$DPDK_MESON_OPTIONS kernel_dir=$MYKERNEL"

Quoted 5 lines
Fixes 272236741258 ("devtools: load target-specific compilation environment")

---

Patch looks fine, but I think the log (and comments in the code too, perhaps) should make it clear that the PKG_CONFIG_PATH can be set in the local config file, to make it available to the script.

/Bruce

#2 lore raw

10/11/2020 11:14, Bruce Richardson:

Quoted 15 lines · Thomas Monjalon
Quoted 14 lines

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

DPDK_MESON_OPTIONS might take a global initial value from environment to customize a build test from the shell. Example:
DPDK_MESON_OPTIONS="b_lto=true"
Some target-specific options can be added in the configuration file:
DPDK_MESON_OPTIONS="$DPDK_MESON_OPTIONS kernel_dir=$MYKERNEL"

Fixes 272236741258 ("devtools: load target-specific compilation environment")
Quoted 6 lines
Quoted 2 lines

---

Patch looks fine, but I think the log (and comments in the code too, perhaps) should make it clear that the PKG_CONFIG_PATH can be set in the local config file, to make it available to the script.

OK, I'll look at improving the "doc".
We could also provide a template for the config file.

#3 lore raw
Quoted 19 lines · Thomas Monjalon

10/11/2020 11:14, Bruce Richardson:

Quoted 18 lines · Thomas Monjalon
Quoted 16 lines

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

DPDK_MESON_OPTIONS might take a global initial value from environment to customize a build test from the shell. Example:
DPDK_MESON_OPTIONS="b_lto=true"
Some target-specific options can be added in the configuration file:
DPDK_MESON_OPTIONS="$DPDK_MESON_OPTIONS kernel_dir=$MYKERNEL"

Fixes 272236741258 ("devtools: load target-specific compilation environment")

---

Quoted 7 lines
Quoted 3 lines

Patch looks fine, but I think the log (and comments in the code too, perhaps) should make it clear that the PKG_CONFIG_PATH can be set in the local config file, to make it available to the script.

OK, I'll look at improving the "doc".
We could also provide a template for the config file.

Tested-by
#4 lore raw
Quoted 21 lines · Bruce Richardson
Quoted 19 lines · Thomas Monjalon

10/11/2020 11:14, Bruce Richardson:

Quoted 18 lines · Thomas Monjalon
Quoted 16 lines

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

DPDK_MESON_OPTIONS might take a global initial value from environment to customize a build test from the shell. Example:
DPDK_MESON_OPTIONS="b_lto=true"
Some target-specific options can be added in the configuration file:
DPDK_MESON_OPTIONS="$DPDK_MESON_OPTIONS kernel_dir=$MYKERNEL"

Fixes 272236741258 ("devtools: load target-specific compilation environment")

---

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Patch looks fine, but I think the log (and comments in the code too, perhaps) should make it clear that the PKG_CONFIG_PATH can be set in the local config file, to make it available to the script.

OK, I'll look at improving the "doc".
We could also provide a template for the config file.

Quoted 1 line
#5 lore raw
In reply to Thomas Monjalon
Quoted 40 lines · Thomas Monjalon

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

DPDK_MESON_OPTIONS might take a global initial value from environment to customize a build test from the shell. Example:
DPDK_MESON_OPTIONS="b_lto=true"
Some target-specific options can be added in the configuration file:
DPDK_MESON_OPTIONS="$DPDK_MESON_OPTIONS kernel_dir=$MYKERNEL"

Fixes 272236741258 ("devtools: load target-specific compilation environment")
---
  devtools/test-meson-builds.sh | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
devtools/test-meson-builds.sh +1 -1
index 0c95d1cc98..6d265f6ab3 100755
@@ -38,10 +38,10 @@ else
  fi
 
  default_path=$PATH
-default_pkgpath=$PKG_CONFIG_PATH
  default_cppflags=$CPPFLAGS
  default_cflags=$CFLAGS
  default_ldflags=$LDFLAGS
+default_meson_options=$DPDK_MESON_OPTIONS
 
  check_cc_flags () # <flag to check> <flag2> ...
  {
@@ -53,11 +53,11 @@ load_env () # <target compiler>
  {
  	targetcc=$1
  	export PATH=$default_path

devtools/test-meson-builds.sh load_env () # <target compiler> · line 63

Quoted 10 lines
devtools/test-meson-builds.sh +2 -2
-	export PKG_CONFIG_PATH=$default_pkgpath
+	export PKG_CONFIG_PATH= # global default makes no sense
  	export CPPFLAGS=$default_cppflags
  	export CFLAGS=$default_cflags
  	export LDFLAGS=$default_ldflags
-	unset DPDK_MESON_OPTIONS
+	export DPDK_MESON_OPTIONS=$default_meson_options
  	if [ -n "$target_override" ] ; then
  		DPDK_TARGET=$target_override
  	elif command -v $targetcc >/dev/null 2>&1 ; then

In same run both 64bit and 32bit builds are done,

At least for my environment,
for 64bit, PKG_CONFIG_PATH should be '/usr/local/lib64/pkgconfig/' for 32bit, PKG_CONFIG_PATH should be '/usr/lib/pkgconfig/'

What should I set in the config file to support both?

#6 lore raw

10/11/2020 18:18, Ferruh Yigit:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

[...]

Quoted 1 line

In same run both 64bit and 32bit builds are done,

Multiple targets can be built yes.

Quoted 3 lines

At least for my environment,
for 64bit, PKG_CONFIG_PATH should be '/usr/local/lib64/pkgconfig/' for 32bit, PKG_CONFIG_PATH should be '/usr/lib/pkgconfig/'

Not sure you need to set these values in PKG_CONFIG_PATH. At least /usr/lib/pkgconfig/ is already set in PKG_CONFIG_LIBDIR.

Let me rephrase the man page of pkg-config:
PKG_CONFIG_LIBDIR is the primary paths list
PKG_CONFIG_PATH is the secondary paths list

Quoted 1 line

What should I set in the config file to support both?

The standard paths for your 64-bit machine should be built-in in your pkg-config.
The standard path for 32-bit is already set automatically in devtools/test-meson-builds.sh.
Only additional specific paths should be set in a config file.

What is a config file? It is loaded by devtools/load-devel-config:
- /etc/dpdk/devel.config (system-wide)
- or ~/.config/dpdk/devel.config (user config)
- or .develconfig (project directory config)
Personally I set all my configs in ~/.config/dpdk/devel.config. Note that the same file is used to configure multiple tools.

For each build, some variables are reset the variable DPDK_TARGET is set, and the config file is sourced.
The typical values of DPDK_TARGET are:
- i386-pc-linux-gnu
- x86_64-pc-linux-gnu
- x86_64-w64-mingw32
- aarch64-linux-gnu
- powerpc64le-linux-gcc

TLDR, I assume you just want to set an additional 64-bit path, so the config file should look like:

if [ "$DPDK_TARGET" = x86_64-pc-linux-gnu ] ; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig
fi

#7 lore raw
Quoted 46 lines · Thomas Monjalon

10/11/2020 18:18, Ferruh Yigit:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

[...]

Quoted 1 line

In same run both 64bit and 32bit builds are done,

Multiple targets can be built yes.

Quoted 3 lines

At least for my environment,
for 64bit, PKG_CONFIG_PATH should be '/usr/local/lib64/pkgconfig/' for 32bit, PKG_CONFIG_PATH should be '/usr/lib/pkgconfig/'

Not sure you need to set these values in PKG_CONFIG_PATH. At least /usr/lib/pkgconfig/ is already set in PKG_CONFIG_LIBDIR.

Let me rephrase the man page of pkg-config:
PKG_CONFIG_LIBDIR is the primary paths list
PKG_CONFIG_PATH is the secondary paths list

Quoted 1 line

What should I set in the config file to support both?

The standard paths for your 64-bit machine should be built-in in your pkg-config.
The standard path for 32-bit is already set automatically in devtools/test-meson-builds.sh.
Only additional specific paths should be set in a config file.

What is a config file? It is loaded by devtools/load-devel-config:
- /etc/dpdk/devel.config (system-wide)
- or ~/.config/dpdk/devel.config (user config)
- or .develconfig (project directory config)
Personally I set all my configs in ~/.config/dpdk/devel.config. Note that the same file is used to configure multiple tools.

For each build, some variables are reset the variable DPDK_TARGET is set, and the config file is sourced.
The typical values of DPDK_TARGET are:
- i386-pc-linux-gnu
- x86_64-pc-linux-gnu
- x86_64-w64-mingw32
- aarch64-linux-gnu
- powerpc64le-linux-gcc

Quoted 8 lines

TLDR, I assume you just want to set an additional 64-bit path, so the config file should look like:

if [ "$DPDK_TARGET" = x86_64-pc-linux-gnu ] ; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig
fi

Thanks for the clarification.

Standard paths seems should be covered already in current script, which I was trying to do with "export PKG_CONFIG_PATH=$CUSTOM_PKG_CONFIG_PATH" line in my patch,

I may be mixed 'PKG_CONFIG_LIBDIR' vs 'PKG_CONFIG_PATH' usage, let me check it in my environment.

#8 lore raw
Quoted 56 lines · Ferruh Yigit
Quoted 46 lines · Thomas Monjalon

10/11/2020 18:18, Ferruh Yigit:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

[...]

Quoted 1 line

In same run both 64bit and 32bit builds are done,

Multiple targets can be built yes.

Quoted 3 lines

At least for my environment,
for 64bit, PKG_CONFIG_PATH should be '/usr/local/lib64/pkgconfig/' for 32bit, PKG_CONFIG_PATH should be '/usr/lib/pkgconfig/'

Not sure you need to set these values in PKG_CONFIG_PATH. At least /usr/lib/pkgconfig/ is already set in PKG_CONFIG_LIBDIR.

Let me rephrase the man page of pkg-config:
PKG_CONFIG_LIBDIR is the primary paths list
PKG_CONFIG_PATH is the secondary paths list

Quoted 1 line

What should I set in the config file to support both?

The standard paths for your 64-bit machine should be built-in in your pkg-config.
The standard path for 32-bit is already set automatically in devtools/test-meson-builds.sh.
Only additional specific paths should be set in a config file.

What is a config file? It is loaded by devtools/load-devel-config:
- /etc/dpdk/devel.config (system-wide)
- or ~/.config/dpdk/devel.config (user config)
- or .develconfig (project directory config)
Personally I set all my configs in ~/.config/dpdk/devel.config. Note that the same file is used to configure multiple tools.

For each build, some variables are reset the variable DPDK_TARGET is set, and the config file is sourced.
The typical values of DPDK_TARGET are:
- i386-pc-linux-gnu
- x86_64-pc-linux-gnu
- x86_64-w64-mingw32
- aarch64-linux-gnu
- powerpc64le-linux-gcc

Quoted 8 lines

TLDR, I assume you just want to set an additional 64-bit path, so the config file should look like:

if [ "$DPDK_TARGET" = x86_64-pc-linux-gnu ] ; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig
fi

Quoted 9 lines

Thanks for the clarification.

Standard paths seems should be covered already in current script, which I was trying to do with "export PKG_CONFIG_PATH=$CUSTOM_PKG_CONFIG_PATH" line in my patch,

I may be mixed 'PKG_CONFIG_LIBDIR' vs 'PKG_CONFIG_PATH' usage, let me check it in my environment.

For just adding a new custom path for pkg-config using PKG_CONFIG_PATH. For building anything other than a native 64-bit build you need to override PKG_CONFIG_LIBDIR and clear PKG_CONFIG_PATH, otherwise the 64-bit packages will be found from the standard paths if not found in a 32-bit one.

/Bruce

#9 lore raw

11/11/2020 10:18, Bruce Richardson:

Quoted 63 lines · Ferruh Yigit
Quoted 62 lines · Thomas Monjalon
Quoted 46 lines

10/11/2020 18:18, Ferruh Yigit:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

[...]

Quoted 1 line

In same run both 64bit and 32bit builds are done,

Multiple targets can be built yes.

Quoted 3 lines

At least for my environment,
for 64bit, PKG_CONFIG_PATH should be '/usr/local/lib64/pkgconfig/' for 32bit, PKG_CONFIG_PATH should be '/usr/lib/pkgconfig/'

Not sure you need to set these values in PKG_CONFIG_PATH. At least /usr/lib/pkgconfig/ is already set in PKG_CONFIG_LIBDIR.

Let me rephrase the man page of pkg-config:
PKG_CONFIG_LIBDIR is the primary paths list
PKG_CONFIG_PATH is the secondary paths list

Quoted 1 line

What should I set in the config file to support both?

The standard paths for your 64-bit machine should be built-in in your pkg-config.
The standard path for 32-bit is already set automatically in devtools/test-meson-builds.sh.
Only additional specific paths should be set in a config file.

What is a config file? It is loaded by devtools/load-devel-config:
- /etc/dpdk/devel.config (system-wide)
- or ~/.config/dpdk/devel.config (user config)
- or .develconfig (project directory config)
Personally I set all my configs in ~/.config/dpdk/devel.config. Note that the same file is used to configure multiple tools.

For each build, some variables are reset the variable DPDK_TARGET is set, and the config file is sourced.
The typical values of DPDK_TARGET are:
- i386-pc-linux-gnu
- x86_64-pc-linux-gnu
- x86_64-w64-mingw32
- aarch64-linux-gnu
- powerpc64le-linux-gcc

Quoted 8 lines

TLDR, I assume you just want to set an additional 64-bit path, so the config file should look like:

if [ "$DPDK_TARGET" = x86_64-pc-linux-gnu ] ; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig
fi

Thanks for the clarification.

Standard paths seems should be covered already in current script, which I was trying to do with "export PKG_CONFIG_PATH=$CUSTOM_PKG_CONFIG_PATH" line in my patch,

Quoted 8 lines
Quoted 3 lines

I may be mixed 'PKG_CONFIG_LIBDIR' vs 'PKG_CONFIG_PATH' usage, let me check it in my environment.

For just adding a new custom path for pkg-config using PKG_CONFIG_PATH. For building anything other than a native 64-bit build you need to override PKG_CONFIG_LIBDIR and clear PKG_CONFIG_PATH, otherwise the 64-bit packages will be found from the standard paths if not found in a 32-bit one.

Yes, this is what is done in this patch (clearing PKG_CONFIG_PATH). May I assume you are all OK with this patch now?

#10 lore raw
Quoted 68 lines · Thomas Monjalon

11/11/2020 10:18, Bruce Richardson:

Quoted 67 lines · Ferruh Yigit
Quoted 65 lines · Thomas Monjalon
Quoted 46 lines

10/11/2020 18:18, Ferruh Yigit:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

[...]

Quoted 1 line

In same run both 64bit and 32bit builds are done,

Multiple targets can be built yes.

Quoted 3 lines

At least for my environment,
for 64bit, PKG_CONFIG_PATH should be '/usr/local/lib64/pkgconfig/' for 32bit, PKG_CONFIG_PATH should be '/usr/lib/pkgconfig/'

Not sure you need to set these values in PKG_CONFIG_PATH. At least /usr/lib/pkgconfig/ is already set in PKG_CONFIG_LIBDIR.

Let me rephrase the man page of pkg-config:
PKG_CONFIG_LIBDIR is the primary paths list
PKG_CONFIG_PATH is the secondary paths list

Quoted 1 line

What should I set in the config file to support both?

The standard paths for your 64-bit machine should be built-in in your pkg-config.
The standard path for 32-bit is already set automatically in devtools/test-meson-builds.sh.
Only additional specific paths should be set in a config file.

What is a config file? It is loaded by devtools/load-devel-config:
- /etc/dpdk/devel.config (system-wide)
- or ~/.config/dpdk/devel.config (user config)
- or .develconfig (project directory config)
Personally I set all my configs in ~/.config/dpdk/devel.config. Note that the same file is used to configure multiple tools.

For each build, some variables are reset the variable DPDK_TARGET is set, and the config file is sourced.
The typical values of DPDK_TARGET are:
- i386-pc-linux-gnu
- x86_64-pc-linux-gnu
- x86_64-w64-mingw32
- aarch64-linux-gnu
- powerpc64le-linux-gcc

Quoted 8 lines

TLDR, I assume you just want to set an additional 64-bit path, so the config file should look like:

if [ "$DPDK_TARGET" = x86_64-pc-linux-gnu ] ; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig
fi

Thanks for the clarification.

Standard paths seems should be covered already in current script, which I was trying to do with "export PKG_CONFIG_PATH=$CUSTOM_PKG_CONFIG_PATH" line in my patch,

I may be mixed 'PKG_CONFIG_LIBDIR' vs 'PKG_CONFIG_PATH' usage, let me check it in my environment.

Quoted 8 lines
Quoted 4 lines

For just adding a new custom path for pkg-config using PKG_CONFIG_PATH. For building anything other than a native 64-bit build you need to override PKG_CONFIG_LIBDIR and clear PKG_CONFIG_PATH, otherwise the 64-bit packages will be found from the standard paths if not found in a 32-bit one.

Yes, this is what is done in this patch (clearing PKG_CONFIG_PATH). May I assume you are all OK with this patch now?

Yes, I previously acked it, I believe.

Acked-by
#11 lore raw
Quoted 74 lines · Bruce Richardson
Quoted 73 lines · Thomas Monjalon

11/11/2020 10:18, Bruce Richardson:

Quoted 71 lines · Ferruh Yigit
Quoted 56 lines · Thomas Monjalon
Quoted 46 lines

10/11/2020 18:18, Ferruh Yigit:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

[...]

Quoted 1 line

In same run both 64bit and 32bit builds are done,

Multiple targets can be built yes.

Quoted 3 lines

At least for my environment,
for 64bit, PKG_CONFIG_PATH should be '/usr/local/lib64/pkgconfig/' for 32bit, PKG_CONFIG_PATH should be '/usr/lib/pkgconfig/'

Not sure you need to set these values in PKG_CONFIG_PATH. At least /usr/lib/pkgconfig/ is already set in PKG_CONFIG_LIBDIR.

Let me rephrase the man page of pkg-config:
PKG_CONFIG_LIBDIR is the primary paths list
PKG_CONFIG_PATH is the secondary paths list

Quoted 1 line

What should I set in the config file to support both?

The standard paths for your 64-bit machine should be built-in in your pkg-config.
The standard path for 32-bit is already set automatically in devtools/test-meson-builds.sh.
Only additional specific paths should be set in a config file.

What is a config file? It is loaded by devtools/load-devel-config:
- /etc/dpdk/devel.config (system-wide)
- or ~/.config/dpdk/devel.config (user config)
- or .develconfig (project directory config)
Personally I set all my configs in ~/.config/dpdk/devel.config. Note that the same file is used to configure multiple tools.

For each build, some variables are reset the variable DPDK_TARGET is set, and the config file is sourced.
The typical values of DPDK_TARGET are:
- i386-pc-linux-gnu
- x86_64-pc-linux-gnu
- x86_64-w64-mingw32
- aarch64-linux-gnu
- powerpc64le-linux-gcc

Quoted 8 lines

TLDR, I assume you just want to set an additional 64-bit path, so the config file should look like:

if [ "$DPDK_TARGET" = x86_64-pc-linux-gnu ] ; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig
fi

Quoted 9 lines

Thanks for the clarification.

Standard paths seems should be covered already in current script, which I was trying to do with "export PKG_CONFIG_PATH=$CUSTOM_PKG_CONFIG_PATH" line in my patch,

I may be mixed 'PKG_CONFIG_LIBDIR' vs 'PKG_CONFIG_PATH' usage, let me check it in my environment.

For just adding a new custom path for pkg-config using PKG_CONFIG_PATH. For building anything other than a native 64-bit build you need to override PKG_CONFIG_LIBDIR and clear PKG_CONFIG_PATH, otherwise the 64-bit packages will be found from the standard paths if not found in a 32-bit one.

Quoted 5 lines
Quoted 3 lines

Yes, this is what is done in this patch (clearing PKG_CONFIG_PATH). May I assume you are all OK with this patch now?

Yes, I previously acked it, I believe.

'PKG_CONFIG_LIBDIR' seems replaces the pkgconfig defaults, 'PKG_CONFIG_PATH' adds paths to process *before* built-in ones.

With adjustment according above, all looks good to me.

What about unset the variable "uset PKG_CONFIG_PATH", to set it to empty to get rid of the following line from logs:
"Using 'PKG_CONFIG_PATH' from environment with value: ''"

With or without about change,

#12 lore raw

11/11/2020 12:13, Ferruh Yigit:

Quoted 81 lines · Bruce Richardson
Quoted 74 lines · Thomas Monjalon
Quoted 73 lines

11/11/2020 10:18, Bruce Richardson:

Quoted 71 lines · Ferruh Yigit
Quoted 56 lines · Thomas Monjalon
Quoted 46 lines

10/11/2020 18:18, Ferruh Yigit:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

[...]

Quoted 1 line

In same run both 64bit and 32bit builds are done,

Multiple targets can be built yes.

Quoted 3 lines

At least for my environment,
for 64bit, PKG_CONFIG_PATH should be '/usr/local/lib64/pkgconfig/' for 32bit, PKG_CONFIG_PATH should be '/usr/lib/pkgconfig/'

Not sure you need to set these values in PKG_CONFIG_PATH. At least /usr/lib/pkgconfig/ is already set in PKG_CONFIG_LIBDIR.

Let me rephrase the man page of pkg-config:
PKG_CONFIG_LIBDIR is the primary paths list
PKG_CONFIG_PATH is the secondary paths list

Quoted 1 line

What should I set in the config file to support both?

The standard paths for your 64-bit machine should be built-in in your pkg-config.
The standard path for 32-bit is already set automatically in devtools/test-meson-builds.sh.
Only additional specific paths should be set in a config file.

What is a config file? It is loaded by devtools/load-devel-config:
- /etc/dpdk/devel.config (system-wide)
- or ~/.config/dpdk/devel.config (user config)
- or .develconfig (project directory config)
Personally I set all my configs in ~/.config/dpdk/devel.config. Note that the same file is used to configure multiple tools.

For each build, some variables are reset the variable DPDK_TARGET is set, and the config file is sourced.
The typical values of DPDK_TARGET are:
- i386-pc-linux-gnu
- x86_64-pc-linux-gnu
- x86_64-w64-mingw32
- aarch64-linux-gnu
- powerpc64le-linux-gcc

Quoted 8 lines

TLDR, I assume you just want to set an additional 64-bit path, so the config file should look like:

if [ "$DPDK_TARGET" = x86_64-pc-linux-gnu ] ; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig
fi

Quoted 9 lines

Thanks for the clarification.

Standard paths seems should be covered already in current script, which I was trying to do with "export PKG_CONFIG_PATH=$CUSTOM_PKG_CONFIG_PATH" line in my patch,

I may be mixed 'PKG_CONFIG_LIBDIR' vs 'PKG_CONFIG_PATH' usage, let me check it in my environment.

For just adding a new custom path for pkg-config using PKG_CONFIG_PATH. For building anything other than a native 64-bit build you need to override PKG_CONFIG_LIBDIR and clear PKG_CONFIG_PATH, otherwise the 64-bit packages will be found from the standard paths if not found in a 32-bit one.

Quoted 5 lines
Quoted 3 lines

Yes, this is what is done in this patch (clearing PKG_CONFIG_PATH). May I assume you are all OK with this patch now?

Yes, I previously acked it, I believe.

Quoted 8 lines

'PKG_CONFIG_LIBDIR' seems replaces the pkgconfig defaults, 'PKG_CONFIG_PATH' adds paths to process *before* built-in ones.

With adjustment according above, all looks good to me.

What about unset the variable "uset PKG_CONFIG_PATH", to set it to empty to get rid of the following line from logs:
"Using 'PKG_CONFIG_PATH' from environment with value: ''"

Oh yes I didn't notice this message.
The reason why I didn't unset was to allow referencing empty variable with shell option which forbids referencing unset ones: set -u.

Now I think it's better to unset.

Quoted 2 lines

With or without about change,

#13 lore raw

PATCH v2 1/1 devtools: fix build test config inheritance from env

In reply to Thomas Monjalon

The variables DPDK_MESON_OPTIONS, PATH, PKG_CONFIG_PATH, CPPFLAGS, CFLAGS and LDFLAGS can be customized in the config file loaded by devtools/load-devel-config at each build.
The configuration can be adjusted per target thanks to the value set in the DPDK_TARGET variable.

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

DPDK_MESON_OPTIONS might take a global initial value from environment to customize a build test from the shell. Example:
DPDK_MESON_OPTIONS="b_lto=true"
Some target-specific options can be added in the configuration file:
DPDK_MESON_OPTIONS="$DPDK_MESON_OPTIONS kernel_dir=$MYKERNEL"

Fixes 272236741258 ("devtools: load target-specific compilation environment")

---
v2:
- unset PKG_CONFIG_PATH because empty is printed by meson
- add more comments

---
 devtools/test-meson-builds.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
devtools/test-meson-builds.sh +5 -3
index 0c95d1cc98..f32b5784f4 100755
@@ -38,10 +38,10 @@ else
 fi
 
 default_path=$PATH
-default_pkgpath=$PKG_CONFIG_PATH
 default_cppflags=$CPPFLAGS
 default_cflags=$CFLAGS
 default_ldflags=$LDFLAGS
+default_meson_options=$DPDK_MESON_OPTIONS
 
 check_cc_flags () # <flag to check> <flag2> ...
 {
@@ -52,12 +52,14 @@ check_cc_flags () # <flag to check> <flag2> ...
 load_env () # <target compiler>
 {
 	targetcc=$1
+	# reset variables before target-specific config
 	export PATH=$default_path
-	export PKG_CONFIG_PATH=$default_pkgpath
+	unset PKG_CONFIG_PATH # global default makes no sense
 	export CPPFLAGS=$default_cppflags
 	export CFLAGS=$default_cflags
 	export LDFLAGS=$default_ldflags
-	unset DPDK_MESON_OPTIONS
+	export DPDK_MESON_OPTIONS=$default_meson_options
+	# set target hint for use in the loaded config file
 	if [ -n "$target_override" ] ; then
 		DPDK_TARGET=$target_override
 	elif command -v $targetcc >/dev/null 2>&1 ; then
Signature · 1 line
2.28.0
Acked-by on v2 1/1
#14 lore raw
Quoted 18 lines · Thomas Monjalon

The variables DPDK_MESON_OPTIONS, PATH, PKG_CONFIG_PATH, CPPFLAGS, CFLAGS and LDFLAGS can be customized in the config file loaded by devtools/load-devel-config at each build.
The configuration can be adjusted per target thanks to the value set in the DPDK_TARGET variable.

PKG_CONFIG_PATH is specific to each target, so it must be empty before configuring each build from the file according to DPDK_TARGET. Inheriting a default PKG_CONFIG_PATH for all targets does not make sense and is prone to confusion.

DPDK_MESON_OPTIONS might take a global initial value from environment to customize a build test from the shell. Example:
DPDK_MESON_OPTIONS="b_lto=true"
Some target-specific options can be added in the configuration file:
DPDK_MESON_OPTIONS="$DPDK_MESON_OPTIONS kernel_dir=$MYKERNEL"

Quoted 7 lines
Fixes 272236741258 ("devtools: load target-specific compilation environment")
Signature · 1 line
David Marchand