如何使用scheme2c编译文件
我正在尝试使用 scheme2c (dec scheme-> c compiler)来编译计划程序。这是程序hello.sc
:
(module hello (main run-main))
(define (run-main)
(display "Hello!")
(newline))
我尝试使用scc hello.sh.sc
来编译程序,但是这些链接器错误消息失败了:
hello.sc:
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scinit.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(apply.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(callcc.o): relocation R_X86_64_32S against symbol `sc_display' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(cio.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(heap.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(objects.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scdebug.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(sceval.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scexpand.o): relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scexpnd1.o): relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scexpnd2.o): relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(screp.o): relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt1.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt2.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt3.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt4.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt5.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt6.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt7.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scqquote.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
我如何编译方案使用SCC
的程序?
(ubuntu 20.04.4 lts上的spone2c版本2012.10.14)
I am trying to compile a Scheme program using scheme2c (the DEC Scheme->C Compiler). This is the program hello.sc
:
(module hello (main run-main))
(define (run-main)
(display "Hello!")
(newline))
I tried to compile the program using scc hello.sc
, but the compilation fails with these linker error messages:
hello.sc:
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scinit.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(apply.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(callcc.o): relocation R_X86_64_32S against symbol `sc_display' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(cio.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(heap.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(objects.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scdebug.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(sceval.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scexpand.o): relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scexpnd1.o): relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scexpnd2.o): relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(screp.o): relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt1.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt2.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt3.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt4.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt5.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt6.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scrt7.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /usr/lib/scheme2c/libs2c.a(scqquote.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
How do I compile a Scheme program using scc
?
(scheme2c version 2012.10.14 on Ubuntu 20.04.4 LTS)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,在Ubuntu的GCC中启用了PIE(Ubuntu使用
-Enable-Default-Pie
选项编译GCC)。可以通过使用GCC的
-no-pie
选项来解决该问题:PIE is enabled by default in Ubuntu's GCC (Ubuntu compiles GCC using the
--enable-default-pie
option).The problem can be solved by using GCC's
-no-pie
option: