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

Error building nlopt:x64-windows #3201

Closed
friente opened this issue Apr 4, 2018 · 10 comments
Closed

Error building nlopt:x64-windows #3201

friente opened this issue Apr 4, 2018 · 10 comments
Assignees
Labels
requires:repro The issue is not currently repro-able

Comments

@friente
Copy link

friente commented Apr 4, 2018

I just tried to install shogun with vcpkg but I get the following build error:

Error: Building package nlopt:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: nlopt:x64-windows
  Vcpkg version: 0.0.107-2018-04-03-599aea98c9a2ef587fd9deacdfcf64dfa2e3c4db

I'm using msvc 2015 x64 with the latest portfiles.
Someone can help me solving this issue?

@MVoz
Copy link
Contributor

MVoz commented Apr 5, 2018

See logs for more information:

Additionally, attach any relevant sections from the log files above.

@ahhz
Copy link

ahhz commented May 30, 2018

I encounter the same problem, and get messages shown below. It seems that there is some bad interaction with MATLAB. NLopt:x86-windows does install, but have not tried using it yet.

-- Build x64-windows-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:44 (message):
    Command failed: C:/Users/ah0038/development/github/vcpkg/downloads/cmake-3.1
0.0-win32-x86/bin/cmake.exe;--build;.;--config;Release;--target;install;--;-v
    Working Directory: C:/Users/ah0038/development/github/vcpkg/buildtrees/nlopt
/x64-windows-rel
    See logs for more information:
      C:\Users\ah0038\development\github\vcpkg\buildtrees\nlopt\install-x64-wind
ows-rel-out.log
      C:\Users\ah0038\development\github\vcpkg\buildtrees\nlopt\install-x64-wind
ows-rel-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_build_cmake.cmake:63 (vcpkg_execute_required_process)
  scripts/cmake/vcpkg_install_cmake.cmake:24 (vcpkg_build_cmake)
  ports/nlopt/portfile.cmake:22 (vcpkg_install_cmake)
  scripts/ports.cmake:72 (include)

The log file install-x64-windows-rel-err.log is empty.
The log file install-x64-windows-rel-out.log contains the following:

   Creating library nlopt.lib and object nlopt.exp
[45/47] cmd.exe /C "cmd.exe /C "C:\Users\ah0038\development\github\vcpkg\downloads\cmake-3.10.0-win32-x86\bin\cmake.exe -E __create_def C:\Users\ah0038\development\github\vcpkg\buildtrees\nlopt\x64-windows-rel\octave\CMakeFiles\nlopt_optimize-mex.dir\exports.def C:\Users\ah0038\development\github\vcpkg\buildtrees\nlopt\x64-windows-rel\octave\CMakeFiles\nlopt_optimize-mex.dir\exports.def.objs && cd C:\Users\ah0038\development\github\vcpkg\buildtrees\nlopt\x64-windows-rel" && C:\Users\ah0038\development\github\vcpkg\downloads\cmake-3.10.0-win32-x86\bin\cmake.exe -E vs_link_dll --intdir=octave\CMakeFiles\nlopt_optimize-mex.dir --manifests  -- C:\PROGRA~2\MIB055~1\2017\ENTERP~1\VC\Tools\MSVC\1410~1.250\bin\HostX64\x64\link.exe  octave\CMakeFiles\nlopt_optimize-mex.dir\nlopt_optimize-mex.c.obj  /out:octave\nlopt_optimize.mexw64 /implib:octave\nlopt_optimize.lib /pdb:octave\nlopt_optimize.pdb /dll /version:0.0 /machine:x64 /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF  /DEF:octave\CMakeFiles\nlopt_optimize-mex.dir\exports.def  "C:\Program Files\MATLAB\R2017a\extern\lib\win64\microsoft\libmex.lib" nlopt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
FAILED: octave/nlopt_optimize.mexw64 octave/nlopt_optimize.lib 
cmd.exe /C "cmd.exe /C "C:\Users\ah0038\development\github\vcpkg\downloads\cmake-3.10.0-win32-x86\bin\cmake.exe -E __create_def C:\Users\ah0038\development\github\vcpkg\buildtrees\nlopt\x64-windows-rel\octave\CMakeFiles\nlopt_optimize-mex.dir\exports.def C:\Users\ah0038\development\github\vcpkg\buildtrees\nlopt\x64-windows-rel\octave\CMakeFiles\nlopt_optimize-mex.dir\exports.def.objs && cd C:\Users\ah0038\development\github\vcpkg\buildtrees\nlopt\x64-windows-rel" && C:\Users\ah0038\development\github\vcpkg\downloads\cmake-3.10.0-win32-x86\bin\cmake.exe -E vs_link_dll --intdir=octave\CMakeFiles\nlopt_optimize-mex.dir --manifests  -- C:\PROGRA~2\MIB055~1\2017\ENTERP~1\VC\Tools\MSVC\1410~1.250\bin\HostX64\x64\link.exe  octave\CMakeFiles\nlopt_optimize-mex.dir\nlopt_optimize-mex.c.obj  /out:octave\nlopt_optimize.mexw64 /implib:octave\nlopt_optimize.lib /pdb:octave\nlopt_optimize.pdb /dll /version:0.0 /machine:x64 /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF  /DEF:octave\CMakeFiles\nlopt_optimize-mex.dir\exports.def  "C:\Program Files\MATLAB\R2017a\extern\lib\win64\microsoft\libmex.lib" nlopt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
LINK: command "C:\PROGRA~2\MIB055~1\2017\ENTERP~1\VC\Tools\MSVC\1410~1.250\bin\HostX64\x64\link.exe octave\CMakeFiles\nlopt_optimize-mex.dir\nlopt_optimize-mex.c.obj /out:octave\nlopt_optimize.mexw64 /implib:octave\nlopt_optimize.lib /pdb:octave\nlopt_optimize.pdb /dll /version:0.0 /machine:x64 /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF /DEF:octave\CMakeFiles\nlopt_optimize-mex.dir\exports.def C:\Program Files\MATLAB\R2017a\extern\lib\win64\microsoft\libmex.lib nlopt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:octave\nlopt_optimize.mexw64.manifest" failed (exit code 1120) with the following output:
Microsoft (R) Incremental Linker Version 14.10.25019.0
Copyright (C) Microsoft Corporation.  All rights reserved.

