public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] configure: correct tooldir install path
@ 2023-12-15  9:55 Neal Frager
  2023-12-15 10:33 ` Thomas Petazzoni
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Neal Frager @ 2023-12-15  9:55 UTC (permalink / raw)
  To: newlib; +Cc: cjwfirmware, thomas.petazzoni, Neal Frager

This patch is required to fix how the newlib headers are installed
when using a sysroot install directory.

The cross compiler expects headers to be in
.../host/usr/arm-none-eabi/sysroot/usr/include/newlib.h
by default newlib installed the headers into
.../host/usr/arm-none-eabi/sysroot/usr/arm-none-eabi/include/newlib.h

${exec_prefix} provides the .../host/usr/arm-none-eabi/sysroot path
${target_noncanonical} provides an extra arm-none-eabi/ that must be removed.

Signed-off-by: Neal Frager <neal.frager@amd.com>
Co-developed-by: Chris Wardman <cjwfirmware@vxmdesign.com>
---
 configure | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/configure b/configure
index eb0ba840b..29ab40cf6 100755
--- a/configure
+++ b/configure
@@ -821,6 +821,7 @@ enable_linker_plugin_flags
 enable_stage1_languages
 enable_objc_gc
 with_build_sysroot
+with_install_sysroot
 with_debug_prefix_map
 with_build_config
 enable_vtable_verify
@@ -1590,6 +1591,7 @@ Optional Packages:
   --with-isl-lib=PATH     Specify the directory for the installed isl library
   --with-build-sysroot=SYSROOT
                           use sysroot as the system root during the build
+  --with-install-sysroot  use sysroot install directory
   --with-debug-prefix-map='A=B C=D ...'
                           map A to B, C to D ... in debug information
   --with-build-config='NAME NAME2...'
@@ -7057,7 +7059,12 @@ esac
 
 # Some systems (e.g., one of the i386-aix systems the gas testers are
 # using) don't handle "\$" correctly, so don't use it here.
+# Check whether --with-install-sysroot was given.
+if test "${with_install_sysroot+set}" = set; then :
+tooldir='${exec_prefix}'
+else
 tooldir='${exec_prefix}'/${target_noncanonical}
+fi
 build_tooldir=${tooldir}
 
 # Create a .gdbinit file which runs the one in srcdir
-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] configure: correct tooldir install path
  2023-12-15  9:55 [PATCH v1 1/1] configure: correct tooldir install path Neal Frager
@ 2023-12-15 10:33 ` Thomas Petazzoni
  2023-12-15 12:08   ` Frager, Neal
  2024-01-11 10:50 ` [PATCH v3 1/1] configure.ac: configurable " Neal Frager
  2024-01-11 17:07 ` [PATCH v4 " Neal Frager
  2 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2023-12-15 10:33 UTC (permalink / raw)
  To: Neal Frager; +Cc: newlib, cjwfirmware

Hello Neal,

On Fri, 15 Dec 2023 09:55:29 +0000
Neal Frager <neal.frager@amd.com> wrote:

> This patch is required to fix how the newlib headers are installed
> when using a sysroot install directory.
> 
> The cross compiler expects headers to be in
> .../host/usr/arm-none-eabi/sysroot/usr/include/newlib.h
> by default newlib installed the headers into
> .../host/usr/arm-none-eabi/sysroot/usr/arm-none-eabi/include/newlib.h
> 
> ${exec_prefix} provides the .../host/usr/arm-none-eabi/sysroot path
> ${target_noncanonical} provides an extra arm-none-eabi/ that must be removed.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> Co-developed-by: Chris Wardman <cjwfirmware@vxmdesign.com>
> ---
>  configure | 7 +++++++
>  1 file changed, 7 insertions(+)

The configure script is generated from configure.ac, so you should not
patch configure but configure.ac.

> +  --with-install-sysroot  use sysroot install directory
>    --with-debug-prefix-map='A=B C=D ...'
>                            map A to B, C to D ... in debug information
>    --with-build-config='NAME NAME2...'
> @@ -7057,7 +7059,12 @@ esac
>  
>  # Some systems (e.g., one of the i386-aix systems the gas testers are
>  # using) don't handle "\$" correctly, so don't use it here.
> +# Check whether --with-install-sysroot was given.
> +if test "${with_install_sysroot+set}" = set; then :

--with/--without options are usually not used for boolean things,
instead --enable/--disable option are used for boolean things.

However here, I think that what would make sense is a --with-tooldir
option. When not passed, the value is
'${exec_prefix}'/${target_noncanonical}, and when passed, the value is
the one passed in the option:

 ./configure ... --with-tooldir=/blabla

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v1 1/1] configure: correct tooldir install path
  2023-12-15 10:33 ` Thomas Petazzoni
