用 Cygwin 制作

make with Cygwin

我正在尝试在 windows 上设置 VTK(我说过它很复杂吗?^^)。 我已经使用 CMake 成功配置了 VTK,我现在正尝试通过 cygwin 运行 make。但是,当我转到构建目录并输入 make all the terminal prints 并且执行的是:

make

Microsoft Windows [version 6.3.9600]

(c) 2013 Microsoft Corporation. All rights reserved.

有人知道怎么回事吗?

编辑:输入 cygcheck 时 我得到:

Cygwin Package Information
Package              Version        Status
make                 4.0-2           OK

编辑 2:这是我得到的屏幕截图(抱歉是法语)

在此先感谢您提供的任何帮助:)

编辑 3:新截图 + Makefile 内容

Makefile 内容:

# CMAKE generated file: DO NOT EDIT!
# Generated by "MinGW Makefiles" Generator, CMake Version 3.2

# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target

# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:

    #=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =

.SUFFIXES: .hpux_make_needs_suffix_list

# Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force:
.PHONY : cmake_force

    #=============================================================================
# Set environment variables for the build.

SHELL = cmd.exe

# The CMake executable.
CMAKE_COMMAND = "C:\Program Files (x86)\CMake\bin\cmake.exe"

# The command to remove a file.
RM = "C:\Program Files (x86)\CMake\bin\cmake.exe" -E remove -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = C:\Users\Lonni\VTK\VTK-6.2.0

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = C:\Users\Lonni\VTK\Build1

    #=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running         CMake cache editor..."
    "C:\Program Files (x86)\CMake\bin\cmake-gui.exe" -H$(CMAKE_SOURCE_DIR) -    B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast

# Special rule for the target rebuild_cache
rebuild_cache:
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running     CMake to regenerate build system..."
    "C:\Program Files (x86)\CMake\bin\cmake.exe" -H$(CMAKE_SOURCE_DIR) -    B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast

# The main all target
all: cmake_check_build_system
    $(CMAKE_COMMAND) -E cmake_progress_start     C:\Users\Lonni\VTK\Build1\CMakeFiles     C:\Users\Lonni\VTK\Build1\CMakeFiles\progress.marks
    $(MAKE) -f CMakeFiles\Makefile2 all
    $(CMAKE_COMMAND) -E cmake_progress_start     C:\Users\Lonni\VTK\Build1\CMakeFiles 0
.PHONY : all

# The main clean target
clean:
    $(MAKE) -f CMakeFiles\Makefile2 clean
.PHONY : clean

# The main clean target
clean/fast: clean
.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
    $(MAKE) -f CMakeFiles\Makefile2 preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
    $(MAKE) -f CMakeFiles\Makefile2 preinstall
.PHONY : preinstall/fast

# clear depends
depend:
    $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-    build-system CMakeFiles\Makefile.cmake 1
.PHONY : depend

#=============================================================================
# Target rules for targets named vtk-android

# Build rule for target.
vtk-android: cmake_check_build_system
    $(MAKE) -f CMakeFiles\Makefile2 vtk-android
.PHONY : vtk-android

# fast build rule for target.
vtk-android/fast:
    $(MAKE) -f CMakeFiles\vtk-android.dir\build.make CMakeFiles/vtk-    android.dir/build
.PHONY : vtk-android/fast

#=============================================================================
# Target rules for targets named vtk-compile-tools

# Build rule for target.
vtk-compile-tools: cmake_check_build_system
    $(MAKE) -f CMakeFiles\Makefile2 vtk-compile-tools
.PHONY : vtk-compile-tools

# fast build rule for target.
vtk-compile-tools/fast:
    $(MAKE) -f CMakeFiles\vtk-compile-tools.dir\build.make CMakeFiles/vtk-    compile-tools.dir/build
.PHONY : vtk-compile-tools/fast

# Help Target
help:
    @echo The following are some of the valid targets for this Makefile:
    @echo ... all (the default if no target is provided)
    @echo ... clean
    @echo ... depend
    @echo ... vtk-android
    @echo ... edit_cache
    @echo ... rebuild_cache
    @echo ... vtk-compile-tools
.PHONY : help



#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
    $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-    build-system CMakeFiles\Makefile.cmake 0
.PHONY : cmake_check_build_system

Cygwin 的默认安装是 quite minimal。它不包括 GNU make,因此您得到的是 Microsoft 的 make.

您需要重新运行 Cygwin 的setup-*.exe 并添加make。很有可能,您可能还需要其他东西。我建议打开 Devel 类别并在其中扫描内容。


编辑,在问题中添加截图后:

您的屏幕截图显示出一些混淆。我将一一浏览它们,在每种情况下都引用文本:

Pas de cible spécifiée et aucun makefile n'a été trouvé

英文,就是"No targets specified and no makefile found."这告诉你GNU make已经安装并且运行ning了,但是你没有一个叫GNUmakefile,[=15的文件=], 或 Makefile 在当前目录中。它按顺序搜索这三个。

这并不奇怪,因为 ls 表明您正在 运行 将它放在一个空目录中。

/cygdrive/c/MinGW/bin/make

这里有两个问题:

  1. 正如我在评论中所说,只有链接到 cygwin1.dll 的程序才能理解 /cygdrive。 Windows' cmd.exe 不知道 /cygdrive 是什么意思。 c:\MinGW\bin\makecmd.exe下的正确形式。

  2. MinGW 不是 Cygwin。您在使用 MinGW 时遇到的任何问题都是一个完全独立的问题,与您在使用 Cygwin 的 GNU make 包时遇到的问题无关。

/usr/bin/make

这与上一项类似:cmd.exe 不知道如何处理 POSIX 路径。因为 Windows' 文件路径解析代码 有时 将正斜杠视为与反斜杠相同,在这种情况下这被解释为 c:\usr\bin\make,但几乎可以肯定没有 c:\usr 目录。

此路径在左侧屏幕截图中起作用的原因是 Cygwin 将您的 Cygwin 安装目录(例如 c:\cygwinc:\cygwin64,默认情况下)挂载为 POSIX 根目录,因此c:\cygwin\usr 对于链接到 cygwin1.dll 且使用 POSIX API(例如 open(2))的任何程序都显示为 /usr。如您所示,这包括 Cygwin 版本的 GNU bash

您不应该在 Cygwin 终端 window 中要求显式路径,因为 /usr/bin 应该在 PATH 中的任何其他内容之前。如果不是这种情况,您可能没有使用 setup.exe 创建的 Cygwin 图标,在这种情况下您没有正确的登录 shell。要么使用该图标,要么通过调用 mintty - 来模仿它的作用,而不仅仅是普通的 mintty.