Discussion:
[PATCH] Makefile.am: remove unsafe headers path
Romain Naour
2014-12-29 21:35:15 UTC
Permalink
/usr/local/include is probably not needed and it's unsafe for
cross-compilation.

Signed-off-by: Romain Naour <***@openwide.fr>
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index a9ad5b9..0109e5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,12 +38,12 @@ else
CFLAGS += -O2
endif
if IS_GCC4
-CPPFLAGS += -iquote. -I/usr/local/include
+CPPFLAGS += -iquote.
if IS_DEBUG
CFLAGS += -Wno-pointer-sign
endif
else
-CPPFLAGS += -I. -I- -I/usr/local/include
+CPPFLAGS += -I. -I-
endif
endif
--
1.9.3
Romain Naour
2014-12-29 21:10:55 UTC
Permalink
/usr/local/include is probably not needed and it's unsafe for
cross-compilation.

Signed-off-by: Romain Naour <***@openwide.fr>
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index a9ad5b9..0109e5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,12 +38,12 @@ else
CFLAGS += -O2
endif
if IS_GCC4
-CPPFLAGS += -iquote. -I/usr/local/include
+CPPFLAGS += -iquote.
if IS_DEBUG
CFLAGS += -Wno-pointer-sign
endif
else
-CPPFLAGS += -I. -I- -I/usr/local/include
+CPPFLAGS += -I. -I-
endif
endif
--
1.9.3
Romain Naour
2015-01-10 14:12:44 UTC
Permalink
Hi,
Post by Romain Naour
/usr/local/include is probably not needed and it's unsafe for
cross-compilation.
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a9ad5b9..0109e5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,12 +38,12 @@ else
CFLAGS += -O2
endif
if IS_GCC4
-CPPFLAGS += -iquote. -I/usr/local/include
+CPPFLAGS += -iquote.
if IS_DEBUG
CFLAGS += -Wno-pointer-sign
endif
else
-CPPFLAGS += -I. -I- -I/usr/local/include
+CPPFLAGS += -I. -I-
endif
endif
Please, consider this patch for the next release.

Thanks.

Best regards,
Romain Naour
Nicholas Marriott
2015-01-10 17:16:59 UTC
Permalink
Well, why is it unsafe? I'm not too concerned about crossbuilding TBH. Are you sure this isn't still needed on eg FreeBSD?

-------- Original message --------
From: Romain Naour <***@openwide.fr>
Date:10/01/2015 14:12 (GMT+00:00)
To: ***@gmail.com
Cc: tmux-***@lists.sf.net
Subject: Re: [PATCH] Makefile.am: remove unsafe headers path

Hi,
Post by Romain Naour
/usr/local/include is probably not needed and it's unsafe for
cross-compilation.
---
  Makefile.am | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a9ad5b9..0109e5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,12 +38,12 @@ else
  CFLAGS += -O2
  endif
  if IS_GCC4
-CPPFLAGS += -iquote. -I/usr/local/include
+CPPFLAGS += -iquote.
  if IS_DEBUG
  CFLAGS += -Wno-pointer-sign
  endif
  else
-CPPFLAGS += -I. -I- -I/usr/local/include
+CPPFLAGS += -I. -I-
  endif
  endif
 
Please, consider this patch for the next release.

Thanks.

Best regards,
Romain Naour
Romain Naour
2015-01-10 23:09:03 UTC
Permalink
Hi Nicholas,
Post by Nicholas Marriott
Well, why is it unsafe? I'm not too concerned about crossbuilding TBH. Are you
sure this isn't still needed on eg FreeBSD?
Ok, let's me explain my use case.

tmux has been packaged in Buildroot [1][2] (and probably Yoto too) and the build
system use a cross-compiler to build the entire target system.

Also all headers and libraries for the target are installed in a specific
directory called STAGING_DIR. So using a path like /usr/local/include can lead
to mixing headers from host and target (that may come from different versions).

That why all paths that point to a host location (starting with /usr/include,
/usr/local/include or /lib) is considered unsafe for cross-compilation.

Recently, we added in Buildroot a tool to check if host headers or libraries
paths are used [3].

Regarding FreeBSD compatibility, I'm not sure (I'm not a FreeBSB user).
Probably yes, they still need /usr/local/include for native build.

