[oe] Error building ... ARG_MAX

Stanislav Brabec utx at penguin.cz
Fri Apr 11 09:04:14 UTC 2008


Khem Raj wrote:

> +| gtester.c: In function 'launch_test_binary':
> +| gtester.c:276: error: 'ARG_MAX' undeclared (first use in this function)
> +| gtester.c:276: error: (Each undeclared identifier is reported only once
> +| gtester.c:276: error: for each function it appears in.)
> +| gtester.c:276: warning: unused variable 'argv'
> +| make[4]: *** [gtester.o] Error 1


This is a mail which appeared today on the opensuse-packaging list:

From: Cristian Rodríguez <...>
Subject: [opensuse-packaging] FYI:  glibc 2.8 may break some of your packages
Date: Fri, 11 Apr 2008 01:03:51 -0400 (07:03 CEST)

HI all :


Factory currenlty has glibc 2.8 which may break some of your packages, 
Im going to describe just one possible breakage, and hope someone else 
can contribute information about other breakages.


glibc 2.8 no longer defines ARG_MAX constant in linux, so you may see:


foobar.c:N: error: 'ARG_MAX' undeclared (first use in this function)

To fix this problem you can use something like this

#include <unistd.h> /* only if not already there !! */

#if defined(_SC_ARG_MAX)
# if defined(ARG_MAX)
#    undef ARG_MAX
# endif
# define ARG_MAX sysconf (_SC_ARG_MAX)
#endif

HTH.

Cristian.



-- 
"Freedom of religion also means freedom **from** religion" - Anonymous

Cristian Rodríguez R.
Platform/OpenSUSE - Core Services
SUSE LINUX Products GmbH
Research & Development
http://www.opensuse.org/

-------

And from reply from Stephan Kulow:

> foobar.c:N: error: 'ARG_MAX' undeclared (first use in this function)
>
> To fix this problem you can use something like this
>
Note, that the code should have done that before too, as the glibc info 
pages say:

   Each of the following limit parameters has a macro that is defined in
`limits.h' only if the system has a fixed, uniform limit for the
parameter in question.  If the system allows different file systems or
files to have different limits, then the macro is undefined; use
`sysconf' to find out the limit that applies at a particular time on a
particular machine.  

Greetings, Stephan

-- 
Stanislav Brabec
http://www.penguin.cz/~utx/zaurus





More information about the Openembedded-devel mailing list