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

[hololens] Move ServoControl to its own project #24020

Open
paulrouget opened this issue Aug 21, 2019 · 20 comments
Open

[hololens] Move ServoControl to its own project #24020

paulrouget opened this issue Aug 21, 2019 · 20 comments
Labels

Comments

@paulrouget
Copy link
Contributor

@paulrouget paulrouget commented Aug 21, 2019

I need help here. I've tried, but failed to create a 2nd project in the solution that would host the ServoControl code only, and make the ServoApp project use that control.

I'm sure it's simple but I don't know how to create a simple winrt project that uses a Generic.xaml file. I keep hitting different compilation issues. Same when I'm trying to remove or rename the class.* files from the winrt template.

@paulrouget
Copy link
Contributor Author

@paulrouget paulrouget commented Aug 23, 2019

STR:

Error C3544 'I': parameter pack expects a type template argument

I also tried to not import ServoComponent and step by step migrate the code to the winrt template, but I always end up hitting this issue. The fact I can't rename Class to Servo is very unnerving.

@angelortiz1007 can you help?

@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Aug 23, 2019

Paul,

I have not forgotten about you. I'm working on it and will have some observations soon.

Angel

@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Aug 23, 2019

Paul,

So I followed your first 2 bullet items and I did get a failure to build the new component. I got the C3544 error along with others such as:
\winrt\base.h(6998): error C3487: 'conditional<_Test,_Ty1,_Ty2>::type': all return expressions must deduce to the same type: previously it was 'default_interface<implemented_interfaces::first_interface,void>::type'

So, if you can, can you try again creating a Winrt component. This time do the following:

  1. Rename the .idl file. In your case you renamed it to Servo.
    When you do this, the file name which was previously Class will not be called Servo.cpp and Servo.h.
    In Servo.cpp change the headers to look like
    #include "pch.h"
    #include "Servo.h"
    #include "Servo.g.cpp"

  2. In Servo.h you will have some implementations (This is the root of the issues). Change references of Class to Servo and References of ClassT to ServoT. Take note of the Capital letters/case!

  3. In Servo.cpp you will still have Class:: etc... Change that to Servo:: etc....

This should do it. Let me know if it works for you.

Note: winrt\base.h will get recreated each time you make a change to the .h, .cpp, or the .idl file.

Hope this gets you past the error.

@paulrouget
Copy link
Contributor Author

@paulrouget paulrouget commented Aug 24, 2019

I was doing all of these steps already. But still getting the error. Did it work for you?

@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Aug 24, 2019

@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Aug 25, 2019

One thing I forgot, but sure you did too is to in the *.idl file.
If you *.idl files compiles. All should go well with the component build.

namespace RuntimeComponent3
{
    [default_interface]
    runtimeclass Class
    {
        Class();
        Int32 MyProperty;
    }
}

To

namespace RuntimeComponent3
{
    [default_interface]
    runtimeclass Servo
    {
        Servo();
        Int32 MyProperty;
    }
}

Here is my renamed/worked on servo.h

#pragma once

#include "Servo.g.h"

namespace winrt::RuntimeComponent3::implementation
{
    struct Servo : ServoT<Servo>
    {
        Servo() = default;

        int32_t MyProperty();
        void MyProperty(int32_t value);
    };
}

namespace winrt::RuntimeComponent3::factory_implementation
{
    struct Servo : ServoT<Servo, implementation::Servo>
    {
    };
}

Make certain your VS2017 is up to date with SDK and patches.

Make certain VS2017 does a clean of the solution.

Make certain the module.g.cpp shows Servo instead of Class.

Here is output from my build:
1>Saved output metadata file RuntimeComponent3.winmd.
1>Validating metadata file C:\Users\Angel\source\repos\RuntimeComponent3\Debug\RuntimeComponent3\Merged\RuntimeComponent3.winmd.
1>pch.cpp
1>Servo.cpp
1>module.g.cpp
1> Creating library C:\Users\Angel\source\repos\RuntimeComponent3\Debug\RuntimeComponent3\RuntimeComponent3.lib and object C:\Users\Angel\source\repos\RuntimeComponent3\Debug\RuntimeComponent3\RuntimeComponent3.exp
1>RuntimeComponent3.vcxproj -> C:\Users\Angel\source\repos\RuntimeComponent3\Debug\RuntimeComponent3\RuntimeComponent3.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

