All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] trousers: fix build issue with musl
@ 2016-08-20 11:56 Rahul Bedarkar
  2016-08-20 12:41 ` Thomas Petazzoni
  0 siblings, 1 reply; 4+ messages in thread
From: Rahul Bedarkar @ 2016-08-20 11:56 UTC (permalink / raw)
  To: buildroot

With musl C library, we get following build error when building trousers:

  tsp_tcsi_param.c:14:28: fatal error: bits/local_lim.h: No such file or directory
   #include <bits/local_lim.h>
                              ^
  compilation terminated.

Header <bits/local_lim.h> is not available in musl. tsp_tcsi_param.c
uses this for macro HOST_NAME_MAX.

This patch add support for checking presence of header <bits/local_lim.h>.
And based on that we include it or define macro HOST_NAME_MAX to 64 if
it is not already defined.

Value 64 is chosen because <bits/local_lim.h> also uses same value.

Fixes:

  http://autobuild.buildroot.net/results/c9b/c9b13ae8d4af9ae6a65921de142c0e8da30664e0/

Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
---
 .../trousers/0003-fix-build-issue-with-musl.patch  | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 package/trousers/0003-fix-build-issue-with-musl.patch

diff --git a/package/trousers/0003-fix-build-issue-with-musl.patch b/package/trousers/0003-fix-build-issue-with-musl.patch
new file mode 100644
index 0000000..c34e6d4
--- /dev/null
+++ b/package/trousers/0003-fix-build-issue-with-musl.patch
@@ -0,0 +1,52 @@
+fix build issue with musl
+
+With musl C library, we get following build error when building trousers:
+
+  tsp_tcsi_param.c:14:28: fatal error: bits/local_lim.h: No such file or directory
+   #include <bits/local_lim.h>
+                              ^
+  compilation terminated.
+
+Header <bits/local_lim.h> is not available in musl. tsp_tcsi_param.c
+uses this for macro HOST_NAME_MAX.
+
+This patch add support for checking presence of header <bits/local_lim.h>.
+And based on that we include it or define macro HOST_NAME_MAX to 64 if
+it is not already defined.
+
+Value 64 is chosen because <bits/local_lim.h> also uses same value.
+
+This build issue is found by Buildroot autobuilder
+http://autobuild.buildroot.net/results/c9b/c9b13ae8d4af9ae6a65921de142c0e8da30664e0/
+
+Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
+
+--- trousers-0.3.13/configure.in.old	2016-08-20 16:35:56.887744480 +0530
++++ trousers-0.3.13/configure.in	2016-08-20 16:36:38.643744392 +0530
+@@ -13,7 +13,7 @@ TSS_VER_MINOR=3
+ AC_CANONICAL_TARGET
+ AM_INIT_AUTOMAKE([foreign 1.6])
+ AC_CONFIG_MACRO_DIR([m4])
+-
++AC_CHECK_HEADERS([bits/local_lim.h])
+ # Debugging support
+ AC_ARG_ENABLE([debug],
+     [AC_HELP_STRING([--enable-debug], [turn on all trousers debugging flags [default=off]])],
+--- trousers-0.3.13/./src/tspi/tsp_tcsi_param.c.old	2016-08-20 16:48:26.315742897 +0530
++++ trousers-0.3.13/src/tspi/tsp_tcsi_param.c	2016-08-20 16:51:03.683742564 +0530
+@@ -11,7 +11,15 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
++
++#ifdef HAVE_BITS_LOCAL_LIM_H
+ #include <bits/local_lim.h>
++#else
++#ifndef HOST_NAME_MAX
++#define HOST_NAME_MAX 64
++#endif
++#endif
++
+ #include "trousers/tss.h"
+ #include "trousers/trousers.h"
+ #include "trousers_types.h"
-- 
2.6.2

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

* [Buildroot] [PATCH 1/1] trousers: fix build issue with musl
  2016-08-20 11:56 [Buildroot] [PATCH 1/1] trousers: fix build issue with musl Rahul Bedarkar
@ 2016-08-20 12:41 ` Thomas Petazzoni
  2016-08-22 13:52   ` Rahul Bedarkar
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2016-08-20 12:41 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, 20 Aug 2016 17:26:04 +0530, Rahul Bedarkar wrote:
> With musl C library, we get following build error when building trousers:
> 
>   tsp_tcsi_param.c:14:28: fatal error: bits/local_lim.h: No such file or directory
>    #include <bits/local_lim.h>
>                               ^
>   compilation terminated.
> 
> Header <bits/local_lim.h> is not available in musl. tsp_tcsi_param.c
> uses this for macro HOST_NAME_MAX.
> 
> This patch add support for checking presence of header <bits/local_lim.h>.
> And based on that we include it or define macro HOST_NAME_MAX to 64 if
> it is not already defined.
> 
> Value 64 is chosen because <bits/local_lim.h> also uses same value.

This seems like the wrong approach to fix the problem. Indeed, musl
does have a definition of HOST_NAME_MAX, except it's in <limits.h>.

uClibc and glibc also have HOST_NAME_MAX defined when <limits.h> is
included, so the right fix is to drop completely the <bits/local_lim.h>
inclusion, and include <limits.h> instead.

I've tested the following program:

==
#include <limits.h>
#include <stdio.h>

int main(void)
{
	printf("%d\n", HOST_NAME_MAX);
	return 0;
}
==

and it builds fine with glibc, uClibc and musl.

Could you rework your patch accordingly, and also submit the patch
upstream to the trousers project?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] trousers: fix build issue with musl
  2016-08-20 12:41 ` Thomas Petazzoni
