Installing and using IPopt with Cygwin - or even better alternative? - compilation

I am new to the optimization field. Did some projects with fmincon though, and am now looking for an alternative usable in OpenSource, preferrably somehow usable in Python. Therefore I found IPopt. Any other suggestions which are equally good as fmincon?
I tried to install IPopt by compiling it. And I must say, it seems like a mess. I tried all version and ended up with the most promising one "Installation with Cygwin using the MSVC++ compiler " from the Manual. Therefore I have to install CYGwin and change the make.exe. Done.
Add the cl.exe from Visual Studio (Visual Studio 1 in my case) to the Apth environment. Done.
add "call "call "C:\Program Files (x86)\Microsoft Visual Studio 14\VC\vcvarsall.bat" " to the cygwin.bat. Done.
Now two things. When I do "./configure" with the downloaded IPopt sources I get: "configure: error: /bin/sh './configure' failed for Ipopt"
Also like suggested in the manual calling "./configure -enable-doscompile=msvc" to tell cygwin to use the windows compiler gives me "configure: error: --enable-doscompile=mscv not supported anymore."
So. Basically I am not able to install Ipopt. Using it seem like impossible, as all other methods to build it also failed on my Win10 64bit. It seems that the manual is outdated or I am not finding the corect way to do it, hope some of u guys probably can help. Compiling is something rather new and I am happy to learn.
Tahnks in advance.

Ensure that you have the following packages installed in Cygwin.
Devel: gcc
Devel: gfortran
Devel: pkg-config
Devel: subversion
Archive: unzip
Utils: patch
Web: wget
Utils: dos2unix
Assuming you are building for 64-bit, add path to cl.exe in Cygwin.bat (located in root directory of location where Cygwin was installed) so that msvc can be used from Cygwin –
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat" (vcvarsall needs you to specify architecture version)
You will need the Intel Fortran Compiler. It comes along with Parallel Studio. Free for students, faculty, open source contributors.
In .bash_profile (located in pathto/cygwin64/home/username/) add this line so that ifort recognizes msvc linker (path given above should be to link.exe of msvc) –
alias ifort='ifort -Qlocation,link,"C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64"'
Intel Fortran gets integrated to a visual studio shell. Run this shell. Execute cygwin.bat from this shell. Check the version of link (link --version). If it is not the microsoft linker, you may have to remove the Cygwin link.exe file from Cygwin folder.
Note that any other bash terminals (e.g. Git Bash) might interfere. You will come to know only while running the configure script. It tries to access packages from those bash terminals. You may have to place them elsewhere temporarily, so cygwin does not find them.
I understand you have read the manual, so you must have downloaded the required third-party tools for Ipopt (asl, lapck, blas and one linear solver) .
You can now run (in Ipopt root folder):
mkdir build
cd build
../configure --enable-msvc=MD
make
make install

Related

Can I compile mingw programs using the mingw folder in msvs 2017

So I was trying to compile Nethack but I don't want to install minGW through Sourceforge because I am not sure if it is safe because There seems to be contradictory information on whether it is safe or not.I came across this folder in msvs 2017 15.5.1 "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32" can I use this in place of "C:\mingw"? in a batch file the file in which I want to use it in contains the code
PATH=c:\mingw\bin
cd src
mingw32-make -f makefile.gcc install
I just don't want to do anything wrong and mess up my computer.

What is the -D define to tell CMake where to find nmake?

I have Visual C++ Build Tools 2015 | Standalone compiler, libraries and scripts installed on a low-end netbook. It's necessary, because the machine has a small eMMC soldered to the board with no real space available.
nmake is installed at %PROGRAM FILES%\Microsoft Visual Studio 14.0\VC\bin. However, CMake cannot find it when attempting to generate the Makefile. I'd like to use a -D to tell CMake what the makefile program is, but I am having trouble locating the list of -D defines for CMake.
For completeness, I'm trying to avoid other Microsoft tools. I have LLVM build tools at C:\LLVM\bin, so I'm setting CMAKE_C_COMPILER and CMAKE_CXX_COMPILER. But I needed nmake, because I can't find a stand-alone Make program for Windows already built.
What is the -D define to specify nmake for CMake?
The variable you are looking for is CMAKE_MAKE_PROGRAM.
If you try to set this variable plus CMAKE_C_COMPILER, CMAKE_LINKER_EXE, etc., this will still fail, because cl.exe and link.exe need some environment variables to be set. Those can be set by using a "Visual Studio * Command Prompt" (this uses vcvars.bat from the Visual Studio install directory).
To use Clang you can install a Clang toolset from http://llvm.org/builds/. Then you can specify CMAKE_GENERATOR_TOOLSET in a toolchain file.
Let me know how this works out for you.
CMAKE_MAKE_PROGRAM. See the documentation:

CMake and Visual Studio with not default installation folder

