Error While Running Vivado Simulation on Ubuntu 22.04

So I was recently playing around with DPI (Direct Programming Interface) in Vivado Simulator.  My goal is to call some python code that I wrote that will generate valid BATS messages, pass that data into my IP, and check the parsed code coming out is correct.

After reading through the Xilinx/AMD documentation, I went ahead and used some Python to SystemVerilog and tried to run some sample code and eventually came upon an error complaining about GLIBCXX_3.4.29 not found

There is a question and answer record for this on the Xilinx website here, but it does not specifically mention the use of the pysv library (Python to SystemVerilog library):

  • https://support.xilinx.com/s/question/0D52E00006iHsnbSAC/glibcxx3420-not-found?language=en_US

I wanted to expand on the answer and explain exactly what I did to diagnose and workaround this error.

The error is occurring because the version of gcc that is bundled with Vivado is older and does not contain the version of GLIBCXX_3.4.29, and the pysv compile commands use the later version of the system gcc.

source xsim.dir/bats_parser_tb/xsim_script.tcl
# xsim {bats_parser_tb} -autoloadwcfg -runall
xsim.dir/bats_parser_tb/xsimk: /tools/Xilinx/Vivado/2023.2/lib/lnx64.o/../../tps/lnx64/gcc-9.3.0/bin/../lib64/libstdc++.so.6: version `GLIBCXX_3.4.29′ not found (required by ./build/libpysv.so)
xsim.dir/bats_parser_tb/xsimk: /tools/Xilinx/Vivado/2023.2/lib/lnx64.o/../../tps/lnx64/gcc-9.3.0/bin/../lib64/libstdc++.so.6: version `CXXABI_1.3.13′ not found (required by ./build/libpysv.so)
ERROR: [Simtcl 6-50] Simulation engine failed to start: Simulation exited with status code 1.

I use the ‘strings’ utility and run it on the libstdc++.so.6 file that is mentioned by the error, the results are expected to be vast, so I grep on GLIBCXX_3.4:

strings /tools/Xilinx/Vivado/2023.2/lib/lnx64.o/../../tps/lnx64/gcc-9.3.0/bin/../lib64/libstdc++.so.6 | grep ^GLIBCXX_3.4 | sort | uniq

GLIBCXX_3.4.2
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBCXX_3.4.3

Notice how GLIBCXX_3.4.29 is not present…

A further examination of that directory shows the version of libstdc++ is 6.0.28

john@Ryzen10:/mnt/d/work/fpganow/Market.Data.Bats.Parser$ ls -l /tools/Xilinx/Vivado/2023.2/lib/lnx64.o/../../tps/lnx64/gcc-9.3.0/bin/../lib64/ | grep libstdc++
-rwxr-xr-x 2 root 44M Jan 5 2023 libstdc++.a*
-rwxr-xr-x 2 root 1006 Jan 5 2023 libstdc++.la*
lrwxrwxrwx 1 root 19 Dec 19 22:45 libstdc++.so -> libstdc++.so.6.0.28*
lrwxrwxrwx 1 root 19 Dec 19 22:45 libstdc++.so.6 -> libstdc++.so.6.0.28*
-rwxr-xr-x 2 root 17M Jan 5 2023 libstdc++.so.6.0.28*
-rwxr-xr-x 2 root 2.5K Jan 5 2023 libstdc++.so.6.0.28-gdb.py*
-rwxr-xr-x 2 root 12M Jan 5 2023 libstdc++fs.a*
-rwxr-xr-x 2 root 946 Jan 5 2023 libstdc++fs.la*

I check my system and see that I have 6.0.30 installed, and that that version supports GLIBCXX_3.4.29:

john@Ryzen10:/mnt/d/work/fpganow/Market.Data.Bats.Parser$ ls -l /usr/lib/x86_64-linux-gnu/ | grep libstdc++
lrwxrwxrwx 1 root 19 May 13 2023 libstdc++.so.6 -> libstdc++.so.6.0.30
-rw-r–r– 1 root 2.2M May 13 2023 libstdc++.so.6.0.30

john@Ryzen10:/mnt/d/work/fpganow/Market.Data.Bats.Parser$ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep ^GLIBCXX_3.4.29
GLIBCXX_3.4.29

The versions are pretty close – not even a minor version upgrade – so I decided to manually bring in the new version to the Vivado version:

# Copy in the newer libstdc++
john@Ryzen10:/tools/Xilinx/Vivado/2023.2/tps/lnx64/gcc-9.3.0/lib64$ cd /tools/Xilinx/Vivado/2023.2/lib/lnx64.o/../../tps/lnx64/gcc-9.3.0/bin/../lib64/
john@Ryzen10:/tools/Xilinx/Vivado/2023.2/tps/lnx64/gcc-9.3.0/lib64$ sudo cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30 .
# Break existing link
john@Ryzen10:/tools/Xilinx/Vivado/2023.2/tps/lnx64/gcc-9.3.0/lib64$ sudo rm libstdc++.so
john@Ryzen10:/tools/Xilinx/Vivado/2023.2/tps/lnx64/gcc-9.3.0/lib64$ sudo rm libstdc++.so.6
# Create new link
sudo ln -s libstdc++.so.6.0.30 libstdc++.so
sudo ln -s libstdc++.so.6.0.30 libstdc++.so.6

Now it works…

And what my Vivado embedded gcc directory looks like:

john@Ryzen10:/tools/Xilinx/Vivado/2023.2/tps/lnx64/gcc-9.3.0/lib64$ ls -l | grep stdc++
-rwxr-xr-x  2 root  44M Jan  5  2023 libstdc++.a*
-rwxr-xr-x  2 root 1006 Jan  5  2023 libstdc++.la*
lrwxrwxrwx  1 root  19 Dec 24 10:50 libstdc++.so -> libstdc++.so.6.0.30
lrwxrwxrwx  1 root  19 Dec 24 10:50 libstdc++.so.6 -> libstdc++.so.6.0.30
-rwxr-xr-x  2 root  17M Jan  5  2023 libstdc++.so.6.0.28*
-rwxr-xr-x  2 root 2.5K Jan  5  2023 libstdc++.so.6.0.28-gdb.py*
-rw-r–r–  1 root 2.2M Dec 24 10:49 libstdc++.so.6.0.30
-rwxr-xr-x  2 root  12M Jan  5  2023 libstdc++fs.a*
-rwxr-xr-x  2 root  946 Jan  5  2023 libstdc++fs.la*

Leave a Comment