rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Build system can't detect rustc
@ 2021-03-15  6:30 Sumera Priyadarsini
  2021-03-15  7:27 ` Geert Stappers
  2021-03-15 12:45 ` Miguel Ojeda
  0 siblings, 2 replies; 12+ messages in thread
From: Sumera Priyadarsini @ 2021-03-15  6:30 UTC (permalink / raw)
  To: rust-for-linux; +Cc: miguel.ojeda.sandonis

Hi all,

I was trying to build the rust-for-linux as per the instructions here
(https://github.com/Rust-for-Linux/linux/blob/rust/Documentation/rust/quick-start.rst)
but CONFIG_RUST doesn't show up in General setup menu when I try to 
setup the config file with `make nconfig`. Since it says the build
system is supposed to be able to locate rustc, I am guessing make is
unable to find rustc. 

Could you point me to where make is trying to find rust or how I can try
fixing this? Is there anything else I might have missed out on?
I have the latest rust nightly installed.

Cheers,
Sumera


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

* Re: Build system can't detect rustc
  2021-03-15  6:30 Build system can't detect rustc Sumera Priyadarsini
@ 2021-03-15  7:27 ` Geert Stappers
  2021-03-15 12:45 ` Miguel Ojeda
  1 sibling, 0 replies; 12+ messages in thread
From: Geert Stappers @ 2021-03-15  7:27 UTC (permalink / raw)
  To: rust-for-linux

On Mon, Mar 15, 2021 at 12:00:44PM +0530, Sumera Priyadarsini wrote:
> Hi all,
> 
> I was trying to build the rust-for-linux as per the instructions here
> (https://github.com/Rust-for-Linux/linux/blob/rust/Documentation/rust/quick-start.rst)
> but CONFIG_RUST doesn't show up in General setup menu when I try to 
> setup the config file with `make nconfig`. Since it says the build
> system is supposed to be able to locate rustc, I am guessing make is
> unable to find rustc. 
> 
> Could you point me to where make is trying to find rust
> or how I can try fixing this?
> Is there anything else I might have missed out on?

State which Linux kernel source tree you are using.

The reply that is expect is a git clone URL and git branch name.


> I have the latest rust nightly installed.

Tell more about where it is installed.

The reply that is expect is a Linux distro name plus version.



Regards
Geert Stappers
First posting on this mailinglist.
Completely fine with other replies as expected.
Did not a "reply to all", did a "reply to list".
-- 
Silence is hard to parse

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

* Re: Build system can't detect rustc
  2021-03-15  6:30 Build system can't detect rustc Sumera Priyadarsini
  2021-03-15  7:27 ` Geert Stappers
@ 2021-03-15 12:45 ` Miguel Ojeda
  2021-03-16 14:10   ` Sumera Priyadarsini
  1 sibling, 1 reply; 12+ messages in thread
From: Miguel Ojeda @ 2021-03-15 12:45 UTC (permalink / raw)
  To: Sumera Priyadarsini; +Cc: rust-for-linux

Hi Sumera,

On Mon, Mar 15, 2021 at 7:30 AM Sumera Priyadarsini
<sylphrenadin@gmail.com> wrote:
>
> Could you point me to where make is trying to find rust or how I can try
> fixing this? Is there anything else I might have missed out on?
> I have the latest rust nightly installed.

By default, it will call `rustc` as-is, so make sure it is on your $PATH:

    $ which rustc
    /some/path/bin/rustc

Another reason could be that you are using the `master` branch instead
of the `rust` branch.

HTH,

Cheers,
Miguel

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

* Re: Build system can't detect rustc
  2021-03-15 12:45 ` Miguel Ojeda
@ 2021-03-16 14:10   ` Sumera Priyadarsini
  2021-03-16 15:09     ` Miguel Ojeda
  2021-03-17 15:55     ` Miguel Ojeda
  0 siblings, 2 replies; 12+ messages in thread
From: Sumera Priyadarsini @ 2021-03-16 14:10 UTC (permalink / raw)
  To: Miguel Ojeda; +Cc: rust-for-linux

On Mon, Mar 15, 2021 at 6:16 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> Hi Sumera,
>
> On Mon, Mar 15, 2021 at 7:30 AM Sumera Priyadarsini
> <sylphrenadin@gmail.com> wrote:
> >
> > Could you point me to where make is trying to find rust or how I can try
> > fixing this? Is there anything else I might have missed out on?
> > I have the latest rust nightly installed.
>
> By default, it will call `rustc` as-is, so make sure it is on your $PATH:
>
>     $ which rustc
>     /some/path/bin/rustc
>
> Another reason could be that you are using the `master` branch instead
> of the `rust` branch.
>
> HTH,
>
Hi Miguel,

This definitely helped- I was using the master branch earlier. Can I
make a PR to add this to the documentation on rust/quick-start page?

I did run into some other errors while building though:

```
error: unknown argument: '-mindirect-branch=thunk-extern', err: true
error: unknown argument: '-mindirect-branch-register', err: true
error: unsupported option '-mrecord-mcount' for target
'x86_64-pc-linux-gnu', err: true
thread 'main' panicked at 'Unable to generate bindings: ()'
```
The full logs are here: https://paste.ubuntu.com/p/xqd4pMBdrb/

Since a few places online suggested the error might be related to gcc
and clang, I tried compiling with clang versions 9.0 /10.0 /11.0 and
gcc versions 8 /9 / 10 but the error persists. I am not sure how to
proceed here :/

Thanks,
Sumera


> Cheers,
> Miguel

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

* Re: Build system can't detect rustc
  2021-03-16 14:10   ` Sumera Priyadarsini
@ 2021-03-16 15:09     ` Miguel Ojeda
  2021-03-16 17:00       ` Kaviraj Kanagaraj
  2021-03-17 10:32       ` Sumera Priyadarsini
  2021-03-17 15:55     ` Miguel Ojeda
  1 sibling, 2 replies; 12+ messages in thread
From: Miguel Ojeda @ 2021-03-16 15:09 UTC (permalink / raw)
  To: Sumera Priyadarsini; +Cc: rust-for-linux

On Tue, Mar 16, 2021 at 3:10 PM Sumera Priyadarsini
<sylphrenadin@gmail.com> wrote:
>
> Hi Miguel,
>
> This definitely helped- I was using the master branch earlier. Can I
> make a PR to add this to the documentation on rust/quick-start page?

I didn't put it there since, if we manage to get this mainlined, then
we would be in the master branch already. :-)

However, you can send the PR to add a line to the `README.md` file,
which is only intended for GitHub!

> gcc versions 8 /9 / 10 but the error persists. I am not sure how to
> proceed here :/

This happens when bindgen (which uses Clang internally) gets GCC
parameters, but that should not happen and is a bug when it does.
Which kernel config are you using? defconfig for x86_64?

To progress, please try a Clang build (pass CC=clang or LLVM=1 to
make), which is much more likely to work (GCC builds rely on a hack to
make bindgen work), or use one of the kernel configs inside
.github/workflows/ which are known to build since we check them in the
CI.

HTH,

Cheers,
Miguel

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

* Re: Build system can't detect rustc
  2021-03-16 15:09     ` Miguel Ojeda
@ 2021-03-16 17:00       ` Kaviraj Kanagaraj
  2021-03-16 17:31         ` Miguel Ojeda
  2021-03-17 10:32       ` Sumera Priyadarsini
  1 sibling, 1 reply; 12+ messages in thread
From: Kaviraj Kanagaraj @ 2021-03-16 17:00 UTC (permalink / raw)
  To: Miguel Ojeda; +Cc: Sumera Priyadarsini, rust-for-linux

HI

I had similar issue even with LLVM=1 or CC=clang enabled.

[kaviraj@kavi-desktop-manjaro linux-rs]$ export LLVM=1
[kaviraj@kavi-desktop-manjaro linux-rs]$ make
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  CHK     include/generated/compile.h
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  AR      init/built-in.a
  LD      vmlinux.o
  MODPOST vmlinux.symvers
  MODINFO modules.builtin.modinfo
  GEN     modules.builtin
  LD      .tmp_vmlinux.kallsyms1
ld.lld: error: Unexpected GOT entries detected!
ld.lld: error: Unexpected GOT entries detected!
ld.lld: error: Unexpected GOT entries detected!
make: *** [Makefile:1274: vmlinux] Error 1


The thing that worked for me is to  cp .github/workflows/kernel-x86_64-release.config .config and build again.

Although it would be nice to find out what is causing this when we generate config from make menuconfig (even after following the Quickstart guide)

Thanks
Kaviraj

> On 16 Mar 2021, at 16:09, Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:
> 
> On Tue, Mar 16, 2021 at 3:10 PM Sumera Priyadarsini
> <sylphrenadin@gmail.com> wrote:
>> 
>> Hi Miguel,
>> 
>> This definitely helped- I was using the master branch earlier. Can I
>> make a PR to add this to the documentation on rust/quick-start page?
> 
> I didn't put it there since, if we manage to get this mainlined, then
> we would be in the master branch already. :-)
> 
> However, you can send the PR to add a line to the `README.md` file,
> which is only intended for GitHub!
> 
>> gcc versions 8 /9 / 10 but the error persists. I am not sure how to
>> proceed here :/
> 
> This happens when bindgen (which uses Clang internally) gets GCC
> parameters, but that should not happen and is a bug when it does.
> Which kernel config are you using? defconfig for x86_64?
> 
> To progress, please try a Clang build (pass CC=clang or LLVM=1 to
> make), which is much more likely to work (GCC builds rely on a hack to
> make bindgen work), or use one of the kernel configs inside
> .github/workflows/ which are known to build since we check them in the
> CI.
> 
> HTH,
> 
> Cheers,
> Miguel


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