@paulrouget

This comment was marked as off-topic.

@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Aug 26, 2019

Will do!

int main(int argc, char **argv)
{
    printf("WIll do.!\n");
    return 0;
}

By the way, my contract will be ending in 2 weeks. Do you know of any other managers that need C/C++ developers in Windows/UNIX/Linux?

@paulrouget
Copy link
Contributor Author

@paulrouget paulrouget commented Aug 27, 2019

Check with @jdm.

@paulrouget
Copy link
Contributor Author

@paulrouget paulrouget commented Sep 3, 2019

@angelortiz1007 Yeah I done all of the things you mention. But still no luck.

Did you manage to compile a project named "Servo" within the hololens solution?

Can you look at this branch: https://github.com/paulrouget/servo/tree/ServoProject - the last commit doesn't compile. I have no idea why.

@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Sep 3, 2019

Paul, I tried a clone and was not able to get all the files. Not even a git checkout HEAD.

Can you verify the repository checks out for you?

@paulrouget
Copy link
Contributor Author

@paulrouget paulrouget commented Sep 4, 2019

Hmm, there's nothing special here. It works.

In your servo directory:

  • git remote add paul git@github.com:paulrouget/servo.git
  • git checkout -b ServoProject paul/ServoProject
@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Sep 4, 2019

Hmmm....

C:\git-mozilla\servo-angelortiz2>git remote add paul git@github.com:paulrouget/servo.git

C:\git-mozilla\servo-angelortiz2>git checkout -b ServoProject paul/ServoProject
fatal: 'paul/ServoProject' is not a commit and a branch 'ServoProject' cannot be created from it

@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Sep 4, 2019

I think I have to clone your https://github.com/paulrouget/servo/tree/ServoProject then do the git checkout. In either case, when I did a clone of https://github.com/paulrouget/servo/tree/ServoProject it didn't download all the files.

C:\git-mozilla\servo-angelortiz2>git remote -v
origin https://github.com/servo/servo.git (fetch)
origin https://github.com/servo/servo.git (push)
paul git@github.com:paulrouget/servo.git (fetch)
paul git@github.com:paulrouget/servo.git (push)

@jdm
Copy link
Member

@jdm jdm commented Sep 4, 2019

You need to run git fetch fetch ServoProject in the repo with a paul remote, or git fetch origin ServoProject in the clone of paulrouget/servo.

@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Sep 5, 2019

So, something is not going well for me. I've done:

git clone https://github.com/paulrouget/servo.git paulrouget
got errors:

C:\git-mozilla>git clone https://github.com/paulrouget/servo.git paulrouget2
Cloning into 'paulrouget2'...
remote: Enumerating objects: 646390, done.
remote: Total 646390 (delta 0), reused 0 (delta 0), pack-reused 646390
Receiving objects: 100% (646390/646390), 691.41 MiB | 619.00 KiB/s, done.
Resolving deltas: 100% (460097/460097), done.
error: unable to create file tests/ref/hello_a?foo#bar.html: Invalid argument
Checking out files: 100% (114038/114038), done.
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

cd paulrouget2

C:\git-mozilla\paulrouget2>git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
(use "git reset HEAD ..." to unstage)

    deleted:    .gitattributes
    deleted:    .gitignore
    deleted:    .gitmodules
    deleted:    .travis.yml
    deleted:    CONTRIBUTING.md
    deleted:    Info.plist
    deleted:    LICENSE
    deleted:    ORGANIZATION.md
    deleted:    README.md
    deleted:    cargo-nightly-build
    deleted:    components/canvas/Cargo.toml
    deleted:    components/canvas/canvas_paint_task.rs

C:\git-mozilla\paulrouget2>git remote -v
origin https://github.com/paulrouget/servo.git (fetch)
origin https://github.com/paulrouget/servo.git (push)

C:\git-mozilla\paulrouget2>git remote add paul git@github.com:paulrouget/servo.git