nlopt_optimize-mex.c.obj : warning LNK4197: export 'mexFunction' specified multiple times; using first specification
   Creating library octave\nlopt_optimize.lib and object octave\nlopt_optimize.exp
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxCalloc referenced in function make_opt
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxFree referenced in function make_opt
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxGetM referenced in function make_opt
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxGetCell_730 referenced in function mexFunction
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxIsNumeric referenced in function make_opt
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxIsCell referenced in function mexFunction
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxIsChar referenced in function mexFunction
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxIsStruct referenced in function make_opt
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxIsFunctionHandle referenced in function mexFunction
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxIsComplex referenced in function make_opt
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxIsDouble referenced in function mexFunction
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxGetPr referenced in function mexFunction
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxGetScalar referenced in function make_opt
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxGetN referenced in function make_opt
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxGetField_730 referenced in function make_opt
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxDestroyArray referenced in function mexFunction
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxCreateDoubleMatrix_730 referenced in function mexFunction
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxGetString_730 referenced in function mexFunction
nlopt_optimize-mex.c.obj : error LNK2019: unresolved external symbol mxIsNaN referenced in function user_function
octave\nlopt_optimize.mexw64 : fatal error LNK1120: 19 unresolved externals
[46/47] cmd.exe /C "cd . && C:\Users\ah0038\development\github\vcpkg\downloads\cmake-3.10.0-win32-x86\bin\cmake.exe -E vs_link_exe --intdir=test\CMakeFiles\testopt.dir --manifests  -- C:\PROGRA~2\MIB055~1\2017\ENTERP~1\VC\Tools\MSVC\1410~1.250\bin\HostX64\x64\link.exe  test\CMakeFiles\testopt.dir\testfuncs.c.obj test\CMakeFiles\testopt.dir\testopt.c.obj test\CMakeFiles\testopt.dir\__\util\timer.c.obj test\CMakeFiles\testopt.dir\__\util\mt19937ar.c.obj test\CMakeFiles\testopt.dir\__\util\nlopt-getopt.c.obj  /out:test\testopt.exe /implib:test\testopt.lib /pdb:test\testopt.pdb /version:0.0  /machine:x64 /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF  /subsystem:console  nlopt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
Microsoft (R) Incremental Linker Version 14.10.25019.0
Copyright (C) Microsoft Corporation.  All rights reserved.

ninja: build stopped: subcommand failed.

@MVoz
Copy link
Contributor

MVoz commented Jul 24, 2018

cd E:\tools\vcpkg\buildtrees\nlopt\x64-windows-static-rel

cmake -LA .

-- NLopt version 2.5.0
-- Could NOT find Guile (missing: GUILE_ROOT_DIR GUILE_INCLUDE_DIRS GUILE_LIBRARIES)
-- Could NOT find SWIG (missing: SWIG_DIR)
-- Could NOT find Octave (missing: OCTAVE_EXECUTABLE OCTAVE_ROOT_DIR OCTAVE_LIBRARIES)

BUILD_GUILE:BOOL=ON
BUILD_MATLAB:BOOL=ON
BUILD_OCTAVE:BOOL=ON
BUILD_PYTHON:BOOL=ON
...