* Re: Build system can't detect rustc
  2021-03-16 17:00       ` Kaviraj Kanagaraj
@ 2021-03-16 17:31         ` Miguel Ojeda
  0 siblings, 0 replies; 12+ messages in thread
From: Miguel Ojeda @ 2021-03-16 17:31 UTC (permalink / raw)
  To: Kaviraj Kanagaraj; +Cc: Sumera Priyadarsini, rust-for-linux

On Tue, Mar 16, 2021 at 6:00 PM Kaviraj Kanagaraj
<kavirajkanagaraj@gmail.com> wrote:
>
> The thing that worked for me is to  cp .github/workflows/kernel-x86_64-release.config .config and build again.
>
> Although it would be nice to find out what is causing this when we generate config from make menuconfig (even after following the Quickstart guide)

Yes, soon we will need to sort out any issues from
{def,allyes,allmod}configs, start running them in the CI, plus run
some randconfigs etc. as usual.

For the moment, please run the included configs if you run into trouble. :-)

Cheers,
Miguel

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

* Re: Build system can't detect rustc
  2021-03-16 15:09     ` Miguel Ojeda
  2021-03-16 17:00       ` Kaviraj Kanagaraj
@ 2021-03-17 10:32       ` Sumera Priyadarsini
  2021-03-17 13:40         ` Miguel Ojeda
  1 sibling, 1 reply; 12+ messages in thread
