The-OpenROAD-Project/RePlAce

/usr/bin/ld: cannot find -lverilog_parser

kunalg123 opened this issue · 11 comments

Hi
After cloning the latest build, I ma seeing below error

Linking...
Intel Math Kernel Library (MKL 11.3.3) and
Intel Integrated Performance Primitives (IPP 9.0.3) have been included
with static libs...
If you want to replace them into shared libs, do '-L PATH -lippi,' etc.

g++ -o RePlAce
-std=c++0x -g -ggdb -m64 -O3 -fPIC -DNDEBUG -ffast-math -Dcimg_display=1
/home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/charge.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/initPlacement.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/fftsg2d.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/bin.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/intelLibFs.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/timing.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/trial.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/lefdefIO.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/timingSta.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/plot.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/opt.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/myFunctions.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/detailPlace.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/tier.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/wlen.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/routeOpt.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/fftsg.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/ns.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/macro.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/fftsg3d.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/argument.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/fft.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/main.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/bookShelfIO.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/lefParser.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/defParser.o /home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src/gcell.o ../module/OpenSTA//app/StaApp_wrap.o ../module/OpenSTA//app/StaMain.o ../module/OpenSTA//app/TclInitVar.o
-Wl,--start-group /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_intel_lp64.a /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_gnu_thread.a /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_core.a /opt/intel/compilers_and_libraries/linux/ipp/lib/intel64/libippi.a /opt/intel/compilers_and_libraries/linux/ipp/lib/intel64/libipps.a /opt/intel/compilers_and_libraries/linux/ipp/lib/intel64/libippcore.a /opt/intel/compilers_and_libraries/linux/ipp/lib/intel64/libippvm.a ../module/OpenSTA/install-sp//lib/libliberty.a ../module/OpenSTA/install-sp//lib/libutil.a ../module/OpenSTA/install-sp//lib/libsearch.a ../module/OpenSTA/install-sp//lib/libdcalc.a ../module/OpenSTA/install-sp//lib/libgraph.a ../module/OpenSTA/install-sp//lib/libnetwork.a ../module/OpenSTA/install-sp//lib/libparasitics.a ../module/OpenSTA/install-sp//lib/libsdc.a ../module/OpenSTA/install-sp//lib/libsdf.a ../module/OpenSTA/install-sp//lib/libverilog.a -Wl,--end-group
-lgomp -lpthread -lm -ldl -lX11 -ltcl8.6 -lz
-L../module/lef/5.8-p027/lib -llef -llefzlib -lclef -lclefzlib -L../module/def/5.8-p027/lib -ldef -ldefzlib -lcdef -lcdefzlib -L../module/verilog-parser/lib -lverilog_parser -L../module/flute/lib -lflute -static-libstdc++
/usr/bin/ld: cannot find -lverilog_parser
collect2: error: ld returned 1 exit status
Makefile:92: recipe for target 'RePlAce' failed
make[1]: *** [RePlAce] Error 1
make[1]: Leaving directory '/home/kunalg/vsdflow/work/tools/RePlAce/RePlAce/src'
Makefile:8: recipe for target 'all' failed
make: *** [all] Error 2

mgwoo commented

It is same issues in #7
Can you please follow up in that link?

I need to check

  1. There must be a static-linked library as RePlAce/module/verilog-parser/lib/libverilog-parser.a
  2. Whole compile log (for libverilog-parser.a)

I did follow the above link. I am seeing something strange this time

Before doing make in Replace directory, I am seeing the libverilog-parser.a
kunalg@kunalg-VirtualBox:~/vsdflow/work/tools/RePlAce/RePlAce/module/verilog-parser/lib$ ls -ltr
total 1816
-rw-r--r-- 1 kunalg kunalg 1859548 Dec 18 07:39 libverilog_parser.a

But after doing make in Replace, I am not seeing the libverilog_parser in lib directory and make fails
kunalg@kunalg-VirtualBox:~/vsdflow/work/tools/RePlAce/RePlAce$ ls -ltr module/verilog-parser/lib/
total 0

Libparser log:
lib_parser.log

Replace make log:
Replace_make.log

Since I don't see the solution mentioned anywhere, I'll state it here: To get the verilog parser library requires cd'ing to modules/verilog_parser/src and doing "make libverilog_parser.a". That creates the modules/verilog_parser/lib directory and puts libverilog_parser.a there. However, this needs to be incorporated into the RePlAce make script somehow. . .

