VCS compiling error issues

1. vcs_save_restore_new.o: relocation R_X86_64_32S

Environment:
Ubuntu 22.04 LTS

Error:

/usr/bin/ld: /usr/synopsys/vcs/linux64/lib/vcs_save_restore_new.o: relocation R_X86_64_32S against symbol `_sigintr' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:105: product_timestamp] Error 1

Solution :

  1. Install gcc-4.8 and g++-4.8
    sudo apt install gcc-4.8 #under ubuntu 18.04
  2. Use option -full64 -cpp g++-4.8 -cc gcc-4.8 -LDFLAGS -Wl,--no-as-needed
    It's best to modify ~/.bashrc, vim ~/.bashrc
    alias vcs="vcs -full64 -cpp g++-4.8 -cc gcc-4.8 -LDFLAGS -Wl,--no-as-needed"
    and do not forget source ~/.bashrc

Reference
EETOP: https://bbs.eetop.cn/thread-839371-1-1.html

2. Unable to fetch gcc-4.8

Environment:
Ubuntu 22.04 LTS

Error:

E: Unable to locate package gcc-4.8
E: Couldn't find any package by glob 'gcc-4.8'
E: Unable to locate package g++-4.8
E: Couldn't find any package by glob 'g++-4.8'

Cause :

The gcc-4.8 and g++-4.8 packages have been discontinued in the Ubuntu 20.04 and later default repositories, but they are still available in the Ubuntu 18.04 default repositories.

Solution :

cd
mkdir install_g++-4.8
cd install_g++-4.8/
sudo apt update
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/g++-4.8_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/libstdc++-4.8-dev_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/libgcc-4.8-dev_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/cpp-4.8_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/libasan0_4.8.5-4ubuntu8_amd64.deb  
sudo apt install ./gcc-4.8_4.8.5-4ubuntu8_amd64.deb ./gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb ./libstdc++-4.8-dev_4.8.5-4ubuntu8_amd64.deb ./cpp-4.8_4.8.5-4ubuntu8_amd64.deb ./libgcc-4.8-dev_4.8.5-4ubuntu8_amd64.deb ./libasan0_4.8.5-4ubuntu8_amd64.deb ./g++-4.8_4.8.5-4ubuntu8_amd64.deb
cd
rm -rf install_g++-4.8

Reference
Stack Exchange: https://askubuntu.com/questions/1450426/need-gcc-and-g-4-8-in-ubuntu-22-04-1

3. WSL2 "dc: command not found" while compiling

Environment:
Ubuntu 22.04 LTS in WSL2

Cause & Solution :
EETOP给出的解决方案是安装bc:

sudo apt install bc

实测安装后依然报错,但是安装dc后问题解决:

sudo apt install dc

4. WSL2 使用makefile无法正常编译,不使用makefile可以正常编译

Environment:
Ubuntu 22.04 LTS in WSL2

Cause & Solution :
提示找不到vcsparse等文件,但实际上对应目录下是有的。
问题的原因在于bashrc中给vcs设定了alias,添加了-full64选项,而使用makefile不会调用alias,解决的办法是在makefile中独立地设定编译选项。如-full64,--no-as--needed等选项。

5. /bin/sh: 0: Illegal option -h

Environment:
Ubuntu 22.04 LTS in WSL2

Cause & Solution :

Delete current sh link, and retarget it to bash.
Execute the following command:

rm -f /bin/sh
ln -s /bin/bash /bin/sh
posted @ 2023-03-02 22:32  devindd  阅读(235)  评论(0编辑  收藏  举报