Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ld -shared not supported when I build riscv-linux #1175

Closed
ardeal opened this issue Jan 10, 2023 · 9 comments
Closed

ld -shared not supported when I build riscv-linux #1175

ardeal opened this issue Jan 10, 2023 · 9 comments

Comments

@ardeal
Copy link

ardeal commented Jan 10, 2023

Hi,

my envrionment:
ubuntu 20.04,
toolchain: riscv32-elf-ubuntu-20.04-nightly-2022.12.17-nightly.tar.gz
riscv-linux link: https://github.com/CSL-KU/riscv-linux

I would like to build riscv-linux and then run it on embedded RISCV MCU. I am experiencing the following issue

where should I add static option in Makefile?
or, should I change toolchain option?

  CALL    scripts/checksyscalls.sh
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/compile.h
  VDSOLD  arch/riscv/kernel/vdso/vdso.so.dbg
/opt/riscv/lib/gcc/riscv32-unknown-elf/12.2.0/../../../../riscv32-unknown-elf/bin/ld: -shared not supported
collect2: error: ld returned 1 exit status
  OBJCOPY arch/riscv/kernel/vdso/vdso.so
riscv32-unknown-elf-objcopy: 'arch/riscv/kernel/vdso/vdso.so.dbg': No such file
make[2]: *** [arch/riscv/kernel/vdso/Makefile:48: arch/riscv/kernel/vdso/vdso.so] Error 1
make[1]: *** [scripts/Makefile.build:575: arch/riscv/kernel/vdso] Error 2
make: *** [Makefile:1018: arch/riscv/kernel] Error 2
@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jan 11, 2023

On what basis do you think that this is a riscv-gnu-toolchain issue and not a build issue with the Linux port that you're trying to build and which you should be asking about here?

/opt/riscv/lib/gcc/riscv32-unknown-elf/12.2.0/../../../../riscv32-unknown-elf/bin/ld: -shared not supported

The riscv32-unknown-elf toolchain is the bare metal toolchain and does not support building shared libraries because it targets platforms with no OS or an [RT]OS with no shared loader mechanism.

@ardeal
Copy link
Author

ardeal commented Jan 11, 2023

@TommyMurphyTM1234
Thank you for your reply!
I don't think this is a riscv-gnu-toolchain issue. I think it should be a issue about how to config static lib in Makefile, or how to config it in toolchain.

I searched "riscv linux ld shared not supported" in Google, and got the following link:
#335
someone othere asked the same issue in this repo.

I did asked some questions in https://github.com/CSL-KU/riscv-linux, but I didn't get the reply.

Dear @TommyMurphyTM1234 ,
Do you have a good solution about the issue I am experiencing?

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jan 11, 2023

Or> @TommyMurphyTM1234 Thank you for your reply! I don't think this is a riscv-gnu-toolchain issue.

I agree. So I am consequently closing this issue.

I think it should be a issue about how to config static lib in Makefile, or how to config it in toolchain.

This is not the place to ask for general compilation issues or how to build a Linux port totally unrelated to this repo.

I searched "riscv linux ld shared not supported" in Google, and got the following link: #335 someone othere asked the same issue in this repo.

So why did you repeat the same question instead of heeding the answer the was already given?

I did asked some questions in https://github.com/CSL-KU/riscv-linux, but I didn't get the reply.

I don't see where you asked over there. All I see is this:

Dear @TommyMurphyTM1234 , Do you have a good solution about the issue I am experiencing?

Your question is already answered in issue #335 as far as I can see - you need to use the RISC-V Linux rather than the bare metal toolchain to build a Linux kernel.

@TommyMurphyTM1234 TommyMurphyTM1234 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2023
@ardeal
Copy link
Author

ardeal commented Jan 12, 2023

I don't see where you asked over there. All I see is this:

@TommyMurphyTM1234
Thank you!

I just now submitted the question at: CSL-KU/riscv-linux#3

Could you please have a look at it?

@TommyMurphyTM1234
Copy link
Collaborator

I don't see where you asked over there. All I see is this:

@TommyMurphyTM1234 Thank you!

I just now submitted the question at: CSL-KU/riscv-linux#3

Could you please have a look at it?

Your question has already been addressed. You need to use the RISC-V Linux rather than bare metal toolchain. You can download binary builds from here:

@ardeal
Copy link
Author

ardeal commented Jan 12, 2023

@TommyMurphyTM1234
my question is:
what is RISC-V Linux?
could you please help to tell me the exact name/string in the toolchain name?

@TommyMurphyTM1234
Copy link
Collaborator

@TommyMurphyTM1234 my question is: what is RISC-V Linux?

I don't know what you mean. There are various Linux versions/ports for RISC-V. There isn't just one.

could you please help to tell me the exact name/string in the toolchain name?

The RISC-V Linux toolchain archives here are the ones named riscvXX-glibc-* and riscvXX-musl-* depending on which standard library implementation is used.

The tools are named with the prefix riscvXX-unknown-linux-gnu-* - for example, riscv64-unknown-linux-gnu-gcc.

There are plenty of resources elsewhere on how to use the various RISC-V toolchains.

@ardeal
Copy link
Author

ardeal commented Jan 12, 2023

@TommyMurphyTM1234
I got it. Thank you!
your comments:
The RISC-V Linux toolchain archives here are the ones named riscvXX-glibc-* and riscvXX-musl-* depending on which standard library implementation is used.

match my questions.

@TommyMurphyTM1234
Copy link
Collaborator

@TommyMurphyTM1234 I got it. Thank you! your comments: The RISC-V Linux toolchain archives here are the ones named riscvXX-glibc-* and riscvXX-musl-* depending on which standard library implementation is used.

match my questions.

Glad it helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants