building ruby on windows 7 - ruby

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

Related

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

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

Setup correctly Qmake on Windows 10

My adventure in the world of QT and multi-platform continue, with another roadblock.
I am on Windows 10 now; I did install QT5 and I was able to run one of the examples, so I thought everything is fine. Instead, when trying to build PythonQt, I get an error from qmake:
Project ERROR: Cannot run compiler 'cl'. Maybe you forgot to setup the environment?
I thought myself; that there is something missing; although had no luck finding what the heck do I have to actually do to set up qmake. I did assume that when you install QT, everything get set up for you, but instead it seems that something is missing.
I am on W10, using the latest installer for Python 2.7 (it is working, since when I call python I get correctly the interpreter to launch); am I missing something else?
I had this same issue with Qt5.9.1 and VS2015. I fixed this by editing "C:\Qt\Qt5.9.1\5.9.1\msvc2015\bin\qtenv2.bat" file. I added below 2 lines.
call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
Start "" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"
And then run the "Qt 5.9.1 32-bit for Desktop (MSVC 2015)" ( or 64 bit depends on your choice.).
This would set the environment before running the qmake.
Calling the vcvarsall.bat fixed my issue.
Adding to #PrimeOfKnights 's answer for the sake of completeness:
with VS2017 community, the location of vcvarsall.bat is
/c/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsall.bat
In qtenv2.bat, it actually says:
echo Remember to call vcvarsall.bat to complete environment setup!

How to Compile Ruby on Windows?

linking miniruby.exe
win32.obj : error LNK2001: unresolved external symbol __imp____pioinfo
miniruby.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.rel
This is the error in cmd while compiling the package using Development cmd for VS2015.
What is wrong?
I ran into the same error (minus some printed output differences) when trying to compile Ruby 2.5.1 on Windows using Visual Studio 2015 Express. I thought that all I needed to do was to add the bin directory to my PATH. So I did this and then tried building but I failed:
$> cd <path_to_ruby_download>
$> set PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;%PATH%
$> win32\configure.bat
I was able to get past this problem thanks to some insight from this attempt. The main hint (from jules_a) is:
Looks like cl.exe cannot be found. You should use vcvarsall.bat to
configure your path properly.
I tried searching for this vcvarsall batch file but couldn't find it in my Visual Studio installation directory. However, thanks to this article, I found another way. Turns out that all I needed to do was to build from a developer console.
On my computer, I could start this dev console by going to Start -> All Programs -> Visual Studio 2015 -> Visual Studio Tools -> Developer Command Prompt for VS2015. Alternatively, you can launch VsDevCmd.bat, located in Common7\Tools\ directory of your Visual Studio installation.
And then everything worked! Note that I did not need to bother with RubyInstaller or any of that jazz!
You want to compile it or install it? Because you don't need to compile it if you just want to install it. Check the binaries
http://rubyinstaller.org/
For downloading ruby
I am not sure if you still need the answer, I also see that rubyinstaller does not have new ruby release also. After asking around for a while I found that they are posting new release at github. I downloaded 2.4.1 and it work for me.
https://github.com/oneclick/rubyinstaller2/releases
For compiling ruby
Please read this link so you will have info. they change to use msys2 and mingw now
https://github.com/oneclick/rubyinstaller2/

Linking errors with boost, VS2010, and CMake

