如何阻止mingw和msys在命令行中输入的路径名称? [英] How to stop mingw and msys from mangling path names given at the command line?

查看:348
本文介绍了如何阻止mingw和msys在命令行中输入的路径名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows上,我使用CodeSourcery的交叉编译器套件交叉编译ARM / linux程序。我使用mingw msys作为我的命令解释器,并且经常会破坏我的路径和路径名。例如,为了构建我的程序,我调用了

On Windows, I'm cross-compiling a program for ARM/linux using CodeSourcery's cross-compiler suite. I use mingw msys as my command interpreter, and very often it will mangle my paths and pathnames. For example, to build my program, I invoke

arm-none-linux-gnueabi-gcc.exe -Wall -g \
    -Wl,--dynamic-linker=/usr/lib/myrpath/ld-linux.so.3 \
    -Wl,-rpath=/usr/lib/myrpath \
    -I../targetsysroot/usr/include \
    myprogram.c -o myprogram

当然,我想将 / usr / lib / myrpath 逐字地插入到 myprogram 可执行文件中 - ARM linux我正在编译的目标不使用mingw或msys。但是这里有个结果:

Of course, I want /usr/lib/myrpath inserted verbatim into the myprogram executable - the ARM linux target I'm compiling for doesn't use mingw or msys. But here's what ends up going into it:

...
0x0000000f (RPATH)            Library rpath: [C:/MinGW/msys/1.0/lib/myrpath]
...

我想了。如果我直接在cmd.exe命令行上调用gcc,我会在可执行文件中获得正确的rpath。如果我在msys命令行上调用gcc,我会得到损坏的rpath。如果我使用cmd.exe命令行中的make运行的Makefile调用gcc,我仍然得到一个损坏的rpath(!)

Not exactly what I wanted. If I invoke gcc on the cmd.exe command line directly, I get the right rpath in the executable. If I invoke gcc on the msys command line, I get the mangled rpath. If I invoke gcc with a Makefile that is run with make from the cmd.exe command line, I still get a mangled rpath (!)

任何想法我可能会转向关闭这种恼人的行为?

Any ideas how I might turn off this annoying behavior?

推荐答案

我不认为有办法切断它。 MSYS是旧版Cygwin版本的一个分支,其中一些调整旨在改进Windows集成,在调用本地Windows程序时自动进行POSIX路径转换可以说是最重要的。这样做的麻烦在于,不可能总是说出一个论点是一条道路还是别的什么东西,或者在这种情况下,它是否实际上是一条不应该被翻译的道路。翻译由启发式集指导。

I don't think there's a way to switch this off. MSYS is a fork of an old Cygwin version with a number of tweaks aimed at improved Windows integration, whereby the automatic POSIX path translation when invoking native Windows programs is arguably the most significant. The trouble with that is that it isn't always possible to tell whether an argument is a path or something else, or whether, as in this case, it is in fact a path that nevertheless shouldn't be translated. The translation is guided by a set of heuristics.

您可以尝试使用MinGW make而不是MSYS make(是的,它们是不同的东西),这是一个本地的Windows版本,没有POSIX路径支持和转换。使用>安装mingw-get install mingw32-make 并调用为 mingw32-make

You could try using MinGW make instead of MSYS make (yes, they're different things), which is a native Windows build of make without POSIX path support and conversion. Install with mingw-get install mingw32-make and invoke as mingw32-make.

或者您可以尝试使用Cygwin,最好使用工具链的Cygwin版本。

Or you could try Cygwin, ideally with a Cygwin build of the toolchain.

这篇关于如何阻止mingw和msys在命令行中输入的路径名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