I also had to make a correction in verilog_parser.h to get it to work. Apparently on my system, "int" and "yy_size_t" are not the same length, resulting in "yy_scan_bytes" not being recognized when called. Fixing it required changing the extern line for yy_scan_bytes to "extern YY_BUFFER_STATE yy_scan_bytes (const char *bytes, yy_size_t len );"

Here is a list of things I needed to do to get RePlAce to compile:
(1) set environment variables MLKROOT and IPPROOT to point to the correct install location of the intel libraries in /opt/intel/.
(2) Change src/timingSta.cpp line 308 from "cout << std::defaultfloat;" to "cout.unsetf(std::ios_base::floatfield);". This is apparently a gcc limitation in implementing C++-11 which has (had) not been fixed as of gcc 4.9.2.
(3) Change src/global.h lines 388 and 440 from name("") to name({'\0'}). This is also some kind of gcc bug as it does not want to map a const char size 1 onto a field of const char size 255.
(4) Manually run "make libverilog_parser.a" in modules/verilog_parser

And. . . It compiles!
But, hey, will somebody add an "install:" target to the Makefile and perhaps make a nice wrapper script for the whole thing, as running "execute_lefdef.py" and "execute_bookshelf.py" is very non-intuitive.

From a few minutes of playing around with it, I think that it is only necessary to have an "install:" target that puts src/RePlAce into some standard location like /usr/local/bin/, which should be easy enough to add to the Makefile.

Hi guys

Thanks for your update. I still can't install on Ubuntu 16.04.5 with GCC 7.2.

I'm getting stuck at
./module/verilog-parser/lib/libverilog_parser.a(verilog_parser_wrapper.o): In function verilog::verilog_parse_string(char*, int)': /home/bku/work/git/asic/openroad/RePlAce/module/verilog-parser/src/verilog_parser_wrapper.c:49: undefined reference to yy_scan_bytes(char const*, int)'
The fix by @RTimothyEdwards is incorporated, but my linker still refuses to proceed.

I made a fork to update scripts, pls check it here: https://github.com/tetra12/RePlAce
@RTimothyEdwards could you pls validate my fork and advice on how to proceed ?

Thank you!

Note that the RePlAce source tree incorporates several other projects by recursive git. So as far as I can see, your fork does not incorporate the verilog parser, which is a separate github project in mgwoo/verilog_parser. I think you would need to fork that project separately and edit it, then change the recursive link.

But for your own error: You put " char const* " where it should have been " const char * ". Fixing that should fix the compile error.

---Tim

mgwoo commented

Could you check below commit and comments for this problem?
mgwoo/verilog-parser@651b4c3
#7 (comment)

To avoid this problem, I've ported executable flex compiler in verilog-parser repository:
mgwoo/verilog-parser@cb940cf

Anyway, I thought using the Ben-marshall's verilog-parser is not a good Idea anymore.
It still has a limitation when parsing verilog files with delimiters (starts with \ and contains string /,[,]) and frequently generates these kinds of compile problem.

Could you recommend a good verilog-parser to use this project? I've already tried yosys and OpenSTA, but they are complicated and heavy. (and yosys was not able to handle some verilog statements.).

Thanks

I also had to make a correction in verilog_parser.h to get it to work. Apparently on my system, "int" and "yy_size_t" are not the same length, resulting in "yy_scan_bytes" not being recognized when called. Fixing it required changing the extern line for yy_scan_bytes to "extern YY_BUFFER_STATE yy_scan_bytes (const char *bytes, yy_size_t len );"

I did follow the above link. I am seeing something strange this time

Before doing make in Replace directory, I am seeing the libverilog-parser.a
kunalg@kunalg-VirtualBox:~/vsdflow/work/tools/RePlAce/RePlAce/module/verilog-parser/lib$ ls -ltr
total 1816
-rw-r--r-- 1 kunalg kunalg 1859548 Dec 18 07:39 libverilog_parser.a

But after doing make in Replace, I am not seeing the libverilog_parser in lib directory and make fails
kunalg@kunalg-VirtualBox:~/vsdflow/work/tools/RePlAce/RePlAce$ ls -ltr module/verilog-parser/lib/
total 0

Libparser log:
lib_parser.log

Replace make log:
Replace_make.log

Committed the fix by @RTimothyEdwards in my PR

mgwoo commented

Solved. Close issue.