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

Cannot build using Visual Studio 2022 (64-bit) - LTSC 17.4 #85

Open
LouisStrous opened this issue Aug 29, 2023 · 5 comments
Open

Cannot build using Visual Studio 2022 (64-bit) - LTSC 17.4 #85

LouisStrous opened this issue Aug 29, 2023 · 5 comments

Comments

@LouisStrous
Copy link

I tried building micro-profiler myself in the hope that that would circumvent issue #83 (to which I contributed some logs yesterday), but Conan ran into errors. The first one was

  -- Conan: Version found Conan version 2.0.9
  -- Conan executing: C:/Program Files/Conan/conan/conan.exe install . -s arch=x86_64 -s build_type=Release -s compiler=Visual Studio -s compiler.version=17 -s compiler.runtime=MT -g=cmake_multi --build=missing -o=capstone:arm=False -o=capstone:evm=False -o=capstone:m680x=False -o=capstone:m68k=False -o=capstone:mips=False -o=capstone:ppc=False -o=capstone:sparc=False -o=capstone:sysz=False -o=capstone:tms320c64x=False -o=capstone:xcore=False
  ERROR: Error while initializing options. The usage of package names `capstone:arm` in options is deprecated, use a pattern like `capstone/*:arm` instead
  CMake Error at build.props/conan.cmake:540 (message):

