Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link errors during compilation #139

Open
smuller opened this issue Jun 25, 2021 · 6 comments
Open

Link errors during compilation #139

smuller opened this issue Jun 25, 2021 · 6 comments

Comments

@smuller
Copy link
Collaborator

smuller commented Jun 25, 2021

Using default Makefile, settings on x64 Linux.

/usr/bin/ld: /tmp/filei7cguX.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileMpJHu9.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filehIqW9E.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileglk1OR.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/file4FFlPx.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/file9ypzk5.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/filemPelIg.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filexFU4UI.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filedpBC9F.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileoMuh1K.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileWI23yB.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileuVRwuX.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileckWVA5.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filebn6XVV.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileWk0hsj.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file7PVHki.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileaXY3B2.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileqDQF9C.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileuHZmFB.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileLav8M9.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file692jjQ.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filepAC9rp.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileNFnQT0.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileOScYQh.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file8jPkAI.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file10zDmp.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileVdovJQ.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileGDngdl.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileMKUZ07.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filer8VDM5.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filebEU7ox.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file0SM4Fj.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileefMjbj.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileS6jiAn.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileD5PRwm.o: relocation R_X86_64_32S against hidden symbol `staticHeapM' can not be used when making a PIE object
/usr/bin/ld: /tmp/file53CRNy.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileQ18eaA.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filecbzf7Y.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileWFoiKj.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileskiNAV.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filejNVLV3.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileSk2xBL.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filen3MNqN.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file95t1sR.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file9pAPPv.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileqNcC9r.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileeptd8v.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filedYzpgO.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file1R0vft.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileUd1rbT.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileTEanG9.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileWiJnIo.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileQ7OaUH.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filerFs7Sd.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileImeMcR.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filed7aL0a.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file3M5NiD.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileWuUm4N.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file0JPbBA.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileA3Z9TZ.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileUCoJqP.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileA6LnQr.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileK1auS7.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file8jpjqw.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file4V6icb.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileg1GT0K.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileMCdPDY.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filej8Qohu.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file9fY1Wk.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileszogaz.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileXMQQKd.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileCqVN9i.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filenc6XZB.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filej19sAF.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/filemBgnwx.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filet3DC2r.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/filepxDnZC.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filec2Mkvu.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileDdrUqY.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/filechsDVV.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileEz1QOH.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file53H1Cm.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileKFa6FC.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filetlWji9.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileuXwLcp.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file9t4U4Q.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileMq3FQ1.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileJvg2Ts.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileExZBAl.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileAPdVdV.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileUSrvWp.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filevCeZvv.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file6YYjGv.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileOJWBQX.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileUQgEzZ.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filefIgSYF.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file8ESTze.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileiKmpHj.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file4v6qGz.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileuWm6ql.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileo7iqU8.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filetQmbmP.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file7q2diN.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filejJQxQX.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file8bmOJh.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/filebjWoAT.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileojmtMZ.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file35Q0IG.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileG9EHdg.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileO6yNUl.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/file4zfSqn.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileJ9s3bB.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileHEOmUv.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileDLtc39.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileU2Cy09.o: relocation R_X86_64_32S against hidden symbol `staticHeapI' can not be used when making a PIE object
/usr/bin/ld: /tmp/fileC2BaQJ.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileAsOLPq.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/fileXRAa7k.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(gc-npi.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(platform-npi.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(linux-npi.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(util-npi.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(rusage-npi.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(bug-npi.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(int-inf-npi.o): relocation R_X86_64_32 against symbol `__gmpz_add' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(Stat-npi.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(Times-npi.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(Uname-npi.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libmlton.a(Signal-npi.o): relocation R_X86_64_32S against hidden symbol `GC_handler' can not be used when making a PIE object
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libgdtoa.a(gdtoa-npi.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libgdtoa.a(misc-npi.o): relocation R_X86_64_32S against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libgdtoa.a(strtord-npi.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libgdtoa.a(strtodg-npi.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libgdtoa.a(strtof-npi.o): relocation R_X86_64_32 against `.data' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libgdtoa.a(strtorf-npi.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libgdtoa.a(g__fmt-npi.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libgdtoa.a(hexnan-npi.o): relocation R_X86_64_32S against hidden symbol `hexdig_D2A' can not be used when making a PIE object
/usr/bin/ld: /usr/local/lib/mlton/targets/self/libgdtoa.a(gethex-npi.o): relocation R_X86_64_32S against hidden symbol `hexdig_D2A' can not be used when making a PIE object
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
@smuller
Copy link
Collaborator Author

smuller commented Jun 25, 2021

make show-config in the runtime dir reports

WITH_OPT_RUNTIME = true
WITH_DBG_RUNTIME = true
WITH_DPI_RUNTIME = true
WITH_NPI_RUNTIME = false
WITH_PIC_RUNTIME = false
WITH_PIE_RUNTIME = false
XCCFLAGS = -std=gnu11
XMFLAGS = -m64
XCPPFLAGS = -I.
XCFLAGS = -fno-common -pedantic -Wall -Wextra -fPIC -fvisibility=hidden
OPTXCFLAGS = -Wdisabled-optimization -O2
DBGXCFLAGS = -g -DASSERT=1 -Wno-uninitialized -O0
DPIXCFLAGS = 
NPIXCFLAGS = -fno-pic -fno-pie
PICXCFLAGS = -fPIC
PIEXCFLAGS = -fPIE
XLDFLAGS = 
HAVE_NPI = true
WITH_DEFAULT_NPI = false
HAVE_PIE = true
WITH_DEFAULT_PIE = false
HAVE_PIC = true
WITH_DEFAULT_PIC = true

I tried manually overriding some of the PIC flags, but nothing I tried worked.

@shwestrick
Copy link
Collaborator

Huh, I've never seen this error before. I wonder if maybe it's an issue with gcc version or something similar?

@MatthewFluet
Copy link
Collaborator

Is the /usr/local/bin/mlton a MaPLe MLton or a (regular) MLton?

What's happening is that the (default) /usr/local/lib/mlton/targets/self/libmlton.a corresponds to an npi version (non-position independent), but cc on your system defaults to building PIEs.

If you built the /usr/local/bin/mlton on this system and then tried to use it, then it is very odd.

But, I suspect that you took a binary distribution of MLton that was built on a system that defaults to building non-position independent object files and are trying to use it on this system that defaults to building PIEs. If you have a recent binary distribution of MLton, then you should be able to run make update; make install. The initial make update will inspect the system on which you plan to install MLton and adjust the defaults so that it matches the behavior of cc on that system.

However, this is a seldom traversed path, so the Makefile distributed with MLton 20210117 has a small bash typo; so apply the following patch first: MLton/mlton@22002cd#diff-4c43bf0db712915bdbe2bac5752e813990cb22d1bf297d0d1a2f02d178918a7f

@smuller
Copy link
Collaborator Author

smuller commented Jun 25, 2021

/usr/local/bin/mlton is the binary distribution of MLton 20210117 for glibc 2.23 and Ubuntu 16.04 found here: https://sourceforge.net/projects/mlton/files/mlton/20210117/mlton-20210117-1.amd64-linux-glibc2.23.tgz

(I actually have glibc 2.27 and Ubuntu 18.04; would that matter? I suspect not but never know...)

I tried downloading the binary distribution again and running make update; make install but am still getting the error.

@MatthewFluet
Copy link
Collaborator

Still getting the same long stream of errors, or just getting one error about staticHeapI?

Karl Crary actually reported a similar problem a couple of months ago. Here's the conclusion of that exchange:

Thanks for the info. I was able to reproduce the link errors on our local Ubuntu 18.04 machine.

It seems to actually be a MLton native codegen bug, although I can't understand why the native codegen output would have changed between 20201002 and 20210117:

[mtf@glados tmp]$ diff 20201002/hello.0.s 20210117/hello.0.s
1c1
< /* MLton 20201002 */
---
> /* MLton 20210117 */
1545,1546c1545
<       leaq (staticHeapI+0xBB0)(%rip),%rax
<       cmpb $0xA,(%rax,%r14,1)
---
>       cmpb $0xA,(staticHeapI+0xBB0)(,%r14,1)
3533,3534c3532
<       leaq (staticHeapI+0xFE8)(%rip),%rdi
<       movb (%rdi,%r14,1),%r13b
---
>       movb (staticHeapI+0xFE8)(,%r14,1),%r13b

Anyways, it seems that all of the make update and other things are working as expected. It's just that for some reason, the native codegen is making an immediate reference to the staticHeapI label, rather than a %rip relative reference. And, I'm afraid I don't have time to investigate that at the moment (though I appreciate being aware of the problem).

In the meantime, I would suggest using MLton 20201007: https://github.com/MLton/mlton/releases/download/on-20201002-release/mlton-20201002-1.amd64-linux.tgz.
My compiler students have been using it all semester on our department Ubuntu 18.04 machines without any issues.

@miguelraz
Copy link

miguelraz commented Oct 13, 2022

Can confirm I'm getting the same error on a fresh PopOS.

I did make update; make install as Matthew suggested here but now I hit this:

Compile and Assemble finished in 6.58 + 0.00 (0% GC)
   Link starting
      cc -o mlton-mpl-compile /tmp/fileEOtybS.o /tmp/file12R4mG.o \
          /tmp/filek4EMzZ.o /tmp/fileVIOESm.o /tmp/file45zg98.o \
...
/tmp/fileNnag3K.o -L/usr/local/lib/mlton/targets/self -lmlton \
          -lgdtoa -lm -lgmp -m64 -Wl,-znoexecstack
/usr/bin/ld: /tmp/file12R4mG.o: relocation R_X86_64_32S against `.data' 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
      Link raised: Fail: call to system failed with Fail: exit status 1:

I tried changing the Makefile a bunch to recompile with -fPIE but it was to no avail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants