ThePhD / infoware

C++ Library for pulling system and hardware information, without hitting the command line.
Creative Commons Zero v1.0 Universal
410 stars 84 forks source link

Why is INFOWARE_GENERATED_PCI_INDICES not defined? #38

Closed patlecat closed 4 years ago

patlecat commented 4 years ago

I can't build all because this macro isn't defined apparently, but why? That's why then I get this linker error: LINK : fatal error LNK1104: cannot open file 'lib\Debug\infowared.lib'

Latest version of infoware MSVC2019 Windows10

3>C:\GitHub\infoware\src\pci.cpp(38,34): error C2065: 'INFOWARE_GENERATED_PCI_INDICES': undeclared identifier
3>C:\GitHub\infoware\src\pci.cpp(39,42): error C2065: 'INFOWARE_GENERATED_PCI_VENDORS': undeclared identifier
3>C:\GitHub\infoware\src\pci.cpp(40,42): error C2065: 'INFOWARE_GENERATED_PCI_DEVICES': undeclared identifier
nabijaczleweli commented 4 years ago

The d suffix stands for debug build, but that should be handled transparently by CMake. The macros are for PCI ID decoding, and the header containing them is internal and should have also been built by the build handler generated by CMake.

I can't see a simple reason this should fail like this, can you provide your top-level project and build config?

patlecat commented 4 years ago

In what form exactly?

nabijaczleweli commented 4 years ago

If your project is in a public VCS -- a link to that would be great; if not -- a tarball/zip included in here.

The build configuration should be stored entirely in build/CMakeCache.txt, inlining that here would be perfect.

patlecat commented 4 years ago

Okay here is the link to the zipped folder after CMake and compilation: https://www.dropbox.com/s/vsrzx3w2zu05xwa/infoware_patlecat.zip?dl=0

ThePhD commented 4 years ago

Hey, so copying your exact setup (down to the paths) works just fine for me in both VS 2019 Preview and VS 2019 Normal, doing both debug and release versions. Do you have more information from the build that is going wrong? It very much works out fine for me:

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------ 1>Checking File Globs 1>Checking Build System 2>------ Build started: Project: infoware_pci_generator, Configuration: Debug x64 ------ 2>Building Custom Rule C:/Development/GitHub/infoware/CMakeLists.txt 2>pci_generator.cpp 2>infoware_pci_generator.vcxproj -> C:\Development\GitHub\infoware\Debug\infoware_pci_generator.exe 3>------ Build started: Project: infoware_generate_pcis, Configuration: Debug x64 ------ 3>Building Custom Rule C:/Development/GitHub/infoware/CMakeLists.txt 4>------ Build started: Project: infoware, Configuration: Debug x64 ------ 4>Building Custom Rule C:/Development/GitHub/infoware/CMakeLists.txt 4>architecture_non_windows.cpp 4>architecture_windows.cpp 4>all.cpp 4>frequency_darwin.cpp 4>frequency_non_windows_non_darwin.cpp 4>frequency_windows.cpp 4>instruction_set.cpp 4>instruction_set_darwin.cpp 4>instruction_set_non_windows_non_darwin.cpp 4>instruction_set_windows.cpp 4>quantities_cache_darwin.cpp 4>quantities_cache_non_windows_non_darwin.cpp 4>quantities_cache_windows.cpp 4>vendor_id.cpp 4>vendor_model_name_darwin.cpp 4>vendor_model_name_non_windows_non_darwin.cpp 4>vendor_model_name_windows.cpp 4>cpuid_non_windows.cpp 4>cpuid_windows.cpp 4>scope.cpp 4>Generating Code... 4>Compiling... 4>sysctl_darwin.cpp 4>sysctl_non_darwin.cpp 4>winstring_non_windows.cpp 4>winstring_windows.cpp 4>OpenCL.cpp 4>OpenGL.cpp 4>blank_all.cpp 4>d3d.cpp 4>pci.cpp 4>os_info_darwin.cpp 4>os_info_non_windows_non_darwin.cpp 4>os_info_windows.cpp 4>amounts_non_windows.cpp 4>amounts_windows.cpp 4>displays_darwin.cpp 4>displays_default_blank.cpp 4>displays_windows.cpp 4>displays_x11.cpp 4>kernel_info_non_windows.cpp 4>kernel_info_windows.cpp 4>Generating Code... 4>Compiling... 4>memory_darwin.cpp 4>memory_non_windows_non_darwin.cpp 4>memory_windows.cpp 4>version.cpp 4>Generating Code... 4>infoware.vcxproj -> C:\Development\GitHub\infoware\lib\Debug\infowared.lib 5>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------ 5>Building Custom Rule C:/Development/GitHub/infoware/CMakeLists.txt 6>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------ 6>Project not selected to build for this solution configuration ========== Build: 5 succeeded, 0 failed, 0 up-to-date, 1 skipped ==========

Let me know what looks different / is different, why, and any special setup you might be doing.

patlecat commented 4 years ago

I still get this after a rebuild of the same project I sent here:

