0

I'm still trying to build VTK on windows. I have installed Cygwin and I'm done configuring with CMake I think. However I'm facing the error that you can see on the screenshot below: the make command somehow tries to make through MS Visual Studio while I want to use the GNU make. I'm guessing this comes from either the makefile itself which could force that behaviour or from my Cygwin settings.

Thanks in advance for the help

enter image description here

Makefile content:

# 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

EDIT: make --version gives me:

 /usr/bin/make --version
GNU Make 4.0
Construit pour x86_64-pc-cygwin
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Licence GPLv3+ : GNU GPL version 3 ou ultérieure <http://gnu.org/licenses/gpl.html>
Ceci est un logiciel libre : vous êtes autorisé à le modifier et à la redistribuer.
Il ne comporte AUCUNE GARANTIE, dans la mesure de ce que permet la loi.

 type -a make
make est un alias vers « /usr/bin/make »
make est /usr/bin/make
make est /usr/bin/make
Etan Reisner
  • 77,877
  • 8
  • 106
  • 148
LBes
  • 3,366
  • 1
  • 32
  • 66
  • What does `/usr/bin/make --version` output? – Etan Reisner May 28 '15 at 18:52
  • I edit my post to show what make --version gives me – LBes May 28 '15 at 19:03
  • I didn't ask about `make --version`. I asked about `/usr/bin/make --version` (the way you ran it in the screenshot). Does that give the same output? What does `type -a make` output also? – Etan Reisner May 28 '15 at 19:07
  • Sorry about that. I edited the question – LBes May 28 '15 at 20:17
  • 1
    Oh!. That output you are seeing is `cmd.exe` starting and ending up at a prompt. If you type `exit` you should get back to the cygwin prompt. The question now is why is `cmd.exe` doing that exactly. – Etan Reisner May 28 '15 at 21:42
  • Well more than just cmd starting and ending I don't understand why and how visual studio make is called instead of gnu make. Could this be related to the environment variables (shell = cmd.exe) defined in the make ? Cause I'm guessing that cmd.exe will never execute gnu make but rather VS make ... What do you think ? – LBes May 28 '15 at 22:04
  • That's not a VS make message. That's just `cmd.exe`. Run `cmd.exe` manually and you'll see the same message displayed in the window. – Etan Reisner May 28 '15 at 22:21
  • Oh ! Right !! Then why on earth is it showing at all? I mean it should actually do something instead of just launching cmd.exe no? – LBes May 28 '15 at 22:26
  • That's what I said before. The question is what target is going wrong in make to cause that problem. You could try adding `-d` to the make command to see at what point it stops at cmd.exe. You could also try exiting the cmd.exe instance and seeing what happens next (does make continue from some point in the process). – Etan Reisner May 28 '15 at 22:27
  • Also why does a simple make without -f option does nothing while the make -f launched cmd.exe ... Doesn't make sense at all – LBes May 28 '15 at 22:28
  • Without `-f` make tries to read the [default makefile names](http://www.gnu.org/software/make/manual/make.html#Makefile-Names). Without those existing in the current directory make will do nothing (and tell you it can't do anything). With `-f` you tell it what makefile to use. The makefile you are picking contains something that is going wrong and causing this problem. – Etan Reisner May 28 '15 at 22:30
  • Oh ! So if I understood well there's something wrong with the Makefile that makes it somehow not directly usable without the -f option ? Weird thing is that this make file was generated with CMake so it should be alright ... – LBes May 28 '15 at 22:32
  • If you `cd` to that directory and run `make` you'll have the same problem. That makefile specifically is causing this problem. Other makefiles may/will not. It doesn't matter how you get make to use that makefile (implicitly by being in that directory or explicitly with `-f`) using that makefile will do this. – Etan Reisner May 28 '15 at 22:33
  • Ok I get it. Still don't know what could be wrong with this makefile though – LBes May 28 '15 at 22:34

1 Answers1

1

The problem with the makefile is explained in its second line:

# Generated by "MinGW Makefiles" Generator, CMake Version 3.2

The makefile you've generated is meant to be used with MinGW make not Cygwin make. The reason you see Windows command prompt (CMD) is because of this line:

SHELL = cmd.exe

This causes make to invoke all commands using cmd.exe as the shell. That's what's MinGW's make normally does anyways, but Cygwin's make expects to invoke a shell that takes Unix Bourne shell type arguments. The arguments end being ignored by cmd, which then behaves as if it was started without any.

You're either going to have rebuild the makefile so that's compatible with Cygwin or install MinGW and use that to compile it.

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
  • This is completely right. I re-run CMake using the correct generator (Unix) and now I have a compatible Makefile. Problem still is that I get now a The C compiler "C:/cygwin64/bin/cc" is not able to compile a simple test program. Maybe it comes from my cygwin environment – LBes May 29 '15 at 07:51
  • One possible reason is explained here: http://stackoverflow.com/questions/4101456/running-cmake-on-windows – LBes May 29 '15 at 08:09