From: Sumera Priyadarsini @ 2021-03-17 10:32 UTC (permalink / raw)
  To: Miguel Ojeda; +Cc: rust-for-linux

On Tue, Mar 16, 2021 at 8:39 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Tue, Mar 16, 2021 at 3:10 PM Sumera Priyadarsini
> <sylphrenadin@gmail.com> wrote:
> >
> > Hi Miguel,
> >
> > This definitely helped- I was using the master branch earlier. Can I
> > make a PR to add this to the documentation on rust/quick-start page?
>
> I didn't put it there since, if we manage to get this mainlined, then
> we would be in the master branch already. :-)
>
> However, you can send the PR to add a line to the `README.md` file,
> which is only intended for GitHub!
>
> > gcc versions 8 /9 / 10 but the error persists. I am not sure how to
> > proceed here :/
>
> This happens when bindgen (which uses Clang internally) gets GCC
> parameters, but that should not happen and is a bug when it does.
> Which kernel config are you using? defconfig for x86_64?

Hi,

Specifying  clang did work, thanks! I used "make nconfig" but I am
guessing it would be the same as what 'defconfig' would have given.
Here is a paste if you want to take a look:
https://paste.ubuntu.com/p/dMb3bb34Qf/

>
> To progress, please try a Clang build (pass CC=clang or LLVM=1 to
> make), which is much more likely to work (GCC builds rely on a hack to
> make bindgen work), or use one of the kernel configs inside
> .github/workflows/ which are known to build since we check them in the
> CI.
>
> HTH,
>
Thanks,
Sumera

> Cheers,
> Miguel

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

