All of lore.kernel.org
 help / color / mirror / Atom feed
* [nfs-utils PATCH] tools: rpcgen: use host instead of cross compiler
@ 2020-10-21 10:28 Bastian Krause
  2020-10-21 10:46 ` Giulio Benetti
  0 siblings, 1 reply; 3+ messages in thread
From: Bastian Krause @ 2020-10-21 10:28 UTC (permalink / raw)
  To: linux-nfs; +Cc: Giulio Benetti, Steve Dickson, kernel, Bastian Krause

When cross compiling rpcgen is compiled with the cross compiler although
it is executed during compile time only. This leads to errors like:

  ../../tools/rpcgen/rpcgen -l -o mount_clnt.c mount.x
  ../../tools/rpcgen/rpcgen -c -i 0 -o mount_xdr.c mount.x
  ../../tools/rpcgen/rpcgen -h -o mount.h mount.x
  /lib/ld-linux-armhf.so.3: No such file or directory
  /lib/ld-linux-armhf.so.3: No such file or directory
  /lib/ld-linux-armhf.so.3: No such file or directory

Since e61775d1 ("rpcgen: bump to latest version") rpcgen is compiled
with the target compiler, prior to that it was correctly compiled with
the host compiler. Fix that by using $(CC_FOR_BUILD) as CC explicitly as
it was before.

buildroot works around this by compiling a host version first, then a
target version --with-rpcgen=$(HOST_DIR)/bin/rpcgen [1]. That does not
look like it is intended by nfs-utils.

[1] https://git.busybox.net/buildroot/tree/package/nfs-utils/nfs-utils.mk#n25

Signed-off-by: Bastian Krause <bst@pengutronix.de>
---
 tools/rpcgen/Makefile.am | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/rpcgen/Makefile.am b/tools/rpcgen/Makefile.am
index 457cd507..f122cd9d 100644
--- a/tools/rpcgen/Makefile.am
+++ b/tools/rpcgen/Makefile.am
@@ -1,5 +1,7 @@
 CLEANFILES = *~
 
+CC=$(CC_FOR_BUILD)
+
 bin_PROGRAMS = rpcgen
 man_MANS = rpcgen.1
 
-- 
2.20.1


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

* Re: [nfs-utils PATCH] tools: rpcgen: use host instead of cross compiler
  2020-10-21 10:28 [nfs-utils PATCH] tools: rpcgen: use host instead of cross compiler Bastian Krause
@ 2020-10-21 10:46 ` Giulio Benetti
       [not found]   ` <056bd6a6-9630-bda2-e16d-2f8f31c4bedb@pengutronix.de>
  0 siblings, 1 reply; 3+ messages in thread
From: Giulio Benetti @ 2020-10-21 10:46 UTC (permalink / raw)
  To: Bastian Krause, linux-nfs; +Cc: Steve Dickson, kernel

Hello Bastian,

On 10/21/20 12:28 PM, Bastian Krause wrote:
> When cross compiling rpcgen is compiled with the cross compiler although
> it is executed during compile time only. This leads to errors like:
> 
>    ../../tools/rpcgen/rpcgen -l -o mount_clnt.c mount.x
>    ../../tools/rpcgen/rpcgen -c -i 0 -o mount_xdr.c mount.x
>    ../../tools/rpcgen/rpcgen -h -o mount.h mount.x
>    /lib/ld-linux-armhf.so.3: No such file or directory
>    /lib/ld-linux-armhf.so.3: No such file or directory
>    /lib/ld-linux-armhf.so.3: No such file or directory

Can you please provide how you reach this situation?

> Since e61775d1 ("rpcgen: bump to latest version") rpcgen is compiled
> with the target compiler, prior to that it was correctly compiled with
> the host compiler. Fix that by using $(CC_FOR_BUILD) as CC explicitly as
> it was before.
> 
> buildroot works around this by compiling a host version first, then a
> target version --with-rpcgen=$(HOST_DIR)/bin/rpcgen [1]. That does not
> look like it is intended by nfs-utils.

I find it correct since rpcgen is also a utility to be installed to 
target, so it should not be explictly built only for target and

> [1] https://git.busybox.net/buildroot/tree/package/nfs-utils/nfs-utils.mk#n25
> 
> Signed-off-by: Bastian Krause <bst@pengutronix.de>
> ---
>   tools/rpcgen/Makefile.am | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/tools/rpcgen/Makefile.am b/tools/rpcgen/Makefile.am
> index 457cd507..f122cd9d 100644
> --- a/tools/rpcgen/Makefile.am
> +++ b/tools/rpcgen/Makefile.am
> @@ -1,5 +1,7 @@
>   CLEANFILES = *~
>   
> +CC=$(CC_FOR_BUILD)
> +

this is what you're forcing to. To cross compile it we need both rpcgen 
for host and target, this way it will be built for target only.

Another option I can suggest is to assign CC_FOR_BUILD to CC on caller 
Makefile only during target building and not during host building and 
this should be automatically deduced by Makefile itself and also 
Makefile then, when calls rpcgen should know which rpcgen to use(the 
host one). That would be one solution IMHO.

What do you think about it?

Best regards
-- 
Giulio Benetti
Benetti Engineering sas

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

* Re: [nfs-utils PATCH] tools: rpcgen: use host instead of cross compiler
       [not found]     ` <d420b69b-6ab6-59ef-0be8-79b688cac027@benettiengineering.com>