@ 2023-12-15 12:08   ` Frager, Neal
  2023-12-15 17:07     ` Thomas Petazzoni
  2024-01-03 22:43     ` Jeff Johnston
  0 siblings, 2 replies; 10+ messages in thread
From: Frager, Neal @ 2023-12-15 12:08 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: newlib, cjwfirmware

Hi Thomas,

> This patch is required to fix how the newlib headers are installed
> when using a sysroot install directory.
> 
> The cross compiler expects headers to be in
> .../host/usr/arm-none-eabi/sysroot/usr/include/newlib.h
> by default newlib installed the headers into
> .../host/usr/arm-none-eabi/sysroot/usr/arm-none-eabi/include/newlib.h
> 
> ${exec_prefix} provides the .../host/usr/arm-none-eabi/sysroot path
> ${target_noncanonical} provides an extra arm-none-eabi/ that must be removed.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> Co-developed-by: Chris Wardman <cjwfirmware@vxmdesign.com>
> ---
>  configure | 7 +++++++
>  1 file changed, 7 insertions(+)

> The configure script is generated from configure.ac, so you should not
> patch configure but configure.ac.

When building newlib, I am not seeing the configure script get
generated.  If I only patch configure.ac, the configure script stays
the same and my patch appears ignored.

Do you know what I could be missing?

> +  --with-install-sysroot  use sysroot install directory
>    --with-debug-prefix-map='A=B C=D ...'
>                            map A to B, C to D ... in debug information
>    --with-build-config='NAME NAME2...'
> @@ -7057,7 +7059,12 @@ esac
>  
>  # Some systems (e.g., one of the i386-aix systems the gas testers are
>  # using) don't handle "\$" correctly, so don't use it here.
> +# Check whether --with-install-sysroot was given.
> +if test "${with_install_sysroot+set}" = set; then :

> --with/--without options are usually not used for boolean things,
> instead --enable/--disable option are used for boolean things.

> However here, I think that what would make sense is a --with-tooldir
> option. When not passed, the value is
> '${exec_prefix}'/${target_noncanonical}, and when passed, the value is
> the one passed in the option:

> ./configure ... --with-tooldir=/blabla

I made this correction, and the --with-tooldir option only works
if I patch it directly into the configure script.

Could you help me figure out what is missing?

Best regards,
Neal Frager
AMD

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] configure: correct tooldir install path
  2023-12-15 12:08   ` Frager, Neal
@ 2023-12-15 17:07     ` Thomas Petazzoni
  2024-01-03 22:43     ` Jeff Johnston
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2023-12-15 17:07 UTC (permalink / raw)
  To: Frager, Neal; +Cc: newlib, cjwfirmware

On Fri, 15 Dec 2023 12:08:37 +0000
"Frager, Neal" <neal.frager@amd.com> wrote:

> > The configure script is generated from configure.ac, so you should not
> > patch configure but configure.ac.  
> 
> When building newlib, I am not seeing the configure script get
> generated.  If I only patch configure.ac, the configure script stays
> the same and my patch appears ignored.
> 
> Do you know what I could be missing?

Yes, you need to learn/read a bit about the autotools, and autoconf in
particular :-)

> I made this correction, and the --with-tooldir option only works
> if I patch it directly into the configure script.
> 
> Could you help me figure out what is missing?

See above :-)

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] configure: correct tooldir install path
  2023-12-15 12:08   ` Frager, Neal
  2023-12-15 17:07     ` Thomas Petazzoni