1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Checking File Globs
1>Checking Build System
2>------ Rebuild All started: Project: infoware_pci_generator, Configuration: Debug x64 ------
2>Building Custom Rule C:/GitHub/infoware/CMakeLists.txt
2>pci_generator.cpp
2>infoware_pci_generator.vcxproj -> C:\GitHub\infoware\Debug\infoware_pci_generator.exe
3>------ Rebuild All started: Project: infoware_generate_pcis, Configuration: Debug x64 ------
3>Generating pci_data.hpp
3>Couldn't open input file
3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(231,5): error MSB6006: "cmd.exe" exited with code 2.
3>Done building project "infoware_generate_pcis.vcxproj" -- FAILED.
4>------ Rebuild All started: Project: infoware, Configuration: Debug x64 ------
4>Building Custom Rule C:/GitHub/infoware/CMakeLists.txt
4>architecture_non_windows.cpp
4>architecture_windows.cpp
4>all.cpp
4>frequency_darwin.cpp
4>frequency_non_windows_non_darwin.cpp
4>frequency_windows.cpp
4>instruction_set.cpp
4>instruction_set_darwin.cpp
4>instruction_set_non_windows_non_darwin.cpp
4>instruction_set_windows.cpp
4>quantities_cache_darwin.cpp
4>quantities_cache_non_windows_non_darwin.cpp
4>quantities_cache_windows.cpp
4>vendor_id.cpp
4>vendor_model_name_darwin.cpp
4>vendor_model_name_non_windows_non_darwin.cpp
4>vendor_model_name_windows.cpp
4>cpuid_non_windows.cpp
4>cpuid_windows.cpp
4>scope.cpp
4>Generating Code...
4>Compiling...
4>sysctl_darwin.cpp
4>sysctl_non_darwin.cpp
4>winstring_non_windows.cpp
4>winstring_windows.cpp
4>OpenCL.cpp
4>OpenGL.cpp
4>blank_all.cpp
4>d3d.cpp
4>pci.cpp
4>C:\GitHub\infoware\src\pci.cpp(38,34): error C2065: 'INFOWARE_GENERATED_PCI_INDICES': undeclared identifier
4>C:\GitHub\infoware\src\pci.cpp(39,42): error C2065: 'INFOWARE_GENERATED_PCI_VENDORS': undeclared identifier
4>C:\GitHub\infoware\src\pci.cpp(40,42): error C2065: 'INFOWARE_GENERATED_PCI_DEVICES': undeclared identifier
4>os_info_darwin.cpp
4>os_info_non_windows_non_darwin.cpp
4>os_info_windows.cpp
4>amounts_non_windows.cpp
4>amounts_windows.cpp
4>displays_darwin.cpp
4>displays_default_blank.cpp
4>displays_windows.cpp
4>displays_x11.cpp
4>kernel_info_non_windows.cpp
4>kernel_info_windows.cpp
4>Generating Code...
4>Compiling...
4>memory_darwin.cpp
4>memory_non_windows_non_darwin.cpp
4>memory_windows.cpp
4>version.cpp
4>Generating Code...
4>Done building project "infoware.vcxproj" -- FAILED.
5>------ Rebuild All started: Project: ALL_BUILD, Configuration: Debug x64 ------
5>Building Custom Rule C:/Development/GitHub/infoware/CMakeLists.txt
6>------ Skipped Rebuild All: Project: INSTALL, Configuration: Debug x64 ------
6>Project not selected to build for this solution configuration 
========== Rebuild All: 3 succeeded, 2 failed, 1 skipped ==========
nabijaczleweli commented 4 years ago

This fragment, combined with pciids missing from the zip you posted, means that the PCI IDs repository wasn't checked out at all – is your git binary functional?

3>------ Rebuild All started: Project: infoware_generate_pcis, Configuration: Debug x64 ------
3>Generating pci_data.hpp
3>Couldn't open input file
3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(231,5): error MSB6006: "cmd.exe" exited with code 2.
3>Done building project "infoware_generate_pcis.vcxproj" -- FAILED.
patlecat commented 4 years ago

@nabijaczleweli I'm using the latest version of GitHub Desktop. So should be fine but I can't say if something is broken there. Now what?

nabijaczleweli commented 4 years ago

infoware uses git as part of its build process — GitHub Desktop is a product and mostly unrelated to git; you can get git from the git website, and, if you add it to your %PATH% before running the build again, it should work.

If that does it for you, this case (the sole possibility of which has, admittedly, stunned me) can likely be detected and handled better than some inscrutable error down the line.

ThePhD commented 4 years ago

@patlecat I updated the latest master branch to spell out some diagnostic information if git is missing or the command fails. Would you mind pulling the latest master branch and giving the code a try with a clean build, to see if it works out for you?

patlecat commented 4 years ago

@ThePhD Yeah now it worked, thanks a lot!

ThePhD commented 4 years ago

Great, glad it's sorted and you could get pushed towards the git setup you needed. Cheers!

nabijaczleweli commented 4 years ago

Released in v0.5.0, and thanks for reporting!