编译XSM时链接器找不到-ll库,且无法定位libl-dev包求助
编译XSM时链接器找不到-ll库,且无法定位libl-dev包求助
看起来你遇到的问题是编译XSM模拟器时,链接器找不到-ll库(也就是lex的运行时库),而且尝试安装libl-dev包失败——这很正常,因为在现在的Debian/Ubuntu系发行版里,libl-dev这个包已经被淘汰了,lex的功能早就被flex替代了。
给你一步步解决的方法:
安装flex工具包
flex是lex的现代替代版本,它会提供你需要的链接库。执行下面的命令安装:sudo apt-get install flex修复Makefile里的链接参数(推荐)
从报错里的链接命令能看到:cc -g -o xsm lex.yy.o machine.o main.o simulator.o word.o memory.o registers.o tokenize.o disk.o debug.o exception.o '-ll'flex提供的库是
libfl而不是libl,所以你可以打开XSM目录下的Makefile,把里面的-ll改成-lfl。这样链接器就能正确找到对应的库了。如果不想改Makefile,创建软链接替代
要是你不想修改Makefile,也可以手动给libfl创建一个libl的软链接,让链接器误以为找到了libl:# 先确认libfl.so的位置,一般在/usr/lib/x86_64-linux-gnu/ sudo ln -s /usr/lib/x86_64-linux-gnu/libfl.so /usr/lib/x86_64-linux-gnu/libl.so重新编译XSM
完成上面的步骤后,回到项目根目录重新编译:make -C xsm
另外附上你提供的编译错误日志方便参考:
make -C expl make[1]: Entering directory '/home/hitesh/myexpos/expl' gcc -g -fcommon -w -c ltranslate.lex.c gcc -g -fcommon -o ltranslate ltranslate.lex.o make[1]: Leaving directory '/home/hitesh/myexpos/expl' make -C spl make[1]: Entering directory '/home/hitesh/myexpos/spl' make[1]: Nothing to be done for 'default'. make[1]: Leaving directory '/home/hitesh/myexpos/spl' make -C xfs-interface make[1]: Entering directory '/home/hitesh/myexpos/xfs-interface' make[1]: Nothing to be done for 'default'. make[1]: Leaving directory '/home/hitesh/myexpos/xfs-interface' make -C xsm make[1]: Entering directory '/home/hitesh/myexpos/xsm' cc -g -o xsm lex.yy.o machine.o main.o simulator.o word.o memory.o registers.o tokenize.o disk.o debug.o exception.o '-ll' /usr/bin/ld: cannot find -ll: No such file or directory collect2: error: ld returned 1 exit status make[1]: *** [Makefile:14: xsm] Error 1 make[1]: Leaving directory '/home/hitesh/myexpos/xsm' make: *** [Makefile:7: all] Error 2
备注:内容来源于stack exchange,提问作者phantom3lue
相关产品推荐
相关产品推荐

