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

Generator "NMake Makefiles" produces buggy Makefile(s) #5496

Closed
rwiesen opened this issue Oct 13, 2015 · 7 comments
Closed

Generator "NMake Makefiles" produces buggy Makefile(s) #5496

rwiesen opened this issue Oct 13, 2015 · 7 comments
Labels

Comments

@rwiesen
Copy link

rwiesen commented Oct 13, 2015

Platform: Windows (Windows 8.1 64bit, Visual Studio 2015 and Visual Studio 2010)
Version: 0d79118
CMake version: 3.3.2 (download)

Steps to reproduce:

  • checkout to directory opencv
  • create directory tmp as sibling of opencv
  • change to directory tmp
  • call 'cmake -G "NMake Makefiles" ..\opencv'
  • call 'nmake'

Expected behavior:

  • OpenCV is built

Observed behavior:

  • nmake stops with an error (translated: path not found):

    [ 2%] Linking C static library ..\lib\zlibd.lib
    Das System kann den angegebenen Pfad nicht finden.
    NMAKE : fatal error U1077: 'cd' : return code '0x1'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
    Stop.

This error is caused by a trailing backslash for a 'cd' command in the file "...\tmp\3rdparty\zlib\CMakeFiles\zlib.dir\build.make" (line 642 and others) that leads to lines being combined.

@StevenPuttemans
Copy link

Could you suggest a fix through a pull request? That will speed up the fixing!

@rwiesen
Copy link
Author

rwiesen commented Oct 13, 2015

No, unfortunately not, as I am an absolute beginner with CMake.

I can't even tell if the bug is in OpenCV or the CMake generator :-(

@alalek
Copy link
Member

alalek commented Oct 13, 2015

Try to use "Visual Studio" generators, they are faster than NMake (NMake provides poor support for parallel compilation).
You can refer to commands from our testing infrastructure:
http://pullrequest.opencv.org/buildbot/builders/precommit_windows64

@rwiesen
Copy link
Author

rwiesen commented Oct 13, 2015

Well, I know that the VS generator works - this is my current workaround... ;-)

Nevertheless, if "NMake Makefiles" is offered, it should work. I'd rather use nmake than devenv for automated builds.

@mshabunin
Copy link
Contributor

I think it is a cmake problem, similar issue has been mentioned here: https://cmake.org/pipermail/cmake/2015-September/061484.html

As a workaround you can try to turn CMAKE_USE_RELATIVE_PATHS option OFF (this option is forced to ON in opencv/CMakeLists.txt). But I'd recommend to use VS generator as we do for our automated builds.

@MarianMMX
Copy link

  1. Open CMakeLists.txt .
  2. Go to line 70.
  3. Comment (or delete):
    #if(MSVC)

    set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)

    #endif()
  4. delete the generated files and rerun cmake.

@happyLiMing
Copy link

I think it is a problem when you using the VC(cl.exe && nmake.exe).maybe there is some ENV you missed.

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

No branches or pull requests

6 participants