But I think, it's the user's responsibility to ensure that their compiler
searches for headers in the appropriate location, not the tmux's Makefile.
Especially when headers paths are passed on the command line.

For example, on my Fedora host the /usr/local/include is an empty directory,
It's not needed to force to use this path in the CFLAGS even for a native build.

Or consider using pkg-config to search for headers and libraries (ncurses and
libevent).

Best regards,
Romain Naour

[1] http://buildroot.org/
[2] http://git.buildroot.net/buildroot/tree/package/tmux
[3] http://lists.busybox.net/pipermail/buildroot/2014-December/114848.html
Post by Nicholas Marriott
-------- Original message --------
From: Romain Naour
Date:10/01/2015 14:12 (GMT+00:00)
Subject: Re: [PATCH] Makefile.am: remove unsafe headers path
Hi,
Post by Romain Naour
/usr/local/include is probably not needed and it's unsafe for
cross-compilation.
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a9ad5b9..0109e5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,12 +38,12 @@ else
CFLAGS += -O2
endif
if IS_GCC4
-CPPFLAGS += -iquote. -I/usr/local/include
+CPPFLAGS += -iquote.
if IS_DEBUG
CFLAGS += -Wno-pointer-sign
endif
else
-CPPFLAGS += -I. -I- -I/usr/local/include
+CPPFLAGS += -I. -I-
endif
endif
Please, consider this patch for the next release.
Thanks.
Best regards,
Romain Naour
Nicholas Marriott
2015-01-10 23:46:42 UTC
Permalink
Hmm well I think it's nice if users can just download the tarball and run configure and it works without having to point it at dependencies, something which regularly confuses users. /usr/local is a common default location for local builds, I've occasionally been tempted to add some others too.

Still, I'm not sure there is any evidence having this particulatly helps anybody, libevent and ncurses are part of base on OpenBSD, NetBSD uses /usr/pkg, GCC on Linux mostly searches /usr/local by default. I suspect the FreeBSD compiler searches /usr/local by default as well, I'll have a look at some point.

In the meantime, if you add your own include directories, they should be searched first no matter what tmux adds.

-------- Original message --------
From: Romain Naour <***@openwide.fr>
Date:10/01/2015 23:09 (GMT+00:00)
To: Nicholas Marriott <***@gmail.com>
Cc: tmux-***@lists.sf.net
Subject: Re: [PATCH] Makefile.am: remove unsafe headers path

Hi Nicholas,
Post by Nicholas Marriott
Well, why is it unsafe? I'm not too concerned about crossbuilding TBH. Are you
sure this isn't still needed on eg FreeBSD?
Ok, let's me explain my use case.

tmux has been packaged in Buildroot [1][2] (and probably Yoto too) and the build
system use a cross-compiler to build the entire target system.

Also all headers and libraries for the target are installed in a specific
directory called STAGING_DIR. So using a path like /usr/local/include can lead
to mixing headers from host and target (that may come from different versions).

That why all paths that point to a host location (starting with /usr/include,
/usr/local/include or /lib) is considered unsafe for cross-compilation.

Recently, we added in Buildroot a tool to check if host headers or libraries
paths are used [3].

Regarding FreeBSD compatibility, I'm not sure (I'm not a FreeBSB user).
Probably yes, they still need /usr/local/include for native build.

But I think, it's the user's responsibility to ensure that their compiler
searches for headers in the appropriate location, not the tmux's Makefile.
Especially when headers paths are passed on the command line.

For example, on my Fedora host the /usr/local/include is an empty directory,
It's not needed to force to use this path in the CFLAGS even for a native build.

Or consider using pkg-config to search for headers and libraries (ncurses and
libevent).

Best regards,
Romain Naour

[1] http://buildroot.org/
[2] http://git.buildroot.net/buildroot/tree/package/tmux
[3] http://lists.busybox.net/pipermail/buildroot/2014-December/114848.html
Post by Nicholas Marriott
-------- Original message --------
From: Romain Naour
Date:10/01/2015 14:12 (GMT+00:00)
Subject: Re: [PATCH] Makefile.am: remove unsafe headers path
Hi,
Post by Romain Naour
/usr/local/include is probably not needed and it's unsafe for
cross-compilation.
---
  Makefile.am | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a9ad5b9..0109e5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,12 +38,12 @@ else
  CFLAGS += -O2
  endif
  if IS_GCC4
