installing development version of cocotb - visual-studio

I am trying to get my cocotb work with commercial simulators (either modelsim or activeHDL) and I would appreciate if someone could help me get them up and running.
I have a Windows machine where I have installed MSYS2 and anaconda3 from where I can install cocotb. I don't have problem installing (I presume stable) cocotb with pip install cocotb through anaconda prompt, however, when I want to install the development version of cocotb through pip install https://github.com/cocotb/cocotb/archive/master.zip I run into trouble.
Initially, the installation complained about visual studio c++14 not being installed. I decided to install visual Studio build tools and hope it will install but then the installation failed due to following error
building 'cocotb\libs\libcocotbutils' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\cocotb
creating build\temp.win-amd64-3.7\Release\cocotb\share
creating build\temp.win-amd64-3.7\Release\cocotb\share\lib
creating build\temp.win-amd64-3.7\Release\cocotb\share\lib\utils
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icocotb\share\include -IC:\Users\Mehdi\anaconda3\include -IC:\Users\Mehdi\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tpcocotb\share\lib\utils\cocotb_utils.cpp /Fobuild\temp.win-amd64-3.7\Release\cocotb\share\lib\utils\cocotb_utils.obj -std=c++11 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wnon-virtual-dtor -Woverloaded-virtual -D__STDC_FORMAT_MACROS
cl : Command line error D8021 : invalid numeric argument '/Wextra'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
Is this a problem with cocotb's development version or do I miss something? how can I force cocotb use msys2 build tools instead of visual studio's?
PS. The reason I am trying to install the development version is because of activehdl.

You need set MinGW as the default compiler one way is to:
pip install --global-option build_ext --global-option --compiler=mingw32 https://github.com/cocotb/cocotb/archive/master.zip
More info: How to use MinGW's gcc compiler when installing Python package using Pip?
I will try to add this to the documentation.

Related

Unable to upgrade Python 3.11 due to error in Locust-plugin installation (Confluent-Kafka)

