* Cross-compiling target tools
@ 2020-03-25 22:13 Yegor Yefremov
2020-03-26 6:36 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Yegor Yefremov @ 2020-03-25 22:13 UTC (permalink / raw)
To: barebox
How should one compile the target tools like bareboxenv-target etc. I
get the following error:
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -C debian/build
make: Entering directory
'/home/user/MyProjects/oss/bootloaders/barebox-upstream/debian/build'
make[3]: 'include/generated/mach-types.h' is up to date.
Using /home/user/MyProjects/oss/bootloaders/barebox-upstream as
source for kernel
GEN /home/user/MyProjects/oss/bootloaders/barebox-upstream/debian/build/Makefile
CHK include/generated/version.h
CHK include/generated/utsrelease.h
CREATE include/config.h
CC scripts/bareboxenv-target
/tmp/cc0VGmDE.o: In function `file_action':
/home/user/MyProjects/oss/bootloaders/barebox-upstream/scripts/../common/environment.c:119:
undefined reference to `xzalloc'
/tmp/cc0VGmDE.o: In function `concat_path_file':
/home/user/MyProjects/oss/bootloaders/barebox-upstream/scripts/bareboxenv.c:79:
undefined reference to `xmalloc'
/tmp/cc0VGmDE.o: In function `envfs_save':
/home/user/MyProjects/oss/bootloaders/barebox-upstream/scripts/../common/environment.c:291:
undefined reference to `xzalloc'
/tmp/cc0VGmDE.o: In function `envfs_load':
/home/user/MyProjects/oss/bootloaders/barebox-upstream/scripts/../common/environment.c:594:
undefined reference to `xmalloc'
collect2: error: ld returned 1 exit status
/home/user/MyProjects/oss/bootloaders/barebox-upstream/scripts/Makefile:58:
recipe for target 'scripts/bareboxenv-target' failed
make[3]: *** [scripts/bareboxenv-target] Error 1
/home/user/MyProjects/oss/bootloaders/barebox-upstream/Makefile:426:
recipe for target 'scripts' failed
make[2]: *** [scripts] Error 2
Makefile:123: recipe for target '_all' failed
make[1]: *** [_all] Error 2
Makefile:24: recipe for target '__sub-make' failed
make: *** [__sub-make] Error 2
Yegor
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cross-compiling target tools
2020-03-25 22:13 Cross-compiling target tools Yegor Yefremov
@ 2020-03-26 6:36 ` Sascha Hauer
2020-03-26 15:31 ` Yegor Yefremov
0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2020-03-26 6:36 UTC (permalink / raw)
To: Yegor Yefremov; +Cc: barebox
Hi Yegor,
On Wed, Mar 25, 2020 at 11:13:03PM +0100, Yegor Yefremov wrote:
> How should one compile the target tools like bareboxenv-target etc. I
> get the following error:
>
> ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -C debian/build
> make: Entering directory
> '/home/user/MyProjects/oss/bootloaders/barebox-upstream/debian/build'
> make[3]: 'include/generated/mach-types.h' is up to date.
> Using /home/user/MyProjects/oss/bootloaders/barebox-upstream as
> source for kernel
> GEN /home/user/MyProjects/oss/bootloaders/barebox-upstream/debian/build/Makefile
> CHK include/generated/version.h
> CHK include/generated/utsrelease.h
> CREATE include/config.h
> CC scripts/bareboxenv-target
> /tmp/cc0VGmDE.o: In function `file_action':
> /home/user/MyProjects/oss/bootloaders/barebox-upstream/scripts/../common/environment.c:119:
> undefined reference to `xzalloc'
> /tmp/cc0VGmDE.o: In function `concat_path_file':
> /home/user/MyProjects/oss/bootloaders/barebox-upstream/scripts/bareboxenv.c:79:
bareboxenv.c includes a compiler.h file which has static inline variants
of xmalloc and xzalloc. I just gave it a test here and it still works as
expected. Could you verify scripts/compiler.h is included by the
compiler? If not, what else is included which provides prototypes for
these functions? If scripts/compiler.h is not included then I would
expect some undeclared function warnings.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cross-compiling target tools
2020-03-26 6:36 ` Sascha Hauer
@ 2020-03-26 15:31 ` Yegor Yefremov
2020-03-26 16:00 ` Ahmad Fatoum
0 siblings, 1 reply; 5+ messages in thread
From: Yegor Yefremov @ 2020-03-26 15:31 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On Thu, Mar 26, 2020 at 7:36 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> Hi Yegor,
>
> On Wed, Mar 25, 2020 at 11:13:03PM +0100, Yegor Yefremov wrote:
> > How should one compile the target tools like bareboxenv-target etc. I
> > get the following error:
> >
> > ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -C debian/build
> > make: Entering directory
> > '/home/user/MyProjects/oss/bootloaders/barebox-upstream/debian/build'
> > make[3]: 'include/generated/mach-types.h' is up to date.
> > Using /home/user/MyProjects/oss/bootloaders/barebox-upstream as
> > source for kernel
> > GEN /home/user/MyProjects/oss/bootloaders/barebox-upstream/debian/build/Makefile
> > CHK include/generated/version.h
> > CHK include/generated/utsrelease.h
> > CREATE include/config.h
> > CC scripts/bareboxenv-target
> > /tmp/cc0VGmDE.o: In function `file_action':
> > /home/user/MyProjects/oss/bootloaders/barebox-upstream/scripts/../common/environment.c:119:
> > undefined reference to `xzalloc'
> > /tmp/cc0VGmDE.o: In function `concat_path_file':
> > /home/user/MyProjects/oss/bootloaders/barebox-upstream/scripts/bareboxenv.c:79:
>
> bareboxenv.c includes a compiler.h file which has static inline variants
> of xmalloc and xzalloc. I just gave it a test here and it still works as
> expected. Could you verify scripts/compiler.h is included by the
> compiler? If not, what else is included which provides prototypes for
> these functions? If scripts/compiler.h is not included then I would
> expect some undeclared function warnings.
What compiler version do you use? I have gcc 7.4.0 and newer. The
problem seems to be the inline keyword in compiler.h (C99 related).
With these changes I get the tools bareboxenv-target etc. cross-compiled:
diff --git a/scripts/compiler.h b/scripts/compiler.h
index 0891c3bfa..74cd98074 100644
--- a/scripts/compiler.h
+++ b/scripts/compiler.h
@@ -113,7 +113,7 @@ typedef uint32_t __u32;
(void) (&_min1 == &_min2); \
_min1 < _min2 ? _min1 : _min2; })
-inline void *xmalloc(size_t size)
+void *xmalloc(size_t size)
{
void *p = NULL;
@@ -125,7 +125,7 @@ inline void *xmalloc(size_t size)
return p;
}
-inline void *xzalloc(size_t size)
+void *xzalloc(size_t size)
{
void *p = xmalloc(size);
memset(p, 0, size);
Yegor
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cross-compiling target tools
2020-03-26 15:31 ` Yegor Yefremov
@ 2020-03-26 16:00 ` Ahmad Fatoum
2020-03-26 16:36 ` Yegor Yefremov
0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2020-03-26 16:00 UTC (permalink / raw)
To: Yegor Yefremov, Sascha Hauer; +Cc: barebox
Hi,
On 3/26/20 4:31 PM, Yegor Yefremov wrote:
> On Thu, Mar 26, 2020 at 7:36 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> With these changes I get the tools bareboxenv-target etc. cross-compiled:
>
> diff --git a/scripts/compiler.h b/scripts/compiler.h
> index 0891c3bfa..74cd98074 100644
> --- a/scripts/compiler.h
> +++ b/scripts/compiler.h
> @@ -113,7 +113,7 @@ typedef uint32_t __u32;
> (void) (&_min1 == &_min2); \
> _min1 < _min2 ? _min1 : _min2; })
>
> -inline void *xmalloc(size_t size)
> +void *xmalloc(size_t size)
This has been static inline instead for 2 years now[1]. Please check out a current
barebox revision.
[1]: 359966df3721 ("scripts/compiler.h: inline functions in headers must be static")
Cheers
Ahmad
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cross-compiling target tools
2020-03-26 16:00 ` Ahmad Fatoum
@ 2020-03-26 16:36 ` Yegor Yefremov
0 siblings, 0 replies; 5+ messages in thread
From: Yegor Yefremov @ 2020-03-26 16:36 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
Hi Ahmad,
On Thu, Mar 26, 2020 at 5:00 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>
> Hi,
>
> On 3/26/20 4:31 PM, Yegor Yefremov wrote:
> > On Thu, Mar 26, 2020 at 7:36 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > With these changes I get the tools bareboxenv-target etc. cross-compiled:
> >
> > diff --git a/scripts/compiler.h b/scripts/compiler.h
> > index 0891c3bfa..74cd98074 100644
> > --- a/scripts/compiler.h
> > +++ b/scripts/compiler.h
> > @@ -113,7 +113,7 @@ typedef uint32_t __u32;
> > (void) (&_min1 == &_min2); \
> > _min1 < _min2 ? _min1 : _min2; })
> >
> > -inline void *xmalloc(size_t size)
> > +void *xmalloc(size_t size)
>
> This has been static inline instead for 2 years now[1]. Please check out a current
> barebox revision.
>
> [1]: 359966df3721 ("scripts/compiler.h: inline functions in headers must be static")
You're right, I was experimenting with the old version 2018.x.
Sorry for the noise.
Yegor
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-26 16:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 22:13 Cross-compiling target tools Yegor Yefremov
2020-03-26 6:36 ` Sascha Hauer
2020-03-26 15:31 ` Yegor Yefremov
2020-03-26 16:00 ` Ahmad Fatoum
2020-03-26 16:36 ` Yegor Yefremov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox