Viladoman / CompileScore

Tools for profiling and visualizing C++ build times.
MIT License
464 stars 19 forks source link

Getting "[ERROR] input path is not a directory" #52

Open JimViebke opened 11 months ago

JimViebke commented 11 months ago

On "Build Solution and Profile" using an elevated instance of VS: Score Data Extractor failed to start the recording session with code -1. The current build data won't be captured. Please check the output pane for more information.

Output from Compile Score:

[18:44:53] Calling ScoreDataExtractor with -clang -start -i C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/
[ERROR] input path is not a directory.
Execution Time: 01ms
[18:44:53] [ERROR] Score Data Extractor failed to start the recording session with code -1. The current build data won't be captured. Please check the output pane for more information.
[18:44:56] Building...
[18:45:16] Calling ScoreDataExtractor with -clang -stop -tp 100 -td 3 -d 3 -i C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/ -o "C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/Compile Score/compileData.scor"
[ERROR] input path is not a directory.
Execution Time: 00ms
[18:45:16] [ERROR] Score Data Extractor process failed with code -1. Please check the output pane for more information.
[18:45:22] Score generation completed!
[18:45:22] Score file main processed in 79 μs
[18:45:22] Score file globals processed in 61 μs

Output from Build:

Rebuild started...
1>------ Rebuild All started: Project: Prime Bitstrings, Configuration: Release x64 ------
1>Prime Bitstrings.vcxproj -> C:\Users\Jim Viebke\Dropbox\Code\C++\Prime Bitstrings\x64\Release\Prime Bitstrings.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild started at 6:44 PM and took 23.600 seconds ==========

Settings:

{
  "ScoreSource": 1,
  "ScoreLocation": "C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/Compile Score/compileData.scor",
  "ScoreGenerator": {
    "Compiler": 1,
    "InputPath": "C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/",
    "OutputPath": "C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/Compile Score/compileData.scor",
    "OverviewDetail": 3,
    "TimelineDetail": 3,
    "TimelinePacking": 100,
    "ExtractIncluders": true,
    "CollapseTemplateArgs": true
  }
}

Using: Visual Studio Community 2022, 17.7.6 Compile Score 1.8.4, Data Version 9 Clang 16.0.5 Windows 10

Viladoman commented 11 months ago

Interesting!

I assume the C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/ folder exists. The extractor is complaining that the previous string was not accepted as a directory check for some reason. The extractor code is just doing a direct call to the C++ filesystem IsDirectory.

You could try something like $(SolutionDir)obj\... or wherever the objects files are created in the extension configuration, to make sure there are no typos.

I am also thinking that maybe the Dropbox folder is messing with the C++ filesystem api. Another thing to try might be to move the project in a different location.

It is strange that a straight forward check like IsDirectory fails on a real folder.

JimViebke commented 11 months ago

Thanks for looking at this. I should have noted that the path is correct, Dropbox was not running, and VS has elevated permissions.

I copied the solution folder to C:/tmp/ and changed the configuration as follows:

{
  "ScoreSource": 1,
  "ScoreLocation": "$(SolutionDir)Compile Score/compileData.scor",
  "ScoreGenerator": {
    "Compiler": 1,
    "InputPath": "$(SolutionDir)",
    "OutputPath": "$(SolutionDir)Compile Score/compileData.scor",
    "OverviewDetail": 3,
    "TimelineDetail": 3,
    "TimelinePacking": 100,
    "ExtractIncluders": true,
    "CollapseTemplateArgs": true
  }
}

Output:

[00:04:07] Calling ScoreDataExtractor with -clang -start -i C:\tmp\Prime Bitstrings\
[ERROR] input path is not a directory.
Execution Time: 00ms
[00:04:07] [ERROR] Score Data Extractor failed to start the recording session with code -1. The current build data won't be captured. Please check the output pane for more information.
[00:04:11] Building...
[00:04:36] Calling ScoreDataExtractor with -clang -stop -tp 100 -td 3 -d 3 -i C:\tmp\Prime Bitstrings\ -o "C:\tmp\Prime Bitstrings\Compile Score/compileData.scor"
[ERROR] input path is not a directory.
Execution Time: 00ms
[00:04:36] [ERROR] Score Data Extractor process failed with code -1. Please check the output pane for more information.
[00:04:38] Score generation completed!
[00:04:38] Score file main processed in 373 μs
[00:04:38] Score file globals processed in 1.266 ms

Build output: (the warning is regarding PGO data and should be unrelated)

Rebuild started...
1>------ Rebuild All started: Project: Prime Bitstrings, Configuration: Release x64 ------
1>warning: profile data may be out of date: of 1257 functions, 5 have mismatched data that will be ignored [-Wprofile-instr-out-of-date]
1>1 warning generated.
1>Prime Bitstrings.vcxproj -> C:\tmp\Prime Bitstrings\x64\Release\Prime Bitstrings.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild started at 12:04 AM and took 28.968 seconds ==========
Viladoman commented 11 months ago

That's super strange! I can see the extension is computing the paths properly as $(SolutionDir) became C:\tmp\Prime Bitstrings\.

There is something obscure happening with the std::filesystem in there.

Would it be possible to run a simple program like below?

#include <filesystem>
#include <cstdio>

int main()
{
    const char* path = "C:\tmp\Prime Bitstrings\";
    if ( std::filesystem::is_directory( path ) )
    {
        printf("FOUND DIR!");
    }
    else
    {
        printf("NOT FOUND!");
    }
}

if this succeeds then the only explanation would be that the 'const char*' does not reach properly the application. Then cloning the repo and putting a breakpoint in the ScoreDataExtraction line provided above with the command line printed in the output pane should bring more light to the mystery.

JimViebke commented 11 months ago

The code exactly as is reads each backslash as an escape sequence, so it does not build, but changing the path to either of "C:/tmp/Prime Bitstrings/"; or R"(C:\tmp\Prime Bitstrings\)"; correctly prints "FOUND DIR!".

Viladoman commented 9 months ago

Out of curiosity. Did you figure out why that folder was cursed and did not work?