How do I make visual studio 2017 compiler, specifically cl.exe work with luarocks? - gcc

I tried to just find a lua rocks library made for lua 5.3 first of all so I come across mathx, I have no idea what this library really does I just wanted to test luarocks installation is working correctly. Everything seems to be working fine but what I believe now in windows by default it is currently looking for cl.exe, in visual studio 2017 I have this file located at:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\cl.exe
However setting this directory in the path does not allow me to initiate the command in eithe command prompt of 'cl'
When installing from lua command prompt:
C:\Users\MYNAMEHERE>luarocks install lmathx Installing luarocks.org/lmathx-20150624-1.src.rock cl /nologo /MD /O2 -c -Folmathx.obj -IC:/lua/include lmathx.c 'cl' is not recognised as an internal or external command, operable program or batch file.
Error: Build error: Failed compiling object lmathx.obj
When installing from visual studio 2017 command prompt:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>luarocks install lmathx Installing luarocks.org/lmathx-20150624-1.src.rock cl /nologo /MD /O2 -c -Folmathx.obj -IC:/lua/include lmathx.c lmathx.c link -dll -def:mathx.def -out:mathx.dll C:/lua/lua53.dll lmathx.obj Microsoft (R) Incremental Linker Version 14.10.25019.0 Copyright (C) Microsoft Corporation. All rights reserved.
C:\lua\lua53.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x430
Error: Build error: Failed compiling module mathx.dll
I think my macbook is doing similar but I will have to look at that another day so I am putting that aside for now.
The module I have tried to install above is: luarocks.org/modules/ignacio/lmathx
C:\Users\MYNAMEHERE>luarocks install luai Installing luarocks.org/luai-1.0-2.src.rock luai 1.0-2 is now installed in C:\lua\systree (license: MIT/X11)
I have managed to get one module installed: luarocks.org/modules/cschen1205/luai
which gave the following output in normal windows command prompt after typing: luarocks install luai
C:\Users\MYNAMEHERE>luarocks install luai Installing zluarocks.org/luai-1.0-2.src.rock luai 1.0-2 is now installed in C:\lua\systree (license: MIT/X11)
However I was struggling to get any lua code to test this even on there github for it.
I am left stumped overall either I can't get windows to pick up the visual studio 2017 compiler to build luarocks files (Please note I do have C:\MinGW installed as a portable version as well with c and c++ compiler in there of gcc but this is already set in path, I can use this instead if vs studio 2017 is to new to work but how to default lua rocks to mingw gcc rather than cl.exe to build libraries????) or something installs then I am struggling to find out how its installed (not from source, presumed though???)or sample code to check such a luarock has installed.

Related

rust: link.exe not found

I installed the rust compiler and also MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.27) (as an individual component)
This does not seam to be working.
Does rust require anything more which I have not installed? Thank you in advance.
Install the Windows SDK too.
I also didn't want to install all of Visual Studio just to compile rust from the command line.
Based on the info in coder-256's link, I tried running C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat. Then, instead of being unable to find link.exe, I got the error:
note: LINK : fatal error LNK1181: cannot open input file 'advapi32.lib'
Searching Stack for that error led to this answer: Install the Windows SDK
So I installed the Windows 10 SDK, and now (after launching a new cmd window) it works.
Using Win11, here's the specific steps that worked for me (assumes VSCode and Rust are already installed):
Go to the Visual Studio Download site
Download Build Tools for Visual Studio 2019 (version 16.9)
Install
Create a "hello world" Rust project (cargo new hello)
Open project in VSCode
Set path info in launch.json file (located at folder root, may need to create this first)
Type Shift+Ctrl+B to build the Rust project

What do I need to do CUDA development on Windows 10?

I've installed the CUDA 10.2 tools on Windows 10 along with Visual Studio Community Edition. When I run the nvcc compiler on a .cu file from the command line it complains that it cannot find cl.exe, which apparently is a Microsoft compiler. If cl.exe is part of VSCE it didn't get put on the PATH. Maybe there are additional steps that I don't know about
Also, VSCE doesn't know what .cu files are and I can't find any extensions for NVidia or CUDA.
Does VSCE support CUDA development, or do I need the commercial edition or something else to get going with CUDA development on Windows?
Update:
I tried building one of the sample projects (CUDA Samples\v10.2\1_Utilities\deviceQuery) by importing it into VSCE and it fails with this message:
Error MSB4019 The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 10.2.props" was not found. Confirm that the expression in the Import declaration "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\\BuildCustomizations\CUDA 10.2.props" is correct, and that the file exists on disk.
The solution is here. The CUDA installation guide fails to mention that you have to copy several files from the CUDA installation to the VSCE installation.

Unable to compile Rust program: LNK1181: cannot open input file 'C:\\Program.obj'

I am getting the error:
C:\rust\hello_world\src>where link.exe
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x86\link.exe
C:\rust\hello_world\src>rustc main.rs
error: linking with `link.exe` failed: exit code: 1181
|
= note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x86\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LARGEADDRESSAWARE" "/SAFESEH" "/LIBPATH:C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib" "main.main.7rcbfp3g-cgu.0.rcgu.o" "main.main.7rcbfp3g-cgu.1.rcgu.o" "main.main.7rcbfp3g-cgu.2.rcgu.o" "main.main.7rcbfp3g-cgu.3.rcgu.o" "main.main.7rcbfp3g-cgu.4.rcgu.o" "main.main.7rcbfp3g-cgu.5.rcgu.o" "/OUT:main.exe" "main.4s37gsrti678ik8u.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libstd-a2af7cbca70405c4.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libpanic_unwind-8f8ad41ed0b34354.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libhashbrown-3442ca764a847dfc.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-726244614f5a8f3a.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libbacktrace-29b7599014a92286.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\librustc_demangle-519f7f7caa7ec7f2.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libunwind-feba7334127a8724.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libcfg_if-6d75d87de5ddb74c.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\liblibc-7dc5efd24952e919.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\liballoc-b95120d391119ce4.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\librustc_std_workspace_core-0e624f0b43962fb3.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libcore-58985b8c03f907a8.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libcompiler_builtins-27c1b248396c205c.rlib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
= note: LINK : fatal error LNK1181: cannot open input file 'C:\\Program.obj'
I've looked at other posts suggested by Stack Overflow as well as some Google results regarding this issue. I've tried to install and reinstall VS Community 2019 with C++ for desktop module, Visual Studio build tools with C++ build tools, the newest Windows 10 SDK with all options as well as the newest rustup-init installation. Where might my problem be?
You need to install Windows SDK. Download Visual C++ Build Tools from https://visualstudio.microsoft.com/downloads/ and select Windows SDK during install. Or if If you have already installed it:
Windows Settings > Apps > Microsoft Visual C++ Build Tools > Modify > Windows SDK
https://users.rust-lang.org/t/problems-with-installing-rust-on-windows/9349/22
http://asyncbulbs.blogspot.com/2017/06/workaround-for-rustc-with-new-visual.html
direct link to Build Tools (should work still) https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15
https://github.com/rust-lang/rust/issues/43039#issuecomment-589321158
https://github.com/rust-lang/prev.rust-lang.org/issues/1015
After a lot of trial and error I discovered that I had previously installed mingw with GNU. Even if rust looked for link.exe in "...Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC...", it was using GNU version not MSVC version of some dependencies. So in my case using not default(which is for MSVC which comes with VS) installation, but an GNU platform specific rust installation from https://forge.rust-lang.org/infra/other-installation-methods.html worked for me. Maybe if someone experienced could explain the issue in normal terms for future reference.

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/

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