I have searched high and low for this answer. I have tried suggestions to similar problems posted on Stack and other sites. My toolchain consists of an x64 machine with windows 7, visual studio 2010, opencv 2.4, qt 4.8, and boost. I configure all of my projects using CMake, which finds all of these libraries and includes and creates my visual studio project. I have compiled two versions of boost, a 32-bit version build in the command line and placed in \boost\boost_1_47_0\lib\win32, and a 64-bit compiled in the Windows SDK v7.1 64-bit compiler and stored in \boost\boost_1_47_0\lib\x64. Everything in the project compiles fine with the exception of boost. I get a compiler error:
fatal error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-1_47.lib'
As a reminder, CMake is handling all of my linking and it properly locates this lib and adds it to the visual studio project. I can verify this by looking at Properties->Linker->Command Line. Here, in addition to files representing other libraries, it has listed:
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_filesystem-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_program_options-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_date_time-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_thread-vc100-mt-1_47.lib"
I can suppress this error by manually adding my boost\boost_1_47_0\lib\x64 directory to Properties->Linker->General->Additional Library Dependencies. This compiles without error. However, when I go to run the application, I am met with a system error that tells me:
The program can't start because boost_filesystem-vc100-mt-1_47.dll is missing from your computer. Try reinstalling the program to fix this problem.
In this /x64 directory I have:
boost_filesystem-vc100-mt-1_47.dll
boost_filesystem-vc100-mt-1_47.lib
libboost_filesystem-vc-100-mt-1_47.dll
Any insight would be incredibly appreciated. Thanks!
To solve the runtime error:
Add the location of the dll(s) to the PATH environment variable.
For example on my machine:
set PATH=%PATH%;c:\users\chris\boost_regex-vc140.1.63.0.0\lib\native\address-model-32\lib
or copy the dll(s) to a directory already in the PATH
See here: https://msdn.microsoft.com/en-us/library/7d83bc18.aspx?f=255&MSPPError=-2147217396

Building Opensource Qt for Visual Studio 2005/2008

Does anyone have instructions on building the opensource version of Qt? Now that the repository is opened up, I'm trying to build for VS2008 but I'm getting errors when it tries to build qmake.
I found the question I'm looking to use Visual Studio to write and compile using the open source version of Qt4 but this information is out of date, and doesn't really help me. For reference, here's what happens when I try to build with configure -platform win32-msvc2008
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
cl -c -Foproject.obj -W3 -nologo -O2 -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -
IC:\dev\open_source\qt\include -IC:\dev\open_source\qt\include\QtCore -IC:\dev\open_source\qt\include -IC:\dev\open_sou
rce\qt\include\QtCore -IC:\dev\open_source\qt\src\corelib\global -IC:\dev\open_source\qt\include\QtScript -IC:\dev\op
en_source\qt\mkspecs\win32-msvc2008 -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL
-DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D
QT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED -DQMAKE_OPENSOURCE_EDITION project.cpp
project.cpp
c:\dev\open_source\qt\src\corelib\tools\qstringlist.h(45) : fatal error C1083: Cannot open include file: 'QtCore/qalgori
thms.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
Building qmake failed, return code 2
Well, one helpful thing is to run configure inside the Visual Studio Command Prompt. That should be available in the Visual Studio start menu group under Visual Studio Tools.
Also now when you run configure you don't have to specify target platform, because it will be set as an environment variable by the VS Command Prompt.
I got errors from configure and nmake when I did not use the VS Command Prompt, and since switching I have not had any issues.
So the simple instructions would be:
1) open VS command prompt
2) navigate to qt folder where configure.exe is located
3) configure
4) nmake
Please, ensure that you have ActiveState Perl installed
This blog article seems to have more recent information on building Qt with visual studio. Hope it helps.
Note that Nokia, as of Qt 4.6, is now providing their own open source VS builds of Qt, so it is no longer necessary to build from source yourself to do development with Visual Studio. Access their open source download page, and look for builds named (e.g.) qt-win-opensource-4.6.1-vs2008.exe.
Also, if you simply want to compile with MSVC so you can develop with the open source libraries with visual studio, I put together a project to provide "pre-built" Qt LGPL libraries with MSVC 2008.
It might be helpfull and has the advantages of taking up less space then compiling it yourself. It also provides a command prompt with all your environment variables set up for you and a link to launch Visual Studio with a Qt environment. It's called qt-msvc-installer.
What user156973 said. Install ActiveState perl and run configure again.

Resources