C:\git-mozilla\paulrouget2>git remote -v
origin https://github.com/paulrouget/servo.git (fetch)
origin https://github.com/paulrouget/servo.git (push)
paul git@github.com:paulrouget/servo.git (fetch)
paul git@github.com:paulrouget/servo.git (push)

C:\git-mozilla\paulrouget2>

C:\git-mozilla\paulrouget2>git fetch origin ServoProject
From https://github.com/paulrouget/servo

  • branch ServoProject -> FETCH_HEAD

C:\git-mozilla\paulrouget2>

C:\git-mozilla\paulrouget2>git checkout -b ServoProject paul/ServoProject
fatal: 'paul/ServoProject' is not a commit and a branch 'ServoProject' cannot be created from it

C:\git-mozilla\paulrouget2>git checkout -b ServoProject origin/ServoProject
error: The following untracked working tree files would be overwritten by checkout:
.gitattributes
.gitignore
.travis.yml
CONTRIBUTING.md
Info.plist
LICENSE
README.md
components/canvas/Cargo.toml
components/canvas/lib.rs
components/canvas_traits/Cargo.toml
components/canvas_traits/lib.rs
components/compositing/Cargo.toml
components/compositing/compositor.rs
components/compositing/lib.rs
components/compositing/windowing.rs
components/devtools/Cargo.toml
components/devtools/actor.rs
components/devtools/actors/console.rs
components/devtools/actors/framerate.rs
components/devtools/actors/inspector.rs
components/devtools/actors/memory.rs
components/devtools/actors/network_event.rs
components/devtools/actors/root.rs
components/devtools/actors/timeline.rs
components/devtools/actors/worker.rs
components/devtools/lib.rs
components/devtools/protocol.rs
components/devtools_traits/Cargo.toml
components/devtools_traits/lib.rs
components/gfx/Cargo.toml
components/gfx/font.rs
components/gfx/font_context.rs
components/gfx/font_template.rs
components/gfx/lib.rs
components/gfx/platform/freetype/font.rs
components/gfx/platform/freetype/font_context.rs
components/gfx/platform/freetype/font_list.rs
components/gfx/platform/freetype/font_template.rs
components/gfx/platform/macos/font.rs
components/gfx/platform/macos/font_context.rs
components/gfx/platform/macos/font_list.rs
components/gfx/platform/macos/font_template.rs
components/gfx/platform/mod.rs
components/gfx/text/glyph.rs
components/gfx/text/mod.rs
components/gfx/text/shaping/harfbuzz.rs
components/gfx/text/shaping/mod.rs
components/gfx/text/text_run.rs
components/gfx/text/util.rs
components/gfx_traits/Cargo.toml
components/gfx_traits/lib.rs
components/layout/Cargo.toml
components/layout/animation.rs
components/layout/block.rs
components/layout/construct.rs
components/layout/context.rs
components/layout/data.rs
components/layout/floats.rs
components/layout/flow.rs
components/layout/flow_list.rs
components/layout/flow_ref.rs
components/layout/fragment.rs
components/layout/generated_content.rs
components/layout/incremental.rs
components/layout/inline.rs
components/layout/layout_debug.rs
components/layout/lib.rs
components/layout/list_item.rs
components/layout/model.rs
components/layout/multicol.rs
components/layout/opaque_node.rs
components/layout/parallel.rs
components/layout/query.rs
components/layout/sequential.rs
components/layout/table.rs
components/layout/table_caption.rs
components/layout/table_cell.rs
components/layout/table_colgroup.rs
components/layout/table_row.rs
components/layout/table_rowgroup.rs
components/layout/table_wrapper.rs
components/layout/text.rs
components/layout/traversal.rs
components/layout/wrapper.rs
components/layout_traits/Cargo.toml
components/layout_traits/lib.rs
components/msg/Cargo.toml
components/msg/constellation_msg.rs
components/msg/lib.rs
components/net/Cargo.toml
components/net/cookie.rs
components/net/cookie_storage.rs
components/net/data_loader.rs
components/net/fetch/cors_cache.rs
components/net/hsts.rs
components/net/http_loader.rs
components/net/lib.rs
components/net/mime_classifier.rs
components/net_traits/Cargo.toml
components/net_traits/image/base.rs
components/net_traits/lib.rs
components/profile/Cargo.toml
components/profile/lib.rs
components/profile/mem.rs
components/profile/time.rs
components/profile_traits/Cargo.toml
components/profile_traits/lib.rs
components/profile_traits/mem.rs
components/profile_traits/time.rs
components/script/Cargo.toml
components/script/build.rs
components/script/clipboard_provider.rs
components/script/devtools.rs
components/script/document_loader.rs
components/script/dom/activation.rs
components/script/dom/attr.rs
components/script/dom/bindings/callback.rs
components/script/dom/bindings/cell.rs
components/script/dom/bindings/codegen/BindingGen.py
components/script/dom/bindings/codegen/Bindings.conf
components/script/dom/bindings/codegen/CodegenRust.py
components/script/dom/bindings/codegen/Config
error: The following untracked working tree files would be removed by checkout:
.gitmodules
ORGANIZATION.md
cargo-nightly-build
components/canvas/canvas_paint_task.rs
components/canvas/webgl_paint_task.rs
components/compositing/compositor_layer.rs
components/compositing/compositor_task.rs
components/compositing/constellation.rs
components/compositing/headless.rs
components/compositing/pipeline.rs
components/compositing/scrolling.md
components/compositing/scrolling.rs
components/compositing/surface_map.rs
components/devtools/actors/tab.rs
components/gfx/display_list/mod.rs
components/gfx/display_list/optimizer.rs
components/gfx/filters.rs
components/gfx/font_cache_task.rs
components/gfx/paint_context.rs
components/gfx/paint_task.rs
components/gfx_traits/color.rs
components/layout/css/matching.rs
components/layout/display_list_builder.rs
components/layout/layout_task.rs
components/msg/compositor_msg.rs
components/msg/webdriver_msg.rs
components/net/about_loader.rs
components/net/fetch/request.rs
components/net/fetch/response.rs
components/net/file_loader.rs
components/net/image_cache_task.rs
components/net/net_error_list.rs
components/net/pub_domains.rs
components/net/resource_task.rs
components/net/storage_task.rs
components/net_traits/hosts.rs
components/net_traits/image_cache_task.rs
components/net_traits/storage_task.rs
components/plugins/Cargo.toml
components/plugins/casing.rs
components/plugins/heap_size.rs
components/plugins/jstraceable.rs
components/plugins/lib.rs
components/plugins/lints/ban.rs
components/plugins/lints/inheritance_integrity.rs
components/plugins/lints/mod.rs
components/plugins/lints/privatize.rs
components/plugins/lints/str_to_string.rs
components/plugins/lints/transmute_type.rs
components/plugins/lints/unrooted_must_root.rs
components/plugins/reflector.rs
components/plugins/utils.rs
components/script/cors.rs
components/script/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py
components/script/dom/bindings/codegen/parser/external.patch
components/script/dom/bindings/codegen/parser/module.patch
components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py
components/script/dom/bindings/global.rs
components/script/dom/bindings/js.rs
components/script/dom/browsercontext.rs
components/script/dom/domrectlist.rs
components/script/dom/eventdispatcher.rs
components/script/dom/htmlappletelement.rs
components/script/dom/htmltabledatacellelement.rs
components/script/dom/htmltableheadercellelement.rs
components/script/dom/servohtmlparser.rs
components/script/dom/webidls/BrowserElement.webidl
components/script/dom/webidls/DOMRectList.webidl
components/script/dom/webidls/HTMLAppletElement.webidl
components/script/dom/webidls/HTMLTableDataCellElement.webidl
components/script/dom/webidls/HTMLTableHeaderCellElement.webidl
components/script/dom/webidls/PerformanceTiming.webidl
components/script/dom/webidls/ServoHTMLParser.webidl
components/script/dom/webidls/SharedMouseAndKeyboardEventInit.webidl
components/script/dom/webidls/URLUtils.webidl
components/script/dom/webidls/URLUtilsReadOnly.webidl
components/script/horribly_inefficient_timers.rs
components/script/layout_interface.rs
components/script/makefile.cargo
components/script/page.rs
components/script/parse/html.rs
components/script/parse/mod.rs
components/script/script_task.rs
components/servo/.cargo/config
components/servo/Cargo.lock
components/servo/main.rs
components/style/Mako-0.9.1.zip
components/style/legacy.rs
components/style/media_queries.rs
components/style/node.rs
components/style/properties.mako.rs
components/style/selector_matching.rs
components/style/stylesheets.rs
components/style/values.rs
components/style/viewport.rs
components/util/Cargo.toml
components/util/bezier.rs
components/util/cache.rs
components/util/cursor.rs
components/util/debug_utils.rs
components/util/deque/mod.rs
components/util/geometry.rs
components/util/ipc.rs
components/util/lib.rs
components/util/linked_list.rs
components/util/logical_geometry.rs
componen
Aborting

C:\git-mozilla\paulrouget2>

@paulrouget
Copy link
Contributor Author

@paulrouget paulrouget commented Sep 5, 2019

Your checkout is failing. This is because my version of Servo's repository master branch has an invalid file. But not in the branch I shared with you. You don't need another clone of servo.

2 options:

In a already successfully checked-out servo directory:

git remote add paul git@github.com:paulrouget/servo.git
git fetch paul
git checkout -b ServoProject paul/ServoProject

Or, a new clone (I fixed the file issue):

git clone https://github.com/paulrouget/servo.git paulrouget2
cd paulrouget2
git checkout -b ServoProject origin/ServoProject

To verify you are on the right branch:

git log -1

Should show commit 05df345.

@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Sep 5, 2019

OK. The 2nd option worked for me after you resolved the files issue. I'm currently building servo then hololens. Just to be clear, it is hololens that is failing, correct?

BTW.................
Strange, the first option above didn't work for me with the following error when doing a fetch:
C:\git-mozilla\servo-angelortiz2>git remote add paul git@github.com:paulrouget/servo.git
fatal: remote paul already exists.

C:\git-mozilla\servo-angelortiz2>git fetch paul
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

C:\git-mozilla\servo-angelortiz2>git remote -v
origin https://github.com/servo/servo.git (fetch)
origin https://github.com/servo/servo.git (push)
paul git@github.com:paulrouget/servo.git (fetch)
paul git@github.com:paulrouget/servo.git (push)