I tried working around that one by changing capstone: to capstone/*: in patcher/src/CMakeLists.txt. Rerunning cmake gave a new error:

  -- Conan executing: C:/Program Files/Conan/conan/conan.exe install . -s arch=x86_64 -s build_type=Release -s compiler=Visual Studio -s compiler.version=17 -s compiler.runtime=MT -g=cmake_multi --build=missing -o=capstone/*:arm=False -o=capstone/*:evm=False -o=capstone/*:m680x=False -o=capstone/*:m68k=False -o=capstone/*:mips=False -o=capstone/*:ppc=False -o=capstone/*:sparc=False -o=capstone/*:sysz=False -o=capstone/*:tms320c64x=False -o=capstone/*:xcore=False
  ERROR: Invalid setting 'Visual Studio' is not a valid 'settings.compiler' value.
  Possible values are ['sun-cc', 'gcc', 'msvc', 'clang', 'apple-clang', 'intel-cc', 'qcc', 'mcst-lcc']
  Read "http://docs.conan.io/2/knowledge/faq.html#error-invalid-setting"
  CMake Error at build.props/conan.cmake:540 (message):

I tried working around that one by changing set(_VISUAL "Visual Studio") to set(_VISUAL "msvc") in build.props/conan.cmake. Rerunning cmake gave a new error:

  -- Conan executing: C:/Program Files/Conan/conan/conan.exe install . -s arch=x86_64 -s build_type=Release -s compiler=msvc -s compiler.version=17 -s compiler.runtime=MT -g=cmake_multi --build=missing -o=capstone/*:arm=False -o=capstone/*:evm=False -o=capstone/*:m680x=False -o=capstone/*:m68k=False -o=capstone/*:mips=False -o=capstone/*:ppc=False -o=capstone/*:sparc=False -o=capstone/*:sysz=False -o=capstone/*:tms320c64x=False -o=capstone/*:xcore=False
  ERROR: Error while processing 'profile.py' plugin, line 13
          _check_correct_cppstd(settings)
  while calling '_check_correct_cppstd', line 50
          _error(compiler, cppstd, mver, version)
  while calling '_error', line 19
          raise ConanException(f"The provided compiler.cppstd={cppstd} requires at least {compiler}"
          ConanException: The provided compiler.cppstd=14 requires at least msvc>=190 but version 17 provided
  CMake Error at build.props/conan.cmake:540 (message):

I don't know how to work around that problem. I think that the msvc version check is incorrect. The latest available Visual Studio version is 17.7, so I don't know what the "at least msvc >= 190" means. I expect that the "compiler.cppstd = 14" refers to C++14 support, which is available in the Visual Studio version that I use, which is 17.4.

Maybe this is a conan problem rather than a micro-profiler problem, but in any case it prevents me from making further progress in getting micro-profiler to build. And the first two problems look like they're micro-profiler problems.

I attach the CMake logs from the last cmake run.

CMakeOutput.log
CMakeError.log

@tyoma
Copy link
Owner

tyoma commented Sep 11, 2023

Hi @LouisStrous!

I have not migrated cmake/conan to the latest versions yet - at conan they've changed the whole integration principle with cmake.
Right now I am using Conan v1.59.0 and CMake v3.24.3 - those work fine.
As for 'arm' I'd look at the ~/.conan/profiles/default (I have not employed local profiles yet).

Basically, what you see here conan-wise was added, bc I needed to integrate sqlite3 and capstone fast. More work is required as per infrastructure...

thanks!

@LouisStrous
Copy link
Author

LouisStrous commented Sep 15, 2023

I have now installed conan v1.59.0 and CMake v3.24.3, re-cloned the micro-profiler code, and run "cmake ." in the top-level folder of the repository. This gets me much further than before but still runs into a fatal problem:

CMake Error at micro-profiler/CMakeLists.txt:3 (include):
  include could not find requested file:

    vssdk

I find the word "vssdk" mentioned in one location in the repository: on line 3 of [repo]/micro-profiler/CMakeLists.txt, which reads

include(vssdk)

There is indeed no file named "vssdk" anywhere in the repository.

"vssdk" seems to refer to the Visual Studio SDK, which I had already installed on my system, as part of the "Visual Studio extension development" toolset.

Do you know how I can resolve this problem?

CMakeError.log
CMakeOutput.log

@tyoma
Copy link
Owner

tyoma commented Sep 16, 2023

I usually create '/_build' directory, 'cd' there and from it call:
cmake ..
does this work?
I'll check calling cmake from the root dir - it should work from there as well.

btw, did you pull submodules:
'git submodule update --init'
?

@LouisStrous
Copy link
Author

LouisStrous commented Sep 22, 2023 via email

@LouisStrous
Copy link
Author

LouisStrous commented Jun 27, 2024

I got the code to compile as follows with Visual Studio 2022 LTSC 17.8.11 on Windows 11, using your tips:

  1. Install conan version 1.59.0.
  2. Install cmake version 3.24.3.
  3. Git clone the repository. via git clone --recurse-submodules https://github.com/tyoma/micro-profiler.git. It is at commit v2.0.651.0-154-g1fb1b5ed in branch "master". The local copy of the repository ends up in subdirectory "micro-profiler" of the current working directory.
  4. Create subdirectory "micro-profiler\_build", go into that directory, then run cmake ...
  5. Then run cmake --build .. This produces "micro-profiler_x64.dll" and various other things in "micro-profiler\_build\_bin".

I managed (with some hackery) to create a VSIX file and install it into Visual Studio but that didn't lead to any successful profiling run.

I then tried to use the micro-profiler as follows without integration into Visual Studio, using a combination of the various options that you describe, but that didn't work, either:

  1. Add the /GH and /Gh flags to the compilation of the application I wish to profile.
  2. Add the "micro-profiler\_build\_bin\micro-profiler_x64.lib" to the linking of the application I wish to profile.
  3. Build the application.
  4. Define environment variable MICROPROFILERFRONTEND with value "sockets|127.0.0.1:6100".
  5. Add the absolute path of the "micro-profiler\_build\_bin" folder to the PATH environment variable.
  6. Copy "micro-profiler\_build\_bin\micro-profiler_x64.dll" next to my application.
  7. Open a new CMD shell (so it gets the new environment variables) and start my application.

The build succeeded but when I ran my application I did not see anything to show that the micro-profiler was active. Any ideas what I'm doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants