NJU-ProjectN / nemu

NJU EMUlator, a full system x86/mips32/riscv32/riscv64 emulator for teaching
Other
889 stars 192 forks source link

fatal error: llvm/Support/TargetRegistry.h: No such file or directory #16

Closed Tom-CaoZH closed 2 years ago

Tom-CaoZH commented 2 years ago

I have put forward a issues afternoon,but later i found that my ubuntu version is 20.04 and the requested is 21.04 . so i think the problem is the version of llvm in my machine is too low . so i update it to llvm 14 -- the latest version .Howerver,i met another problem following

src/utils/disasm.cc:5:10: fatal error: llvm/Support/TargetRegistry.h: No such file or directory
    5 | #include "llvm/Support/TargetRegistry.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

i think the reason of this maybe i need to update other things ,but i reinstall all the things ,the error still exist.And i try to search for the answer but i haven't find it .And because i have used the ubuntu 20.04 for a long peroid of time ,so i haven't decide to change it to ubuntu 21.04.I hope you can give me some tips on how to solve this .Thank you.

sashimi-yzh commented 2 years ago

Try the followings:

  1. install llvm-11 in ubuntu 20.04
  2. modify nemu/src/utils/filelist.mk to use llvm-config-11 instead of llvm-config
  3. compile again
ZJsheep commented 2 years ago

Don't seem to be the problem of Ubuntu version. I am also running 20.04 and have met no problems. Maybe sudo apt update and sudo apt upgrade will help?

Tom-CaoZH commented 2 years ago

Try the followings:

  1. install llvm-11 in ubuntu 20.04
  2. modify nemu/src/utils/filelist.mk to use llvm-config-11 instead of llvm-config
  3. compile again

yes , thank you very much ,it works.

Tom-CaoZH commented 2 years ago

Don't seem to be the problem of Ubuntu version. I am also running 20.04 and have met no problems. Maybe sudo apt update and sudo apt upgrade will help?

my origional version of llvm is 10 , maybe it is too low , i am a green hand ,i do not know much about it . Thank you for tips

darkduckgo commented 2 years ago

@sashimi-yzh thanks god.... follow the steps from your advices, I got the LD error (I search the error msg but failed)

dut to some reasons, my current env is Ubuntu-16.04 (maybe I should use docker to install ubuntu21?), and I solved a lot of env problems before which are differ from ubuntu21

firstly, I download the binary package from llvm, and save it to /usr/local/llvm, add $PATH for llvm/bin, then I modify the /etc/ld.so.conf and add the lib path again, and ldconfig to enable it. However the error doesn't change

image

# some env
llvm-config --version
11.1.0

I wonder if the neum tasks support Ubuntu16/18? please give us the minimum version requirements, and could we use docker to build a ubutnu21 for studying? (or any suggestion for the lower ubuntu version/ or centos7?)

thanks a lot

sashimi-yzh commented 2 years ago

We did not test the project over every distributions to find the minimum version requirements. It is recommended to use the version mentioned in the gitbook.

darkduckgo commented 2 years ago

We did not test the project over every distributions to find the minimum version requirements. It is recommended to use the version mentioned in the gitbook.

thanks a lot, and I solve the problem by using apt way instead of binary pkg(it may loose some env that forbid the link process), others can refer like:

wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh
 # input the llvm version u need for the bash input
sudo ./llvm.sh 11
# in this way, the apt will download llvm-config-11 instead llvm-config (which in binary package)
darkduckgo commented 2 years ago

@sashimi-yzh sorry to interrupt, after I buy a vps from cloud server and install the ubuntu21.04-server & it works well now.

however, I found some tasks seems rely on Ubuntu GUI? (likes sound, and video/media) [e.g. fceux-am can't see video well?]

image

but I found when our courses highlight we don't need the GUI (GNOME), it makes me confuse..

image

but I found the red warning here, so I suspend the task and wonder if we need GUI (like ubuntu-desktop version), or I misunderstand the instruction? (or just let it go without GUI modules) image

At last, if we must install the ubuntu-gui version, we could add some clear instructions(like ubuntu-gui/GNOME or ubuntu desktop version) at the beginning task, thanks again

sashimi-yzh commented 2 years ago

Oh, sorry for confusion.

The fact is that

1. It is unnecessary to use GUI for coding. But you can run with solutions like X11 to support graphic display.
2. We recommend to use the desktop version.

I am going to remove the confusing statement. Thank you.

darkduckgo commented 2 years ago

Oh, sorry for confusion.

The fact is that

1. It is unnecessary to use GUI for coding. But you can run with solutions like X11 to support graphic display.
2. We recommend to use the desktop version.

I am going to remove the confusing statement. Thank you.

Thanks, another question is: Can I continue with the non-GUI environment? If it doesn't affect the core learning & coding, I can try to continue study

sashimi-yzh commented 2 years ago

It requires graphic display at the middile of the assignments. Feel free to choose whether to continue or not.

funny1dog commented 2 years ago

You should mention that: replace all llvm-config with llvm-config-11, lol.

chuanchuan-Dong commented 2 years ago

For llvm-14, the file is in"llvm/MC/TargetRegistry.h". I have solved this issue by modifing the #include " " in disasm.cc

zwong91 commented 2 years ago

include "llvm/MC/TargetRegistry.h"