SoftwareNetwork / sw

Software Manager. Build System, Build System Generator and Package Manager. C/C++ and other languages. Tools and libraries for Software Management.
https://software-network.org
Other
113 stars 24 forks source link

Cannot open include file: 'sw_qt_rules.h': No such file or directory #80

Closed Telokis closed 3 years ago

Telokis commented 3 years ago

Describe the bug When building my project (https://gitlab.com/Telokis/Rayon/-/blob/master/sw.cpp) I get the following error:

[851/852] C:/Users/Telokis/Documents/Dev/Git/Rayon/sw.cpp
Exception in file D:/dev/cppan2/client2/src/sw/builder/command.cpp:764, function execute1: When executing: C:/Users/Telokis/Documents/Dev/Git/Rayon/sw.cpp
C:/Users/Telokis/Documents/Dev/sw/storage/pkg/b9/d6/d238/src/sdir/sw.cpp(6): fatal error C1083: Cannot open include file: 'sw_qt_rules.h': No such file or directory
command failed: exit code = 2
Total errors: 1
The terminal process "C:\Program Files\Git\bin\bash.exe '-l', '-c', 'sw -config r --build-name rayon build -output-dir bin'" terminated with exit code: 1.

Expected behavior The build should work because I didn't change anything since last time.

To Reproduce The repository is public at https://gitlab.com/Telokis/Rayon/. The build is like so:

#pragma sw require header org.sw.demo.qtproject.qt.base.tools.moc

void build(Solution& s)
{
  auto& rayon = s.addProject("rayon");

  auto& engine = rayon.addTarget<StaticLibraryTarget>("engine");
  {
    engine.CPPVersion = CPPLanguageStandard::CPP17;

    // Files
    engine.Private += "Projects/Engine/Source/.*"_rr;
    engine.Private += "Projects/Engine/Include/.*"_rr;

    // Dependencies
    engine.Public += "pub.telokis.github.jbeder.yaml_cpp-0.6.3"_dep;

    // Include directories
    engine.Public += "Projects/Engine/Include"_id;
    engine.Public += "Dependencies/glm/include"_id;

    engine.ApiName = "RAYON_ENGINE_API";
  }

  auto& gui = rayon.addTarget<ExecutableTarget>("gui");
  {
    gui.CPPVersion = CPPLanguageStandard::CPP17;

    // Files
    gui.Private += "Projects/GUI/Source/.*"_rr;
    gui.Private += "Projects/GUI/Include/.*"_rr;
    gui.Private += "Projects/GUI/Form/.*"_rr;
    gui.Private += "Projects/GUI/Resources/.*"_rr;
    gui.Private += "Projects/Engine/Include/.*"_rr;

    // Dependencies
    gui.Private += engine;
    gui.Private += "org.sw.demo.boost.filesystem-1.72.0"_dep;
    gui.Private += "org.sw.demo.qtproject.qt.base.plugins.platforms.windows-5.15.0"_dep;
    gui.Private += "org.sw.demo.qtproject.qt.base.widgets-5.15.0"_dep;

    // Include directories
    gui.Private += "Projects/GUI/Include/"_id;
    gui.Private += "Dependencies/glm/include"_id;

    qt_moc_rcc_uic("org.sw.demo.qtproject.qt"_dep, gui);
  }
}

Information:

sw -version sw.client.sw version 1.0.0 git revision db82472ee934dfb8e064af419d4d8d4254b724a3 assembled on 02.06.2021 21:58:26 UTC 02.06.2021 23:58:26 Romance Daylight Time

Windows x64

egorpugin commented 3 years ago

Hi,

I added newer Qt version that does not work with older sw yet. You need to specify older qt (5.15.0.0 exactly).

#define QT_VERSION "-=5.15.0.0" // at the top of the sw file

        t += "org.sw.demo.qtproject.qt.base.widgets" QT_VERSION ""_dep; // on your target deps
Telokis commented 3 years ago

Hi and thanks for the quick response.

I tried but I get the same error. This is the change I made:

    gui.Private += "org.sw.demo.qtproject.qt.base.plugins.platforms.windows" QT_VERSION ""_dep;
    gui.Private += "org.sw.demo.qtproject.qt.base.widgets" QT_VERSION ""_dep;

Resulting error:

[851/852] C:/Users/Telokis/Documents/Dev/Git/Rayon/sw.cpp
Exception in file D:/dev/cppan2/client2/src/sw/builder/command.cpp:764, function execute1: When executing: C:/Users/Telokis/Documents/Dev/Git/Rayon/sw.cpp
C:/Users/Telokis/Documents/Dev/sw/storage/pkg/b9/d6/d238/src/sdir/sw.cpp(6): fatal error C1083: Cannot open include file: 'sw_qt_rules.h': No such file or directory
command failed: exit code = 2
Total errors: 1
The terminal process "C:\Program Files\Git\bin\bash.exe '-l', '-c', 'sw -config r --build-name rayon build -output-dir bin'" terminated with exit code: 1.

I totally removed the storage directory to be sure but no changes.

I used

#define QT_VERSION "-=5.15.0.0"

At the very top of my file, above the pragma and below it but that didn't change anything.

egorpugin commented 3 years ago

Can you show whole config?

egorpugin commented 3 years ago

If you have any #pragma sw they must also target older qt.

#pragma sw require header org.sw.demo.qtproject.qt.base.tools.moc-=5.15.0.0  
Telokis commented 3 years ago

Sure.

#pragma sw require header org.sw.demo.qtproject.qt.base.tools.moc
#define QT_VERSION "-=5.15.0.0"

void build(Solution& s)
{
  auto& rayon = s.addProject("rayon");

  auto& engine = rayon.addTarget<StaticLibraryTarget>("engine");
  {
    engine.CPPVersion = CPPLanguageStandard::CPP17;

    // Files
    engine.Private += "Projects/Engine/Source/.*"_rr;
    engine.Private += "Projects/Engine/Include/.*"_rr;

    // Dependencies
    engine.Public += "pub.telokis.github.jbeder.yaml_cpp-0.6.3"_dep;

    // Include directories
    engine.Public += "Projects/Engine/Include"_id;
    engine.Public += "Dependencies/glm/include"_id;

    engine.ApiName = "RAYON_ENGINE_API";
  }

  auto& cli = rayon.addTarget<ExecutableTarget>("cli");
  {
    cli.CPPVersion = CPPLanguageStandard::CPP17;

    // Files
    cli.Private += "Projects/CLI/Source/.*"_rr;
    cli.Private += "Projects/CLI/Include/.*"_rr;
    cli.Private += "Projects/Engine/Include/.*"_rr;

    // Dependencies
    cli.Private += engine;
    cli.Private += "org.sw.demo.boost.filesystem-1.72.0"_dep;
    cli.Private += "org.sw.demo.boost.program_options-1.72.0"_dep;

    // Include directories
    cli.Private += "Projects/CLI/Include/"_id;
    cli.Private += "Dependencies/glm/include"_id;
  }

  auto& bench = rayon.addTarget<ExecutableTarget>("bench");
  {
    bench.CPPVersion = CPPLanguageStandard::CPP17;

    // Files
    bench.Private += "Projects/Bench/Source/.*"_rr;
    bench.Private += "Projects/Engine/Include/.*"_rr;

    // Dependencies
    bench.Private += engine;
    bench.Private += "pub.telokis.github.google.benchmark-1.5.0"_dep;

    // Include directories
    bench.Private += "Dependencies/glm/include"_id;
  }

  auto& gui = rayon.addTarget<ExecutableTarget>("gui");
  {
    gui.CPPVersion = CPPLanguageStandard::CPP17;

    // Files
    gui.Private += "Projects/GUI/Source/.*"_rr;
    gui.Private += "Projects/GUI/Include/.*"_rr;
    gui.Private += "Projects/GUI/Form/.*"_rr;
    gui.Private += "Projects/GUI/Resources/.*"_rr;
    gui.Private += "Projects/Engine/Include/.*"_rr;

    // Dependencies
    gui.Private += engine;
    gui.Private += "org.sw.demo.boost.filesystem-1.72.0"_dep;
    gui.Private += "org.sw.demo.qtproject.qt.base.plugins.platforms.windows" QT_VERSION ""_dep;
    gui.Private += "org.sw.demo.qtproject.qt.base.widgets" QT_VERSION ""_dep;

    // Include directories
    gui.Private += "Projects/GUI/Include/"_id;
    gui.Private += "Dependencies/glm/include"_id;

    qt_moc_rcc_uic("org.sw.demo.qtproject.qt"_dep, gui);
  }
}
egorpugin commented 3 years ago

Yes, top line is the issue. Add -=5.15.0.0

egorpugin commented 3 years ago

Also line: (add QT_VERSION)

    qt_moc_rcc_uic("org.sw.demo.qtproject.qt"_dep, gui);
Telokis commented 3 years ago

There is progress, I have another error which might be unrelated:

Error:

[851/852] C:/Users/Telokis/Documents/Dev/Git/Rayon/sw.cpp
[852/852] C:/Users/Telokis/Documents/Dev/Git/Rayon/.sw/cfg/595767/loc.sw.self.df1163-0.0.28.dll
Exception in file D:/dev/cppan2/client2/src/sw/builder/command.cpp:764, function execute1: When executing: C:/Users/Telokis/Documents/Dev/Git/Rayon/.sw/cfg/595767/loc.sw.self.df1163-0.0.28.dll
Creating library C:/Users/Telokis/Documents/Dev/Git/Rayon/.sw/cfg/595767/loc.sw.self.df1163-0.0.28.lib and object C:/Users/Telokis/Documents/Dev/Git/Rayon/.sw/cfg/595767/loc.sw.self.df1163-0.0.28.exp
sw.cpp.86f11d8d.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::_List_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::filesystem::path const ,class std::shared_ptr<struct sw::SourceFile> > > > > __cdecl sw::SourceFileStorage::begin(void)" (__imp_?begin@SourceFileStorage@sw@@QEAA?AV?$_List_iterator@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBVpath@filesystem@std@@V?$shared_ptr@USourceFile@sw@@@3@@std@@@std@@@std@@@std@@XZ) referenced in 
function "class std::unordered_set<class std::filesystem::path,struct std::hash<class std::filesystem::path>,struct std::equal_to<class std::filesystem::path>,class std::allocator<class std::filesystem::path> > __cdecl automoc(class std::shared_ptr<struct sw::Dependency> const &,struct sw::NativeCompiledTarget &,class std::vector<struct moc_file,class std::allocator<struct moc_file> > const &)" (?automoc@@YA?AV?$unordered_set@Vpath@filesystem@std@@U?$hash@Vpath@filesystem@std@@@3@U?$equal_to@Vpath@filesystem@std@@@3@V?$allocator@Vpath@filesystem@std@@@3@@std@@AEBV?$shared_ptr@UDependency@sw@@@2@AEAUNativeCompiledTarget@sw@@AEBV?$vector@Umoc_file@@V?$allocator@Umoc_file@@@std@@@2@@Z)
sw.cpp.86f11d8d.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::_List_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::filesystem::path const ,class std::shared_ptr<struct sw::SourceFile> > > > > __cdecl sw::SourceFileStorage::end(void)" (__imp_?end@SourceFileStorage@sw@@QEAA?AV?$_List_iterator@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBVpath@filesystem@std@@V?$shared_ptr@USourceFile@sw@@@3@@std@@@std@@@std@@@std@@XZ) referenced in function "class std::unordered_set<class std::filesystem::path,struct std::hash<class std::filesystem::path>,struct std::equal_to<class std::filesystem::path>,class std::allocator<class std::filesystem::path> > __cdecl automoc(class std::shared_ptr<struct sw::Dependency> const &,struct sw::NativeCompiledTarget &,class std::vector<struct moc_file,class std::allocator<struct moc_file> > const &)" (?automoc@@YA?AV?$unordered_set@Vpath@filesystem@std@@U?$hash@Vpath@filesystem@std@@@3@U?$equal_to@Vpath@filesystem@std@@@3@V?$allocator@Vpath@filesystem@std@@@3@@std@@AEBV?$shared_ptr@UDependency@sw@@@2@AEAUNativeCompiledTarget@sw@@AEBV?$vector@Umoc_file@@V?$allocator@Umoc_file@@@std@@@2@@Z)
C:\Users\Telokis\Documents\Dev\Git\Rayon\.sw\cfg\595767\loc.sw.self.df1163-0.0.28.dll : fatal error LNK1120: 2 unresolved externals
command failed: exit code = 1120 (0x460)
Total errors: 1
The terminal process "C:\Program Files\Git\bin\bash.exe '-l', '-c', 'sw -config r --build-name rayon build -output-dir bin'" terminated with exit code: 1.

Config:

#define QT_VERSION "-=5.15.0.0"
#pragma sw require header org.sw.demo.qtproject.qt.base.tools.moc-=5.15.0.0

void build(Solution& s)
{
  auto& rayon = s.addProject("rayon");

  auto& engine = rayon.addTarget<StaticLibraryTarget>("engine");
  {
    engine.CPPVersion = CPPLanguageStandard::CPP17;

    // Files
    engine.Private += "Projects/Engine/Source/.*"_rr;
    engine.Private += "Projects/Engine/Include/.*"_rr;

    // Dependencies
    engine.Public += "pub.telokis.github.jbeder.yaml_cpp-0.6.3"_dep;

    // Include directories
    engine.Public += "Projects/Engine/Include"_id;
    engine.Public += "Dependencies/glm/include"_id;

    engine.ApiName = "RAYON_ENGINE_API";
  }

  auto& gui = rayon.addTarget<ExecutableTarget>("gui");
  {
    gui.CPPVersion = CPPLanguageStandard::CPP17;

    // Files
    gui.Private += "Projects/GUI/Source/.*"_rr;
    gui.Private += "Projects/GUI/Include/.*"_rr;
    gui.Private += "Projects/GUI/Form/.*"_rr;
    gui.Private += "Projects/GUI/Resources/.*"_rr;
    gui.Private += "Projects/Engine/Include/.*"_rr;

    // Dependencies
    gui.Private += engine;
    gui.Private += "org.sw.demo.boost.filesystem-1.72.0"_dep;
    gui.Private += "org.sw.demo.qtproject.qt.base.plugins.platforms.windows" QT_VERSION ""_dep;
    gui.Private += "org.sw.demo.qtproject.qt.base.widgets" QT_VERSION ""_dep;

    // Include directories
    gui.Private += "Projects/GUI/Include/"_id;
    gui.Private += "Dependencies/glm/include"_id;

    qt_moc_rcc_uic("org.sw.demo.qtproject.qt" QT_VERSION ""_dep, gui);
  }
}
egorpugin commented 3 years ago

Update VS2019 to the latest version.

Telokis commented 3 years ago

After updating to 16.11.1, here is what I get:

Exception in file D:/dev/cppan2/client2/src/sw/builder/command.cpp:764, function execute1: When executing: [pub.egorpugin.primitives.templates-master]/src/debug.cpp
C:\Program Files (x86)\Windows Kits\8.1\Include\um\combaseapi.h(229): error C2760: syntax error: unexpected token 'identifier', expected 'type specifier'
command failed: exit code = 2
Exception in file D:/dev/cppan2/client2/src/sw/builder/command.cpp:764, function execute1: When executing: [pub.egorpugin.primitives.command-master]/src/command.cpp
C:\Program Files (x86)\Windows Kits\8.1\Include\um\combaseapi.h(229): error C2760: syntax error: unexpected token 'identifier', expected 'type specifier'
command failed: exit code = 2
Total errors: 2
The terminal process "C:\Program Files\Git\bin\bash.exe '-l', '-c', 'sw -config r --build-name rayon build -output-dir bin'" terminated with exit code: 1.
egorpugin commented 3 years ago

Do you have Win10 SDK, not 8.1?

Telokis commented 3 years ago

Alright that did the trick and the compilation is now working as expected. Thanks a lot for helping me everytime!