I am trying to build something using CMake and VS 2012. The problem is I have my VS installation on D:\Pliki programów (x86)\Microsoft Visual Studio 11.0. I have no free space on my C drive.
CMake have problem with finding my VS. I tried to specify VS compiler cl.exe but it was asking for dll in the same folder anyway. I also tried to use specified toolchaing with vcvarsall.bat. But I am not sure if I am doing those things right.
I guess that I need to add VS location to CMake, but how? I tried setting PATH but it did not work.
And searching about that problem is difficult, all search engines think that I want to change installation path for my program that I want to build.
UPDATE
I've added variable_watch(CMAKE_MAKE_PROGRAM).
CMake Debug Log at CMakeLists.txt:3 (project):
Variable "CMAKE_MAKE_PROGRAM" was accessed using UNKNOWN_READ_ACCESS with
value .
CMake Debug Log at CMakeLists.txt:3 (project):
Variable "CMAKE_MAKE_PROGRAM" was accessed using MODIFIED_ACCESS with value
C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe.
The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_C_COMPILER could be found.
In output file:
LINK : fatal error LNK1104: cannot open file 'MSVCRTD.lib'
Is CMake looking for libs in VS 11 installation folder? The thing is that VS installer put libs in C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\amd64.
For cases like this (and similar), I keep a VCEnvCmd.bat in my source trees:
call "%VS110COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64 & %*
Executing that .bat without parameters will find and run vcvarsall.bat, setting up the environment for the amd64 target in the current shell (which you could change or parameterize according to your needs, like the version number embedded in that environment variable).
The nice trick is, for those Nightly / Continuous builds, you can use the .bat as a "prefix" for setting up the environment, e.g. in the task manager:
VCEnvCmd.bat ctest -S CTestScript.cmake,Nightly
The advantage is that you use what MSVC already gives you (the VS...COMNTOOLS variable), without having to clutter your environment further with persistent changes to PATH etc.

Compile CUDA without Visual Studio - "Cannot find compiler cl.exe in path"

I've just begun a small project in CUDA.
I need to know the following:
Is it possible to compile CUDA code without using/buying Microsoft Visual Studio?
Using Nvcc.exe I get the error "Cannot find compiler cl.exe in path".
I've tried to install a CUDA plugin for NetBeans, but it doesn't work. (with current version of NetBeans)
Platform: Windows 7
Thanks in advance.
Update
As noted in the comments, versions of the SDK after Windows 7's do not include the build tools. If you want to use Microsoft's most recent tools you have to install Visual Studio. Once installed, you can use the tools from the command-line.
At the moment the free versions are the "Community" versions, e.g. Microsoft Visual Studio Community 2015.
You can continue to develop apps for Windows 7 and earlier (and they will run on later versions of Windows) using the old SDK tools as I described before:
Original Answer
If you desperately want to avoid Visual Studio, download and install the Windows SDK. This contains (more or less) the same build tools as Visual Studio.
Then run the Windows SDK Command Prompt (which you'll find on the start menu under Microsoft Windows SDK) to set the path to point to the tools, and you are set.
Or just use Visual C++ Express.
Following the previous comments I've installed Studio Express & VS2010.
This did not solve the "cl.exe not in path" problem.
I solved the problem with the error Cannot find compiler cl.exe in path, by including
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 in PATH,
before installing Windows SDK.
This question also contains valuable information.
For some reason VS2010 & Studio Express failed to set the proper variables in path even after the execution of vsvars32.bat.
Thank you all for your valuable help.
add this options to nvcc
nvcc x.cu <other options> -ccbin "D:\Program Files\Microsoft Visual Studio 11.0\VC\bin"
i use VS2012 and my cl.exe dir is here.
You have to figure out where NVIDIA GPU Computing Toolkit is installed.
In my system it's in "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" Then
"Edit Environment Variables" on Windows.
Click on New...
Variable name: NVCC
Variable Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe
Click on OK.
Use windows subsystem for linux and install ubuntu and nvcc along with gcc and g++ using the ubuntu terminal in windows (gui does not works for linux subsystem for windows). Then configure .bashrc using bash and vim/nano with a 'cd' command to your desired location as it is done in usual linux terminal (makes it easy as bash opens in system32 folder everytime). And then you can compile .cu files using nvcc over bash. As nvcc supports gcc and g++ under linux so it solves the problem. No need to sacrifice peace for switching over to linux or dealing with crappy visual studio. It worked for me.

building ruby on windows 7

I know this has been asked before but I ran into a specific problem.
I'm trying to build ruby 1.9.2 rc2 on windows 7. When I run configure.bat it aborts with the following message.
cl -nologo -MD rtname.c user32.lib -link > nul
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
I find that the file 'rtname.c' does not exist anywhere within the source files. And this is why cl aborts.
I'm totally clueless as to what to do next. Searching for rtname.c on google doesn't return anything.
The first thing you have to do on windows is make sure your have some version of Visual studio C++ express edition installed. The latest version can be downloaded here
Next, you need to run the following file from the command line:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat
This configures your path environmental variable to allow the command prompt (and other programs) to find cl.exe. After doing this, running configure.bat should work correctly. This will build a 32-bit version of Ruby.
Maybe Visual Studio is required in your case to build Ruby from sources on Windows, but why don't you use RubyInstaller instead? It is a nice build environment; you can compile any version of Ruby on your machine, even from TRUNK.
If I understand it correctly you must have the C++ compiler installed to build Ruby. Could it be that you are missing that?
The RubyInstaller is quite stable and works most times.
I found that having already installed ruby on the box helps, see http://blog.cyplo.net/2011/01/01/compiling-ruby-1-9-2-windows/ , hope that helps

Resources