@ 2016-08-22 13:52   ` Rahul Bedarkar
  2016-08-22 13:59     ` Thomas Petazzoni
  0 siblings, 1 reply; 4+ messages in thread
From: Rahul Bedarkar @ 2016-08-22 13:52 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Saturday 20 August 2016 06:11 PM, Thomas Petazzoni wrote:
> Hello,
>
>
> This seems like the wrong approach to fix the problem. Indeed, musl
> does have a definition of HOST_NAME_MAX, except it's in <limits.h>.
>
> uClibc and glibc also have HOST_NAME_MAX defined when <limits.h> is
> included, so the right fix is to drop completely the <bits/local_lim.h>
> inclusion, and include <limits.h> instead.
>
> I've tested the following program:
>
> ==
> #include <limits.h>
> #include <stdio.h>
>
> int main(void)
> {
> 	printf("%d\n", HOST_NAME_MAX);
> 	return 0;
> }
> ==
>
> and it builds fine with glibc, uClibc and musl.
>
> Could you rework your patch accordingly, and also submit the patch
> upstream to the trousers project?
>

Thanks for comments. Even on Trousers project mailing list someone 
proposed similar patch. 
https://sourceforge.net/p/trousers/mailman/message/35261558/

Since we can't download it and it's based on upstream master branch, I 
will add separate patch here and I don't need to submit it upstream as 
it's likely to get merged.


Thanks,
Rahul

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

* [Buildroot] [PATCH 1/1] trousers: fix build issue with musl
  2016-08-22 13:52   ` Rahul Bedarkar
@ 2016-08-22 13:59     ` Thomas Petazzoni
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2016-08-22 13:59 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 22 Aug 2016 19:22:55 +0530, Rahul Bedarkar wrote:

> Thanks for comments. Even on Trousers project mailing list someone 
> proposed similar patch. 
> https://sourceforge.net/p/trousers/mailman/message/35261558/
> 
> Since we can't download it and it's based on upstream master branch, I 
> will add separate patch here and I don't need to submit it upstream as 
> it's likely to get merged.

Romain has been faster than you:

  https://patchwork.ozlabs.org/patch/661295/

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

end of thread, other threads:[~2016-08-22 13:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-20 11:56 [Buildroot] [PATCH 1/1] trousers: fix build issue with musl Rahul Bedarkar
2016-08-20 12:41 ` Thomas Petazzoni
2016-08-22 13:52   ` Rahul Bedarkar
2016-08-22 13:59     ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.