-CPPFLAGS += -iquote. -I/usr/local/include
+CPPFLAGS += -iquote.
  if IS_DEBUG
  CFLAGS += -Wno-pointer-sign
  endif
  else
-CPPFLAGS += -I. -I- -I/usr/local/include
+CPPFLAGS += -I. -I-
  endif
  endif
Please, consider this patch for the next release.
Thanks.
Best regards,
Romain Naour
Romain Naour
2015-01-12 22:17:16 UTC
Permalink
Hi Nicholas, all
Post by Nicholas Marriott
Hmm well I think it's nice if users can just download the tarball and run
configure and it works without having to point it at dependencies, something
which regularly confuses users. /usr/local is a common default location for
local builds, I've occasionally been tempted to add some others too.
Still, I'm not sure there is any evidence having this particulatly helps
anybody, libevent and ncurses are part of base on OpenBSD, NetBSD uses /usr/pkg,
GCC on Linux mostly searches /usr/local by default. I suspect the FreeBSD
compiler searches /usr/local by default as well, I'll have a look at some point.
In the meantime, if you add your own include directories, they should be
searched first no matter what tmux adds.
Searching for headers is the purpose of configure script, and if user use a
custom/local path then let it define these in CFLAGS.
This is what we do when tmux is cross-compiled in Buildroot.

See an example here:
http://pastebin.com/T6Ng5Bn8

Which dependencies of tmux are assumed to be in /usr/local ?

Best regards,
Romain Naour
Post by Nicholas Marriott
-------- Original message --------
From: Romain Naour
Date:10/01/2015 23:09 (GMT+00:00)
To: Nicholas Marriott
Subject: Re: [PATCH] Makefile.am: remove unsafe headers path
Hi Nicholas,
Post by Nicholas Marriott
Well, why is it unsafe? I'm not too concerned about crossbuilding TBH. Are you
sure this isn't still needed on eg FreeBSD?
Ok, let's me explain my use case.
tmux has been packaged in Buildroot [1][2] (and probably Yoto too) and the build
system use a cross-compiler to build the entire target system.
Also all headers and libraries for the target are installed in a specific
directory called STAGING_DIR. So using a path like /usr/local/include can lead
to mixing headers from host and target (that may come from different versions).
That why all paths that point to a host location (starting with /usr/include,
/usr/local/include or /lib) is considered unsafe for cross-compilation.
Recently, we added in Buildroot a tool to check if host headers or libraries
paths are used [3].
Regarding FreeBSD compatibility, I'm not sure (I'm not a FreeBSB user).
Probably yes, they still need /usr/local/include for native build.
But I think, it's the user's responsibility to ensure that their compiler
searches for headers in the appropriate location, not the tmux's Makefile.
Especially when headers paths are passed on the command line.
For example, on my Fedora host the /usr/local/include is an empty directory,
It's not needed to force to use this path in the CFLAGS even for a native build.
Or consider using pkg-config to search for headers and libraries (ncurses and
libevent).
Best regards,
Romain Naour
[1] http://buildroot.org/
[2] http://git.buildroot.net/buildroot/tree/package/tmux
[3] http://lists.busybox.net/pipermail/buildroot/2014-December/114848.html
Post by Nicholas Marriott
-------- Original message --------
From: Romain Naour
Date:10/01/2015 14:12 (GMT+00:00)
Subject: Re: [PATCH] Makefile.am: remove unsafe headers path
Hi,
Post by Romain Naour
/usr/local/include is probably not needed and it's unsafe for
cross-compilation.
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a9ad5b9..0109e5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,12 +38,12 @@ else
CFLAGS += -O2
endif
if IS_GCC4
-CPPFLAGS += -iquote. -I/usr/local/include
+CPPFLAGS += -iquote.
if IS_DEBUG
CFLAGS += -Wno-pointer-sign
endif
else
-CPPFLAGS += -I. -I- -I/usr/local/include
+CPPFLAGS += -I. -I-
endif
endif
Please, consider this patch for the next release.
Thanks.
Best regards,
Romain Naour
--
Romain Naour

OPEN WIDE Ingénierie - Paris
23/25, rue Daviel| 75013 PARIS
http://ingenierie.openwide.fr

Le blog des technologies libres et embarquées :
http://www.linuxembedded.fr
Nicholas Marriott
2015-01-12 22:38:10 UTC
Permalink
actually, you're right, if any depends are in /usr/local, configure will
fail, so we can lose this after all
Post by Romain Naour
Hi Nicholas, all
Post by Nicholas Marriott
Hmm well I think it's nice if users can just download the tarball and run
configure and it works without having to point it at dependencies, something
which regularly confuses users. /usr/local is a common default location for
local builds, I've occasionally been tempted to add some others too.
Still, I'm not sure there is any evidence having this particulatly helps
anybody, libevent and ncurses are part of base on OpenBSD, NetBSD uses /usr/pkg,
GCC on Linux mostly searches /usr/local by default. I suspect the FreeBSD
compiler searches /usr/local by default as well, I'll have a look at some point.
In the meantime, if you add your own include directories, they should be
searched first no matter what tmux adds.
Searching for headers is the purpose of configure script, and if user use a
custom/local path then let it define these in CFLAGS.
This is what we do when tmux is cross-compiled in Buildroot.
http://pastebin.com/T6Ng5Bn8
Which dependencies of tmux are assumed to be in /usr/local ?
Best regards,
Romain Naour
Post by Nicholas Marriott
-------- Original message --------
From: Romain Naour
Date:10/01/2015 23:09 (GMT+00:00)
To: Nicholas Marriott
Subject: Re: [PATCH] Makefile.am: remove unsafe headers path
Hi Nicholas,
Post by Nicholas Marriott
Well, why is it unsafe? I'm not too concerned about crossbuilding TBH. Are you
sure this isn't still needed on eg FreeBSD?
Ok, let's me explain my use case.
tmux has been packaged in Buildroot [1][2] (and probably Yoto too) and the build
system use a cross-compiler to build the entire target system.
Also all headers and libraries for the target are installed in a specific
directory called STAGING_DIR. So using a path like /usr/local/include can lead
to mixing headers from host and target (that may come from different versions).
That why all paths that point to a host location (starting with /usr/include,
/usr/local/include or /lib) is considered unsafe for cross-compilation.
Recently, we added in Buildroot a tool to check if host headers or libraries
paths are used [3].
Regarding FreeBSD compatibility, I'm not sure (I'm not a FreeBSB user).
Probably yes, they still need /usr/local/include for native build.
But I think, it's the user's responsibility to ensure that their compiler
searches for headers in the appropriate location, not the tmux's Makefile.
Especially when headers paths are passed on the command line.
For example, on my Fedora host the /usr/local/include is an empty directory,
It's not needed to force to use this path in the CFLAGS even for a native build.
Or consider using pkg-config to search for headers and libraries (ncurses and
libevent).
Best regards,
Romain Naour
[1] http://buildroot.org/
[2] http://git.buildroot.net/buildroot/tree/package/tmux
[3] http://lists.busybox.net/pipermail/buildroot/2014-December/114848.html
Post by Nicholas Marriott
-------- Original message --------
From: Romain Naour
Date:10/01/2015 14:12 (GMT+00:00)
Subject: Re: [PATCH] Makefile.am: remove unsafe headers path
Hi,
Post by Romain Naour
/usr/local/include is probably not needed and it's unsafe for
cross-compilation.
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a9ad5b9..0109e5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,12 +38,12 @@ else
CFLAGS += -O2
endif
if IS_GCC4
-CPPFLAGS += -iquote. -I/usr/local/include
+CPPFLAGS += -iquote.
if IS_DEBUG
CFLAGS += -Wno-pointer-sign
endif
else
-CPPFLAGS += -I. -I- -I/usr/local/include
+CPPFLAGS += -I. -I-
endif
endif
Please, consider this patch for the next release.
Thanks.
Best regards,
Romain Naour
--
Romain Naour
OPEN WIDE Ing??nierie - Paris
23/25, rue Daviel| 75013 PARIS
http://ingenierie.openwide.fr
http://www.linuxembedded.fr
Loading...