@ 2024-01-03 22:43     ` Jeff Johnston
  1 sibling, 0 replies; 10+ messages in thread
From: Jeff Johnston @ 2024-01-03 22:43 UTC (permalink / raw)
  To: Frager, Neal; +Cc: Thomas Petazzoni, newlib, cjwfirmware

[-- Attachment #1: Type: text/plain, Size: 2948 bytes --]

Hi Neal,

It looks like this got missed during the holiday season.

When you patch configure.ac, you need to regenerate configure (not directly
edit it).  You can either run autoconf or autoreconf which will need
autoconf 2.69 installed on your system.  When you submit a patch, you don't
submit the generated files such as configure, but you will need to
regenerate it to test your changes locally.  Thus, your patch should have
the changes needed to configure.ac but not configure   The configure file
will get regenerated for the repo by whoever reviews, approves, and merges
the patch.

-- Jeff J.


On Fri, Dec 15, 2023 at 7:08 AM Frager, Neal <neal.frager@amd.com> wrote:

> Hi Thomas,
>
> > This patch is required to fix how the newlib headers are installed
> > when using a sysroot install directory.
> >
> > The cross compiler expects headers to be in
> > .../host/usr/arm-none-eabi/sysroot/usr/include/newlib.h
> > by default newlib installed the headers into
> > .../host/usr/arm-none-eabi/sysroot/usr/arm-none-eabi/include/newlib.h
> >
> > ${exec_prefix} provides the .../host/usr/arm-none-eabi/sysroot path
> > ${target_noncanonical} provides an extra arm-none-eabi/ that must be
> removed.
> >
> > Signed-off-by: Neal Frager <neal.frager@amd.com>
> > Co-developed-by: Chris Wardman <cjwfirmware@vxmdesign.com>
> > ---
> >  configure | 7 +++++++
> >  1 file changed, 7 insertions(+)
>
> > The configure script is generated from configure.ac, so you should not
> > patch configure but configure.ac.
>
> When building newlib, I am not seeing the configure script get
> generated.  If I only patch configure.ac, the configure script stays
> the same and my patch appears ignored.
>
> Do you know what I could be missing?
>
> > +  --with-install-sysroot  use sysroot install directory
> >    --with-debug-prefix-map='A=B C=D ...'
> >                            map A to B, C to D ... in debug information
> >    --with-build-config='NAME NAME2...'
> > @@ -7057,7 +7059,12 @@ esac
> >
> >  # Some systems (e.g., one of the i386-aix systems the gas testers are
> >  # using) don't handle "\$" correctly, so don't use it here.
> > +# Check whether --with-install-sysroot was given.
> > +if test "${with_install_sysroot+set}" = set; then :
>
> > --with/--without options are usually not used for boolean things,
> > instead --enable/--disable option are used for boolean things.
>
> > However here, I think that what would make sense is a --with-tooldir
> > option. When not passed, the value is
> > '${exec_prefix}'/${target_noncanonical}, and when passed, the value is
> > the one passed in the option:
>
> > ./configure ... --with-tooldir=/blabla
>
> I made this correction, and the --with-tooldir option only works
> if I patch it directly into the configure script.
>
> Could you help me figure out what is missing?
>
> Best regards,
> Neal Frager
> AMD
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3 1/1] configure.ac: configurable tooldir install path
@ 2024-01-11 10:50 ` Neal Frager
  2024-01-11 15:41   ` Mike Frysinger
  0 siblings, 1 reply; 10+ messages in thread
From: Neal Frager @ 2024-01-11 10:50 UTC (permalink / raw)
  To: newlib; +Cc: cjwfirmware, jjohnstn, thomas.petazzoni, Neal Frager

This patch is required to fix how the newlib headers are installed
when using a sysroot install directory.

The cross compiler expects headers to be in
.../host/usr/arm-none-eabi/sysroot/usr/include/newlib.h
by default newlib installed the headers into
.../host/usr/arm-none-eabi/sysroot/usr/arm-none-eabi/include/newlib.h

${exec_prefix} provides the .../host/usr/arm-none-eabi/sysroot path
${target_noncanonical} provides an extra arm-none-eabi/ that must be removed.

With this patch, users can specify the tooldir path that is needed.

Signed-off-by: Neal Frager <neal.frager@amd.com>
Co-developed-by: Chris Wardman <cjwfirmware@vxmdesign.com>
---
V1->V2:
 - migrated patch to configure.ac
 - changed option name to --with-tooldir=PATH
V2->V3;
 - removed quotes around ${with_tooldir}
---
 configure.ac | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index f1bb72100..8ca8cf9fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2599,7 +2599,18 @@ esac
 
 # Some systems (e.g., one of the i386-aix systems the gas testers are
 # using) don't handle "\$" correctly, so don't use it here.
-tooldir='${exec_prefix}'/${target_noncanonical}
+AC_ARG_WITH([tooldir], 
+  [AS_HELP_STRING([--with-tooldir=PATH],
+		[use given path to install target tools after build])],
+  [case x"$withval" in
+	x/*) ;;
+	*)
+	with_tooldir=
+	AC_MSG_WARN([argument to --with-tooldir must be an absolute path])
+	;;
+  esac],
+  [with_tooldir='${exec_prefix}'/${target_noncanonical}])
+tooldir=${with_tooldir}
 build_tooldir=${tooldir}
 
 # Create a .gdbinit file which runs the one in srcdir
-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 1/1] configure.ac: configurable tooldir install path
  2024-01-11 10:50 ` [PATCH v3 1/1] configure.ac: configurable " Neal Frager
@ 2024-01-11 15:41   ` Mike Frysinger
  2024-01-11 16:22     ` Frager, Neal
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2024-01-11 15:41 UTC (permalink / raw)
  To: Neal Frager; +Cc: newlib, cjwfirmware, jjohnstn, thomas.petazzoni

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

