具有长(或绝对)路径的 nasm 无法打开输出文件(在 cygwin 上)
我花了很多时间,无法理解为什么 nasm“无法打开输出文件”。
如果我从包含我的 asm 文件的文件夹中调用 nasm,它可以工作(使用相对路径),但不能使用绝对路径:
XXX@YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe /cygdrive/c/Perso/Code/boringssl/crypto/chacha/chacha.asm
/cygdrive/c/Perso/Code/boringssl/crypto/chacha/chacha.asm: fatal: unable to open output file `/cygdrive/c/Perso/Code/boringssl/crypto/chacha/chacha'
XXX@YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe chacha.asm
>>>> This will work
我尝试使用一些相对路径,发现
XXX@YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe ../../../../../../c/Perso/Code/boringssl/crypto/chacha/chacha.asm
../../../../../../c/Perso/Code/boringssl/crypto/chacha/chacha.asm: fatal: unable to open output file `../../../../../../c/Perso/Code/boringssl/crypto/chacha/chacha'
XXX@YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe ../../../../../Perso/Code/boringssl/crypto/chacha/chacha.asm
>>>> This will work
我无法使其使用绝对路径,即使使用“ /tmp/chacha.asm"
我也尝试使用 2 个不同版本的 cygwin 但结果相同。
我的 nasm 版本是“NASM 版本 2.15.05 于 2020 年 8 月 28 日编译”
我无法弄清楚 nasm 需要使用绝对路径(或大的相对路径)
I spend a lot of time and can't understand why nasm "unable to open output file".
If I call nasm from the folder containing my asm file it works (with relative path) but won't work with absolute path :
XXX@YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe /cygdrive/c/Perso/Code/boringssl/crypto/chacha/chacha.asm
/cygdrive/c/Perso/Code/boringssl/crypto/chacha/chacha.asm: fatal: unable to open output file `/cygdrive/c/Perso/Code/boringssl/crypto/chacha/chacha'
XXX@YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe chacha.asm
>>>> This will work
I try with some relative path and find this
XXX@YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe ../../../../../../c/Perso/Code/boringssl/crypto/chacha/chacha.asm
../../../../../../c/Perso/Code/boringssl/crypto/chacha/chacha.asm: fatal: unable to open output file `../../../../../../c/Perso/Code/boringssl/crypto/chacha/chacha'
XXX@YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe ../../../../../Perso/Code/boringssl/crypto/chacha/chacha.asm
>>>> This will work
I can't make it work with absolute path, even with "/tmp/chacha.asm"
I also try with 2 different version of cygwin but same results.
My nasm version is "NASM version 2.15.05 compiled on Aug 28 2020"
I can't figure out what nasm need to work with an absolute path (or big relative path)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在使用 Windows NASM,因此它无法将 cygwin 特定路径理解为
/cygdrive/c/Perso/Code/boringssl/crypto/chacha
或者您使用 Windows PATH 或使用 Cygwin NASM 包
https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86_64%2Fnasm%2Fnasm-2.13.01-1&grep=nasm
You are using a Windows NASM, as such it can NOT understand cygwin specific path as
/cygdrive/c/Perso/Code/boringssl/crypto/chacha
Or you use Windows PATH or you use the Cygwin NASM package
https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86_64%2Fnasm%2Fnasm-2.13.01-1&grep=nasm