After upgrading Python to 3.11, Locust-plugin fails to install as one of its dependency throws error
First it asked me to install VC++ > 14.0
After installing VC++ build tools 15, still it throws a different error
Note: We do not see this issue until Python 3.10.8
Kindly let me know if there is any fix?
locust-plugins==2.7.1
- confluent-kafka [required: Any]
DEPRECATION: confluent-kafka is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 2
3.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for confluent-kafka ... error
error: subprocess-exited-with-error
× Running setup.py install for confluent-kafka did not run successfully.
│ exit code: 1
╰─> [57 lines of output]
running install
C:\~\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use bu
ild and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
.............build\~\AppData\Local\Temp\pip-install-751nsega\confluent-kafka_3aae65aeec6a4e2ab93d05a4141fc55b\src
creating build\temp.win-amd64-cpython-311\Release\~\AppData\Local\Temp\pip-install-751nsega\confluent-kafka_3aae65aeec6a4e2ab93d05a4141fc55b\src\confluent_kafka
creating build\~\AppData\Local\Temp\pip-install-751nsega\confluent-kafka_3aae65aeec6a4e2ab93d05a4141fc55b\src\confluent_kafka\src
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\~\AppData\
Local\Programs\Python\Python311\include -IC:\~\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\M
SVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)
\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\inIC:\~\AppData\Local\Programs\Python\Python311\include -IC:\~\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files
(x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /TcC:\~\AppData\Local\Temp\pip-install-751nsega\confluent-kafka_3aae65aeec6a4e2ab93d05a4141fc55b\src\confluent_kafka\src\Admin.c /Fobuild\~\AppData\Local\Temp\pip-install-751nsega\confluent-kafka_3aae65aeec6a4e2ab93d05a4141fc55b\src\confluent_kafka\src\Admin.obj
Admin.c c:\~\appdata\local\temp\pip-install-751nsega\confluent-kafka_3aae65aeec6a4e2ab93d05a4141fc55b\src\confluent_kafka\src\confluent_kafka.h(23): fatal error C1083: Cannot open include file: 'librdkafka/rdkafka.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> confluent-kafka
Right now there is currently no pre-built version of confluent-kafka for 3.11. Hopefully it is on the way though: https://github.com/confluentinc/confluent-kafka-python/issues/1452
Also, I think the reason cannot build from source is that you need librdkafka installed. I dont know what the windows equivalent is, but apparently someone got it working on Linux this way:
apt-get install -y --no-install-recommends gcc git libssl-dev g++ make && cd /tmp && git clone https://github.com/edenhill/librdkafka.git && cd librdkafka && ./configure --prefix=/usr && make && make install
Looks like we are still waiting for 3.11 confluent-kafka. This is the only thing that is blocking my 3.10 to 3.11 upgrade.

Qt Creator fails to open a CMake project due to a wrong link.exe path

I upgraded Visual Studio 2017 recently and now cannot open a CMake project in Qt Creator 4.8.2.
CMake succeeds to test the compiler when running from cmd.exe but fails in Qt Creator:
Running "C:\Program Files\CMake\bin\cmake.exe -E server "--pipe=\\.\pipe\{b2399ce2-b8c1-4992-94b7-57b65efed70f}" --experimental" in D:\checkout\mateju\integrace\util\itex\build_Qt5-Release.
Starting to parse CMake project.
The C compiler identification is MSVC 19.16.27027.1
The CXX compiler identification is MSVC 19.16.27027.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual
Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" is
not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_1344c\fast"
"C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"
-f CMakeFiles\cmTC_1344c.dir\build.make /nologo -L
CMakeFiles\cmTC_1344c.dir\build
Building C object CMakeFiles/cmTC_1344c.dir/testCCompiler.c.obj
C:\PROGRA~2\MICROS~2\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\HostX64\x64\cl.exe
#C:\Users\MATEJU~1\AppData\Local\Temp\nmEB0D.tmp
testCCompiler.c
Linking C executable cmTC_1344c.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe
--intdir=CMakeFiles\cmTC_1344c.dir --manifests -- "C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\link.exe"
/nologo #CMakeFiles\cmTC_1344c.dir\objects1.rsp
#C:\Users\MATEJU~1\AppData\Local\Temp\nmEC75.tmp
LINK Pass 1 failed to run.
NMAKE : fatal error U1077: "C:\Program Files\CMake\bin\cmake.exe":
return code 0xffffffff
Stop.
NMAKE : fatal error U1077: "C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe":
return code 0x2
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
Configuring incomplete, errors occurred!
See also "D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeOutput.log".
See also "D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeError.log".
CMake Project parsing failed.
As you can see, the compiler path is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64
However, it’s looking for the linker in the path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64
So my question is: How can I update the linker path to (the only existing) 14.16.27023? Or what else should I do to continue using CMake in Qt Creator?
I’ve tried to find a corresponding option in my Qt Creator Compiler options but it claims to use the same vcvarsall.bat call which works well on command-line…
D:\build>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.8
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
D:\build>link
Microsoft (R) Incremental Linker Version 14.16.27027.1
Copyright (C) Microsoft Corporation. All rights reserved.
<and so on...>
I’ve tried the following steps without any success:
add C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64 to PATH as the answer to a similar question suggests
launch Qt Creator from cmd.exe after running vcvarsall.bat in the same window
upgrade CMake to the latest stable version (3.14.1)
install and try in Qt Creator 4.9.0-rc1
search for the string 14.10.25017
in the Windows Registry – no results
in the Qt Creator directory
no configuration files found
found .pdb and .lib files which likely only means they were built using this version of Visual Studio
in C:\Program Files (x86)\Microsoft Visual Studio – no results
in C:\Program Files (x86)\Windows Kits – no results
After several unsuccessful guesses mentioned in the question, I succeeded to open, build and run my project after I issued
Build > Clear CMake Configuration
in the menu of Qt Creator.

make: cl: Command not found

I'm trying to install Google OR-Tools for Java in Visual Studio 2015. When I run make all in the OR-Tools directory, as required, I get
E:\My_files\VS\BC\or-tools_VisualStudio2015-64bit_v6.4.4495>make all
cl /EHsc /MD /nologo /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -nologo /O2 -DN
DEBUG -DUSE_CBC -DUSE_CLP /D__WIN32__ /Iinclude\\src\\windows
/DGFLAGS_DLL_DECL=
/DGFLAGS_DLL_DECLARE_FLAG= /DGFLAGS_DLL_DEFINE_FLAG= /Iinclude /I. -
DUSE_GLOP -
DUSE_BOP -c examples\\cpp\\costas_array.cc /Foobjs\\costas_array.obj
make: cl: Command not found
make: *** [objs\\costas_array.obj] Error 127
I read somewhere to run vcvarsall.bat to set variables, but there is no such file on this path
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
Plus I'm supposed to run it in Native Tools Command Prompt, but I cannot find this for VS2015, only for VS2017, so I run it in Developer Command Prompt. Might this be the issue?
Apparently, I did not add C++ tools when installing Visual Studio.
File -> New -> Project -> Visual C++ and there's the install option. Maybe it will help someone.

pip install distarray --> mpi.h not found, cannot install mpi4py

I have tried to install distarray which requires a C++ compiler (which I got from MS) and mpi4py. The installer cannot locate mpi.h and I cannot even install mpi4py by itself. The documentation says I should set an ENV-path, but which path, to Visual studio?
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo
/Ox /MD /W3 /GS- /DNDEBUG -IC:\Python34\include -IC:\Python34\include /Tc_confi
gtest.c /Fo_configtest.obj
_configtest.c
_configtest.c(2) : fatal error C1083: Cannot open include file: 'mpi.h': No
such file or directory
failure.
removing: _configtest.c _configtest.obj
failure.
error: Cannot find 'mpi.h' header. Check your configuration!!!
What am I doing wrong? I have tried both in a Windows and a Linux environment without luck. As admin and sudo.
(Should there be tags for mpi4py, mpi.h, mpi.cfg as I cannot create these as a new user)

Build failed with error MSB3721 when building a CUDA SDK example under Visual Studio 2010

I am working on CUDA with Visual Studio 2010. I installed the CUDA toolkit and SDK but one of the SDK examples is not building successfully.
The output console shows:
1>_CUDA_Build_Rule:
1> Compiling with CUDA Build Rule...
1> The system cannot find the path specified.
1>E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\Cuda.targets(45,5): error MSB3721: The command "echo "$(CUDA_BIN_PATH)\nvcc.exe" -arch sm_10 -ccbin "E:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /Od /Zi /MTd " -I"E:\CUDA\include;../../common/inc" -maxrregcount=32 --compile -o "$(IntDir)\$(InputName).cu.obj" "E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\bandwidthTest\bandwidthTest.cu"
1>E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\Cuda.targets(45,5): error MSB3721: "$(CUDA_BIN_PATH)\nvcc.exe" -arch sm_10 -ccbin "E:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /Od /Zi /MTd " -I"E:\CUDA\include;../../common/inc" -maxrregcount=32 --compile -o "$(IntDir)\$(InputName).cu.obj" "E:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\bandwidthTest\bandwidthTest.cu"" exited with code 1.
1>
1>Build FAILED.
there is some problem with the nvcc.exe
When i execute nvcc.exe in command prompt, it shows :
nvcc fatal: No input file specified
I'm afraid yours is a non-programming question.
Anyway, if you run nvcc from the command line, you obviously get that error message because you are not specifying which file do you like to compile.
Below, I'm pointing out some other threads with the same problem you detailed. I hope they could be useful to you:
Visual Studio 2010 - how to fix Error MSB3721 - exiting with code 1
CUDA Visual Studio 2010 Express build error
Fixing Visual Studio Express error when cleaning 64-bit projects using CUDA 4.1 nvcc compiler

Resources