On 11 Jan 2024 10:50, Neal Frager wrote:
> +  [case x"$withval" in

use AS_CASE

> +	x/*) ;;
> +	*)
> +	with_tooldir=
> +	AC_MSG_WARN([argument to --with-tooldir must be an absolute path])

shouldn't this be AC_MSG_ERROR ?  otherwise you're leaving it unset below.
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v3 1/1] configure.ac: configurable tooldir install path
  2024-01-11 15:41   ` Mike Frysinger
@ 2024-01-11 16:22     ` Frager, Neal
  0 siblings, 0 replies; 10+ messages in thread
From: Frager, Neal @ 2024-01-11 16:22 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: newlib, cjwfirmware, jjohnstn, thomas.petazzoni

Hi Mike,

Thank you for your feedback.

> +  [case x"$withval" in

> use AS_CASE

Ok.

> +	x/*) ;;
> +	*)
> +	with_tooldir=
> +	AC_MSG_WARN([argument to --with-tooldir must be an absolute path])

> shouldn't this be AC_MSG_ERROR ?  otherwise you're leaving it unset below.
> -mike

Yes, good point.  If the user does not use an absolute
path, this should trigger an error and not just a warning.

I will make these changes in v4.

Best regards,
Neal Frager
AMD

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4 1/1] configure.ac: configurable tooldir install path
@ 2024-01-11 17:07 ` Neal Frager
  2024-01-11 17:25   ` Mike Frysinger
  0 siblings, 1 reply; 10+ messages in thread
From: Neal Frager @ 2024-01-11 17:07 UTC (permalink / raw)
  To: newlib; +Cc: cjwfirmware, jjohnstn, thomas.petazzoni, vapier, Neal Frager

This patch is required to fix how the newlib headers are installed
when using a sysroot install directory.

The cross compiler expects headers to be in
.../host/usr/arm-none-eabi/sysroot/usr/include/newlib.h
by default newlib installed the headers into
.../host/usr/arm-none-eabi/sysroot/usr/arm-none-eabi/include/newlib.h

${exec_prefix} provides the .../host/usr/arm-none-eabi/sysroot path
${target_noncanonical} provides an extra arm-none-eabi/ that must be removed.

With this patch, users can specify the tooldir path that is needed.

Signed-off-by: Neal Frager <neal.frager@amd.com>
Co-developed-by: Chris Wardman <cjwfirmware@vxmdesign.com>
---
V1->V2:
 - migrated patch to configure.ac
 - changed option name to --with-tooldir=PATH
V2->V3:
 - removed quotes around ${with_tooldir}
V3->V4:
 - migrated case to AS_CASE
 - migrated AC_MSG_WARN to AC_MSG_ERROR
---
 configure.ac | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index f1bb72100..ae8a0f5b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2599,7 +2599,16 @@ esac
 
 # Some systems (e.g., one of the i386-aix systems the gas testers are
 # using) don't handle "\$" correctly, so don't use it here.
-tooldir='${exec_prefix}'/${target_noncanonical}
+AC_ARG_WITH([tooldir], 
+  [AS_HELP_STRING([--with-tooldir=PATH],
+		[use given path to install target tools after build])],
+  [AS_CASE([x"$withval"],
+	[x/*],,
+	[with_tooldir=]
+	[AC_MSG_ERROR([argument to --with-tooldir must be an absolute path])])
+  ],
+  [with_tooldir='${exec_prefix}'/${target_noncanonical}])
+tooldir=${with_tooldir}
 build_tooldir=${tooldir}
 
 # Create a .gdbinit file which runs the one in srcdir
-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 1/1] configure.ac: configurable tooldir install path
  2024-01-11 17:07 ` [PATCH v4 " Neal Frager
@ 2024-01-11 17:25   ` Mike Frysinger
  0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2024-01-11 17:25 UTC (permalink / raw)
  To: Neal Frager; +Cc: newlib, cjwfirmware, jjohnstn, thomas.petazzoni

[-- Attachment #1: Type: text/plain, Size: 138 bytes --]

On 11 Jan 2024 17:07, Neal Frager wrote:
> +	[with_tooldir=]

delete this line -- you're erroring out, so there's no need to set it
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-01-11 17:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-15  9:55 [PATCH v1 1/1] configure: correct tooldir install path Neal Frager
2023-12-15 10:33 ` Thomas Petazzoni
2023-12-15 12:08   ` Frager, Neal
2023-12-15 17:07     ` Thomas Petazzoni
2024-01-03 22:43     ` Jeff Johnston
2024-01-11 10:50 ` [PATCH v3 1/1] configure.ac: configurable " Neal Frager
2024-01-11 15:41   ` Mike Frysinger
2024-01-11 16:22     ` Frager, Neal
2024-01-11 17:07 ` [PATCH v4 " Neal Frager
2024-01-11 17:25   ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).