ZipCPU / zipcpu

A small, light weight, RISC CPU soft core
1.3k stars 157 forks source link

Error running make at top level #5

Closed rpflaum2000 closed 6 years ago

rpflaum2000 commented 6 years ago

I get the following error when running make at the top level of zipcpu.

GCC installed Building in C++ simulator make[1]: Nothing to be done for 'all'. Building Verilator simulator Building dependencies g++ -Wall -Og -g -I../../rtl/objdir -I../../rtl -I../../sw/zasm -I/usr/local/sh are/verilator/include -I/usr/local/share/verilator/include/vltstd obj-pc/zipsys tb.o obj-pc/memsim.o obj-pc/zipelf.o obj-pc/twoc.o obj-pc/byteswap.o obj-pc/zo pcodes.o obj-pc/verilated.o obj-pc/verilated_vcd_c.o ../../rtl/obj_dir/Vzipsyste m__ALL.a -lncurses -lelf -o zipsys_tb obj-pc/zipsys_tb.o: In function VerilatedVcdC::dump(unsigned long)': /usr/local/share/verilator/include/verilated_vcd_c.h:425: undefined reference toVerilatedVcd::dump(unsigned long)' /usr/local/share/verilator/include/verilated_vcd_c.h:425:(.text$_ZN5TESTBI10Vzip systemE4tickEv[_ZN5TESTBI10VzipsystemE4tickEv]+0x2d): relocation truncated to fi t: R_X86_64_PC32 against undefined symbol VerilatedVcd::dump(unsigned long)' /usr/local/share/verilator/include/verilated_vcd_c.h:425: undefined reference toVerilatedVcd::dump(unsigned long)' /usr/local/share/verilator/include/verilated_vcd_c.h:425:(.text$_ZN5TESTBI10Vzip systemE4tickEv[_ZN5TESTBI10VzipsystemE4tickEv]+0x58): relocation truncated to fi t: R_X86_64_PC32 against undefined symbol VerilatedVcd::dump(unsigned long)' /usr/local/share/verilator/include/verilated_vcd_c.h:425: undefined reference toVerilatedVcd::dump(unsigned long)' /usr/local/share/verilator/include/verilated_vcd_c.h:425:(.text$_ZN5TESTBI10Vzip systemE4tickEv[_ZN5TESTBI10VzipsystemE4tickEv]+0x87): relocation truncated to fi t: R_X86_64_PC32 against undefined symbol VerilatedVcd::dump(unsigned long)' /usr/local/share/verilator/include/verilated_vcd_c.h:425: undefined reference toVerilatedVcd::dump(unsigned long)' /usr/local/share/verilator/include/verilated_vcd_c.h:425:(.text$_ZN9ZIPCPU_TB4ti ckEv[_ZN9ZIPCPU_TB4tickEv]+0x8b8): relocation truncated to fit: R_X86_64_PC32 ag ainst undefined symbol VerilatedVcd::dump(unsigned long)' /usr/local/share/verilator/include/verilated_vcd_c.h:425: undefined reference toVerilatedVcd::dump(unsigned long)' /usr/local/share/verilator/include/verilated_vcd_c.h:425:(.text$_ZN9ZIPCPU_TB4ti ckEv[_ZN9ZIPCPU_TB4tickEv]+0x8e3): relocation truncated to fit: R_X86_64_PC32 ag ainst undefined symbol VerilatedVcd::dump(unsigned long)' obj-pc/zipsys_tb.o:/usr/local/share/verilator/include/verilated_vcd_c.h:425: mor e undefined references toVerilatedVcd::dump(unsigned long)' follow obj-pc/zipsys_tb.o: In function VerilatedVcdC::dump(unsigned long)': /usr/local/share/verilator/include/verilated_vcd_c.h:425:(.text$_ZN9ZIPCPU_TB4ti ckEv[_ZN9ZIPCPU_TB4tickEv]+0x912): relocation truncated to fit: R_X86_64_PC32 ag ainst undefined symbolVerilatedVcd::dump(unsigned long)' collect2: error: ld returned 1 exit status make[1]: [Makefile:180: zipsys_tb] Error 1 make: [Makefile:87: vsim] Error 2

ZipCPU commented 6 years ago

This is looking similar to this problem. Can you please run cygcheck -s -v -r > cygout.txt and include that as an attachment as well?

Thanks!

Dan

ZipCPU commented 6 years ago

@rpflaum2000 , Initial testing suggests the problem might be parallel compilation. Try a "make clean", and then a "make -j1". (You may need to go back and rebuild the compiler and verilator with -j1 as well) Dan

rpflaum2000 commented 6 years ago

cygout.txt

rpflaum2000 commented 6 years ago

I will try the -j option with make a little later this evening. I have to go a take care of some other family business first. Bob

rpflaum2000 commented 6 years ago

I performed a make clean in the top level verilator directory. I then ran make -j1. Build successful. I then performed a make clean in the top level zipcpu directory followed by a make -j1. The build was unsuccessful with the same errors as reported initially above. I am at work now but I will continue to investigate more this evening upon arrival at home.

ZipCPU commented 6 years ago

Ok, I managed to reproduce the problem. The problem lies in /usr/local/share/verilated/include/verilatedos.h, where vluint64_t is defined as an unsigned long long. If you instead define it as an unsigned long, and likewise vlint64_t as a long, you'll get a lot of warnings, but the demo will build and compile.

However, this just doesn't seem like the "right" solution, so ... I'll keep digging a bit further, Dan

ZipCPU commented 6 years ago

Ok, I can fix this now ... by adding placing -D__WORDSIZE=64 to the compiler flags, this now builds and passes its tests for me on a Windows system. I'll have an update shortly, Dan

ZipCPU commented 6 years ago

Patch applied. Please do a "git pull", and then run "make clean; make" in first the rtl/ and then the sim/verilated directories. After that, everything should work as advertised--no changes to /usr/local/share/verilator/include/verilatedos.h required. Dan

rpflaum2000 commented 6 years ago

I was able to complete the build per your instructions after pulling the patch. I have been able to run through your blog post "ZipCPU toolchain and initial test" successfully. I need to spend some time now to understand the details. Thanks for being so responsive on this.