* Re: Build system can't detect rustc
  2021-03-17 10:32       ` Sumera Priyadarsini
@ 2021-03-17 13:40         ` Miguel Ojeda
  2021-03-17 18:04           ` Sumera Priyadarsini
  0 siblings, 1 reply; 12+ messages in thread
From: Miguel Ojeda @ 2021-03-17 13:40 UTC (permalink / raw)
  To: Sumera Priyadarsini; +Cc: rust-for-linux

On Wed, Mar 17, 2021 at 11:32 AM Sumera Priyadarsini
<sylphrenadin@gmail.com> wrote:
>
> Specifying  clang did work, thanks! I used "make nconfig" but I am
> guessing it would be the same as what 'defconfig' would have given.
> Here is a paste if you want to take a look:
> https://paste.ubuntu.com/p/dMb3bb34Qf/

Please note that `menuconfig` (and similar commands) should be run
with `CC=clang` as well, so that configuration is done properly for
Clang.

It would be great if you can confirm `make nconfig CC=clang` would
have worked for you (to start from scratch, including removing the
configuration, use `make mrproper`).

Thanks!

Cheers,
Miguel

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

* Re: Build system can't detect rustc
  2021-03-16 14:10   ` Sumera Priyadarsini
  2021-03-16 15:09     ` Miguel Ojeda
@ 2021-03-17 15:55     ` Miguel Ojeda
  2021-03-17 22:49       ` Miguel Ojeda
  1 sibling, 1 reply; 12+ messages in thread
From: Miguel Ojeda @ 2021-03-17 15:55 UTC (permalink / raw)
  To: Sumera Priyadarsini; +Cc: rust-for-linux

On Tue, Mar 16, 2021 at 3:10 PM Sumera Priyadarsini
<sylphrenadin@gmail.com> wrote:
>
> ```
> error: unknown argument: '-mindirect-branch=thunk-extern', err: true
> error: unknown argument: '-mindirect-branch-register', err: true
> error: unsupported option '-mrecord-mcount' for target
> 'x86_64-pc-linux-gnu', err: true
> thread 'main' panicked at 'Unable to generate bindings: ()'
> ```

Reproduced with defconfig, building with GCC. I'm sending the fix.

Thanks for the report!

Cheers,
Miguel

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

* Re: Build system can't detect rustc
  2021-03-17 13:40         ` Miguel Ojeda
@ 2021-03-17 18:04           ` Sumera Priyadarsini
  0 siblings, 0 replies; 12+ messages in thread
From: Sumera Priyadarsini @ 2021-03-17 18:04 UTC (permalink / raw)
  To: Miguel Ojeda; +Cc: rust-for-linux

On Wed, Mar 17, 2021 at 7:10 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Wed, Mar 17, 2021 at 11:32 AM Sumera Priyadarsini
> <sylphrenadin@gmail.com> wrote:
> >
> > Specifying  clang did work, thanks! I used "make nconfig" but I am
> > guessing it would be the same as what 'defconfig' would have given.
> > Here is a paste if you want to take a look:
> > https://paste.ubuntu.com/p/dMb3bb34Qf/
>
> Please note that `menuconfig` (and similar commands) should be run
> with `CC=clang` as well, so that configuration is done properly for
> Clang.
>
> It would be great if you can confirm `make nconfig CC=clang` would
> have worked for you (to start from scratch, including removing the
> configuration, use `make mrproper`).

Sorry, I missed out on this- yes, I did specify CC=clang with 'make
nconfig' as well.
Without that, 'make -j4 CC=clang' started asking for config options as
expected XD

Thanks for all the help :)

Cheers,
Sumera

>
> Thanks!
>
> Cheers,
> Miguel

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

* Re: Build system can't detect rustc
  2021-03-17 15:55     ` Miguel Ojeda
@ 2021-03-17 22:49       ` Miguel Ojeda
  0 siblings, 0 replies; 12+ messages in thread
From: Miguel Ojeda @ 2021-03-17 22:49 UTC (permalink / raw)
  To: Sumera Priyadarsini; +Cc: rust-for-linux

On Wed, Mar 17, 2021 at 4:55 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> Reproduced with defconfig, building with GCC. I'm sending the fix.
>
> Thanks for the report!

Done! https://github.com/Rust-for-Linux/linux/pull/115

It also works for a full allmodconfig now.

Cheers,
Miguel

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

end of thread, other threads:[~2021-03-17 22:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15  6:30 Build system can't detect rustc Sumera Priyadarsini
2021-03-15  7:27 ` Geert Stappers
2021-03-15 12:45 ` Miguel Ojeda
2021-03-16 14:10   ` Sumera Priyadarsini
2021-03-16 15:09     ` Miguel Ojeda
2021-03-16 17:00       ` Kaviraj Kanagaraj
2021-03-16 17:31         ` Miguel Ojeda
2021-03-17 10:32       ` Sumera Priyadarsini
2021-03-17 13:40         ` Miguel Ojeda
2021-03-17 18:04           ` Sumera Priyadarsini
2021-03-17 15:55     ` Miguel Ojeda
2021-03-17 22:49       ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).