@ 2020-10-21 11:46       ` Bastian Krause
  0 siblings, 0 replies; 3+ messages in thread
From: Bastian Krause @ 2020-10-21 11:46 UTC (permalink / raw)
  To: Giulio Benetti, linux-nfs; +Cc: Steve Dickson, kernel

Hi Giulio,

On 10/21/20 1:42 PM, Giulio Benetti wrote:
> On 10/21/20 1:18 PM, Bastian Krause wrote:
>>
>> Hi Giulio,
>>
>> On 10/21/20 12:46 PM, Giulio Benetti wrote:
>>> On 10/21/20 12:28 PM, Bastian Krause wrote:
>>>> When cross compiling rpcgen is compiled with the cross compiler
>>>> although
>>>> it is executed during compile time only. This leads to errors like:
>>>>
>>>>     ../../tools/rpcgen/rpcgen -l -o mount_clnt.c mount.x
>>>>     ../../tools/rpcgen/rpcgen -c -i 0 -o mount_xdr.c mount.x
>>>>     ../../tools/rpcgen/rpcgen -h -o mount.h mount.x
>>>>     /lib/ld-linux-armhf.so.3: No such file or directory
>>>>     /lib/ld-linux-armhf.so.3: No such file or directory
>>>>     /lib/ld-linux-armhf.so.3: No such file or directory
>>>
>>> Can you please provide how you reach this situation?
>>
>> Sure, see below [1].
> 
> Very difficult to me to reproduce, anyway I've got the point now.
> 
>>>
>>>> Since e61775d1 ("rpcgen: bump to latest version") rpcgen is compiled
>>>> with the target compiler, prior to that it was correctly compiled with
>>>> the host compiler. Fix that by using $(CC_FOR_BUILD) as CC
>>>> explicitly as
>>>> it was before.
>>>>
>>>> buildroot works around this by compiling a host version first, then a
>>>> target version --with-rpcgen=$(HOST_DIR)/bin/rpcgen [1]. That does not
>>>> look like it is intended by nfs-utils.
>>>
>>> I find it correct since rpcgen is also a utility to be installed to
>>> target, so it should not be explictly built only for target and
>>
>> I was not aware of this. Having a host package does not sound so bad
>> now :)
> 
> yes :-)
> 
>>>
>>>> [1]
>>>> https://git.busybox.net/buildroot/tree/package/nfs-utils/nfs-utils.mk#n25
>>>>
>>>>
>>>> Signed-off-by: Bastian Krause <bst@pengutronix.de>
>>>> ---
>>>>    tools/rpcgen/Makefile.am | 2 ++
>>>>    1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/tools/rpcgen/Makefile.am b/tools/rpcgen/Makefile.am
>>>> index 457cd507..f122cd9d 100644
>>>> --- a/tools/rpcgen/Makefile.am
>>>> +++ b/tools/rpcgen/Makefile.am
>>>> @@ -1,5 +1,7 @@
>>>>    CLEANFILES = *~
>>>>    +CC=$(CC_FOR_BUILD)
>>>> +
>>>
>>> this is what you're forcing to. To cross compile it we need both rpcgen
>>> for host and target, this way it will be built for target only.
>>
>> This is obviously wrong then.
>>
>>> Another option I can suggest is to assign CC_FOR_BUILD to CC on caller
>>> Makefile only during target building and not during host building and
>>> this should be automatically deduced by Makefile itself and also
>>> Makefile then, when calls rpcgen should know which rpcgen to use(the
>>> host one). That would be one solution IMHO.
>>>
>>> What do you think about it?
>>
>> I am not sure I understand this. Would this mean rpcgen is compiled
>> twice, once with the host compiler and once with the target compiler?
> 
> Yes, that I think should happen when cross-compiling because:
> - we need host rpcgen for building for target
> - we need target rpcgen to be installed to target

Agreed.

>> Without the need of a dedicated host package? That would be ideal, but I
>> have currently no idea how to achieve this.
> 
> It would be a not so little effort at the moment, so maybe can we keep
> it as is and you use the same work around I've used in Buildroot?

Yes, I'll use that.

> But in the meanwhile feel free to find a solution like this, that way
> when cross-compiling we can remove "--with-rpcgen=" that should be
> implicit.

In case I have some spare time, I'll look into this.

Thanks!

Regards,
Bastian

-- 
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 |

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

end of thread, other threads:[~2020-10-21 11:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 10:28 [nfs-utils PATCH] tools: rpcgen: use host instead of cross compiler Bastian Krause
2020-10-21 10:46 ` Giulio Benetti
     [not found]   ` <056bd6a6-9630-bda2-e16d-2f8f31c4bedb@pengutronix.de>
     [not found]     ` <d420b69b-6ab6-59ef-0be8-79b688cac027@benettiengineering.com>
2020-10-21 11:46       ` Bastian Krause

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.