edit E:\tools\vcpkg\ports\nlopt\portfile.cmake

vcpkg_configure_cmake(
    SOURCE_PATH ${SOURCE_PATH}
    PREFER_NINJA
	OPTIONS -DBUILD_OCTAVE:BOOL=OFF -DBUILD_GUILE:BOOL=OFF -DUSE_SWIG:BOOL=OFF -DBUILD_MATLAB:BOOL=OFF
)
BUILD_PYTHON:BOOL=OFF

octave

https://ftp.gnu.org/gnu/octave/windows/

@MVoz
Copy link
Contributor

MVoz commented Jul 24, 2018

master, BUILD_MATLAB:BOOL=ON, build ok

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO stevengj/nlopt
    REF 1226c1276dacf3687464c65eb165932281493a35
    SHA512 889f60cd6970b17296871396366bd0d868011d71ca4b88cb6da906283f928e5b443ab18c5af48a0701c8bf68b6d66288a3e4f248e0ab8183251aa7c3b0cfd652
    HEAD_REF master
)
//Path to a library.
Matlab_MEX_LIBRARY:FILEPATH=C:/Program Files/MATLAB/R2018a/extern/lib/win64/microsoft/libmex.lib

//Path to a library.
Matlab_MX_LIBRARY:FILEPATH=C:/Program Files/MATLAB/R2018a/extern/lib/win64/microsoft/libmx.lib

//Matlab installation root path
Matlab_ROOT_DIR:PATH=C:/Program Files/MATLAB/R2018a

@nicole9456
Copy link
Member

Dear customer,
I can't repro your issue on msvc 2017, could you have a double check for it? it you still repro it, could your give your detail environment.
Thanks very much!

@nicole9456 nicole9456 added the requires:repro The issue is not currently repro-able label Jan 29, 2019
@rjdmoore
Copy link

rjdmoore commented May 15, 2019

I also cannot build nlopt:x64-windows as of d112af9f.

-- Building x64-windows-dbg
CMake Error at scripts/cmake/vcpkg_build_cmake.cmake:202 (message):
Command failed: C:/path/to/vcpkg/downloads/tools/cmake-3.14.0-windows/cmake-3.14.0-win32-x86/bin/cmake.exe;--build;.;--config;Debug;--target;install;--;-v

And in install-x64-windows-dbg-out.log:

Creating library nlopt.lib and object nlopt.exp
[46/48] cmd.exe /C "cd . && C:\path\to\vcpkg\downloads\tools\cmake-3.14.0-windows\cmake-3.14.0-win32-x86\bin\cmake.exe -E vs_link_dll --intdir=src\octave\CMakeFiles\nlopt_optimize-mex.dir --rc=C:\PROGRA2\WI3CF21\10\bin\1001771.0\x64\rc.exe --mt=C:\PROGRA2\WI3CF21\10\bin\1001771.0\x64\mt.exe --manifests -- C:\PROGRA2\MICROS3\2017\PROFES1\VC\Tools\MSVC\14161.270\bin\Hostx64\x64\link.exe src\octave\CMakeFiles\nlopt_optimize-mex.dir\nlopt_optimize-mex.c.obj src\octave\CMakeFiles\nlopt_optimize-mex.dir\C_\Program_Files\MATLAB\R2018b\extern\version\c_mexapi_version.c.obj /out:src\octave\nlopt_optimize.mexw64 /implib:src\octave\nlopt_optimize.lib /pdb:src\octave\nlopt_optimize.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL /EXPORT:mexFunction /EXPORT:mexfilerequiredapiversion /EXPORT:mexCreateMexFunction /EXPORT:mexDestroyMexFunction /EXPORT:mexFunctionAdapter "C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libMatlabEngine.lib" "C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libMatlabDataArray.lib" "C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libmex.lib" "C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libmx.lib" nlopt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
FAILED: src/octave/nlopt_optimize.mexw64 src/octave/nlopt_optimize.lib
cmd.exe /C "cd . && C:\path\to\vcpkg\downloads\tools\cmake-3.14.0-windows\cmake-3.14.0-win32-x86\bin\cmake.exe -E vs_link_dll --intdir=src\octave\CMakeFiles\nlopt_optimize-mex.dir --rc=C:\PROGRA2\WI3CF21\10\bin\1001771.0\x64\rc.exe --mt=C:\PROGRA2\WI3CF21\10\bin\1001771.0\x64\mt.exe --manifests -- C:\PROGRA2\MICROS3\2017\PROFES1\VC\Tools\MSVC\14161.270\bin\Hostx64\x64\link.exe src\octave\CMakeFiles\nlopt_optimize-mex.dir\nlopt_optimize-mex.c.obj src\octave\CMakeFiles\nlopt_optimize-mex.dir\C_\Program_Files\MATLAB\R2018b\extern\version\c_mexapi_version.c.obj /out:src\octave\nlopt_optimize.mexw64 /implib:src\octave\nlopt_optimize.lib /pdb:src\octave\nlopt_optimize.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL /EXPORT:mexFunction /EXPORT:mexfilerequiredapiversion /EXPORT:mexCreateMexFunction /EXPORT:mexDestroyMexFunction /EXPORT:mexFunctionAdapter "C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libMatlabEngine.lib" "C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libMatlabDataArray.lib" "C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libmex.lib" "C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libmx.lib" nlopt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK Pass 1: command "C:\PROGRA2\MICROS3\2017\PROFES1\VC\Tools\MSVC\14161.270\bin\Hostx64\x64\link.exe src\octave\CMakeFiles\nlopt_optimize-mex.dir\nlopt_optimize-mex.c.obj src\octave\CMakeFiles\nlopt_optimize-mex.dir\C_\Program_Files\MATLAB\R2018b\extern\version\c_mexapi_version.c.obj /out:src\octave\nlopt_optimize.mexw64 /implib:src\octave\nlopt_optimize.lib /pdb:src\octave\nlopt_optimize.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL /EXPORT:mexFunction /EXPORT:mexfilerequiredapiversion /EXPORT:mexCreateMexFunction /EXPORT:mexDestroyMexFunction /EXPORT:mexFunctionAdapter C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libMatlabEngine.lib C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libMatlabDataArray.lib C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libmex.lib C:\Program Files\MATLAB\R2018b\extern\lib\win64\microsoft\libmx.lib nlopt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:src\octave\CMakeFiles\nlopt_optimize-mex.dir/intermediate.manifest src\octave\CMakeFiles\nlopt_optimize-mex.dir/manifest.res" failed (exit code 1120) with the following output:
Microsoft (R) Incremental Linker Version 14.16.27025.1
Copyright (C) Microsoft Corporation. All rights reserved.
LINK : error LNK2001: unresolved external symbol mexCreateMexFunction
LINK : error LNK2001: unresolved external symbol mexDestroyMexFunction
LINK : error LNK2001: unresolved external symbol mexFunctionAdapter
src\octave\nlopt_optimize.lib : fatal error LNK1120: 3 unresolved externals

I found the workaround was to add the line
OPTIONS -DNLOPT_MATLAB:BOOL=OFF
to vcpkg_configure_cmake() in nlopt\portfile.cmake.

@Neumann-A
Copy link
Contributor

Neumann-A commented May 23, 2019

Seems like a nlopt-MATLAB issue. I have a similar problem building nlopt

install-x64-windows-dbg-out.log

and here a config log with alot of extra debug messages added by #5543
config-x64-windows-out.log

@PhoebeHui
Copy link
Contributor

Related CMake issue https://gitlab.kitware.com/cmake/cmake/issues/19382

@MVoz
Copy link
Contributor

MVoz commented Sep 29, 2019

NLOPT_MATLAB:BOOL=ON or BUILD_MATLAB:BOOL=ON
?
static ok
dynamic fail

@PhoebeHui
Copy link
Contributor

Currently CMake has upgrade to 3.17, and I still can't repro this issue, if it is still an issue, please reopen.

PS F:\vcpkg\src> ./vcpkg install nlopt:x64-windows
Your feedback is important to improve Vcpkg! Please take 3 minutes to complete our survey by running: vcpkg contact --survey
Computing installation plan...
The following packages will be built and installed:
nlopt[core]:x64-windows
Starting package 1/1: nlopt:x64-windows
Building package nlopt[core]:x64-windows...
-- Downloading https://github.com/stevengj/nlopt/archive/v2.6.2.tar.gz...
-- Extracting source F:/VCPKG/src/downloads/stevengj-nlopt-v2.6.2.tar.gz
-- Applying patch 0001-suppress-MS-compiler-complaint-about-negating-unsign.patch
-- Using source at F:/VCPKG/src/buildtrees/nlopt/src/v2.6.2-bc7e55406b
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
-- Installing: F:/VCPKG/src/packages/nlopt_x64-windows/share/nlopt/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package nlopt[core]:x64-windows... done
Installing package nlopt[core]:x64-windows...
Installing package nlopt[core]:x64-windows... done
Elapsed time for package nlopt:x64-windows: 43.15 s

Total elapsed time: 43.35 s

The package nlopt:x64-windows provides CMake targets:

find_package(NLopt CONFIG REQUIRED)
target_link_libraries(main PRIVATE NLopt::nlopt)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires:repro The issue is not currently repro-able
Projects
None yet
Development

No branches or pull requests

7 participants