@jdm
Copy link
Member

@jdm jdm commented Sep 5, 2019

git@ remotes don't work without the correct SSH keys present. https://github.com/paulrouget/servo.git as the remote would work instead.

@angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Sep 5, 2019

Paul, I got my environment setup. Yep, this is a strange one. I'm still working through it and believe it has to do with the Servo and ServoT structs. The servo.g.h file has:

#include "winrt/Servo.h"
namespace winrt::Servo::implementation
{
    template <typename D, typename... I>
    struct __declspec(empty_bases) Servo_base : implements<D, Servo::Servo, I...>
    {
        using base_type = Servo_base;
        using class_type = Servo::Servo;
        using implements_type = typename Servo_base::implements_type;
        using implements_type::implements_type;
        
        hstring GetRuntimeClassName() const
        {
            return L"Servo.Servo";
        }
    };
}

The first error below is related - I believe - to the additional errors below it.

1>c:\git-mozilla\paulrouget2\support\hololens\servo\generated files\servo.g.h(8): error C3544: 'I': parameter pack expects a type template argument
1>c:\git-mozilla\paulrouget2\support\hololens\servo\generated files\servo.g.h(19): note: see reference to class template instantiation 'winrt::Servo::implementation::Servo_base<D,I...>' being compiled
1>c:\git-mozilla\paulrouget2\support\hololens\servo\generated files\servo.g.h(9): error C2955: 'winrt::implements': use of class template requires template argument list
1>c:\git-mozilla\paulrouget2\support\hololens\servo\generated files\winrt\base.h(7015): note: see declaration of 'winrt::implements'
1>c:\git-mozilla\paulrouget2\support\hololens\servo\generated files\servo.g.h(11): error C2061: syntax error: identifier '{ctor}'
1>c:\git-mozilla\paulrouget2\support\hololens\servo\generated files\servo.g.h(26): error C2061: syntax error: identifier '{ctor}'

The {ctor} error points to line using class_type = Servo::Servo;

I got to look at it more. See what you uncover tonight and if what I'm saying rings a bell.

I'll continue in the morning.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.