Bazel build not respecting my git submodules












1















I'm running a bazel build in a project that is composed of git submodules,
with the following structure:



/work/
├── tensorflow/ [git submodule]
└── train/
└── DeepSpeech/ [git submodule]
└── native_client/


The build command looks like this:



bazel build 
--config=monolithic
-c opt
--copt=-O3
--copt="-D_GLIBCXX_USE_CXX11_ABI=0"
--copt=-fvisibility=hidden
//native_client:libdeepspeech.so
//native_client:generate_trie


and I'm getting the following error:



ERROR: /work/tensorflow/native_client/BUILD:6:1: Executing genrule //native_client:ds_git_version failed (Exit 1)
realpath: /work/train/DeepSpeech/native_client/../.git/: Not a directory


It seems to be complaining that /work/train/DeepSpeech/.git isn't a directory, and it would be correct because /work/train/DeepSpeech/.git is a file, containing the path to the the git tree of the git submodule.



Here are the contents of /work/train/DeepSpeech/.git:



gitdir: ../../.git/modules/train/DeepSpeech


My question is: Is there a way to have bazel respect the submodule structure of my repository? Ideally, there would be some flags I could pass in my bazel build command that would make it magically work, but I'm open to other options.



Thanks for your help!










share|improve this question

























  • Excellent first question @mathematiguy - Good to see you're contributing to the community. I've proposed an edit for you, but for future posts, you can indent blocks of code using ctrl + k, or with 4 spaces, or with a tab. There's also a button in the editor.

    – Addison
    Nov 22 '18 at 0:12
















1















I'm running a bazel build in a project that is composed of git submodules,
with the following structure:



/work/
├── tensorflow/ [git submodule]
└── train/
└── DeepSpeech/ [git submodule]
└── native_client/


The build command looks like this:



bazel build 
--config=monolithic
-c opt
--copt=-O3
--copt="-D_GLIBCXX_USE_CXX11_ABI=0"
--copt=-fvisibility=hidden
//native_client:libdeepspeech.so
//native_client:generate_trie


and I'm getting the following error:



ERROR: /work/tensorflow/native_client/BUILD:6:1: Executing genrule //native_client:ds_git_version failed (Exit 1)
realpath: /work/train/DeepSpeech/native_client/../.git/: Not a directory


It seems to be complaining that /work/train/DeepSpeech/.git isn't a directory, and it would be correct because /work/train/DeepSpeech/.git is a file, containing the path to the the git tree of the git submodule.



Here are the contents of /work/train/DeepSpeech/.git:



gitdir: ../../.git/modules/train/DeepSpeech


My question is: Is there a way to have bazel respect the submodule structure of my repository? Ideally, there would be some flags I could pass in my bazel build command that would make it magically work, but I'm open to other options.



Thanks for your help!










share|improve this question

























  • Excellent first question @mathematiguy - Good to see you're contributing to the community. I've proposed an edit for you, but for future posts, you can indent blocks of code using ctrl + k, or with 4 spaces, or with a tab. There's also a button in the editor.

    – Addison
    Nov 22 '18 at 0:12














1












1








1








I'm running a bazel build in a project that is composed of git submodules,
with the following structure:



/work/
├── tensorflow/ [git submodule]
└── train/
└── DeepSpeech/ [git submodule]
└── native_client/


The build command looks like this:



bazel build 
--config=monolithic
-c opt
--copt=-O3
--copt="-D_GLIBCXX_USE_CXX11_ABI=0"
--copt=-fvisibility=hidden
//native_client:libdeepspeech.so
//native_client:generate_trie


and I'm getting the following error:



ERROR: /work/tensorflow/native_client/BUILD:6:1: Executing genrule //native_client:ds_git_version failed (Exit 1)
realpath: /work/train/DeepSpeech/native_client/../.git/: Not a directory


It seems to be complaining that /work/train/DeepSpeech/.git isn't a directory, and it would be correct because /work/train/DeepSpeech/.git is a file, containing the path to the the git tree of the git submodule.



Here are the contents of /work/train/DeepSpeech/.git:



gitdir: ../../.git/modules/train/DeepSpeech


My question is: Is there a way to have bazel respect the submodule structure of my repository? Ideally, there would be some flags I could pass in my bazel build command that would make it magically work, but I'm open to other options.



Thanks for your help!










share|improve this question
















I'm running a bazel build in a project that is composed of git submodules,
with the following structure:



/work/
├── tensorflow/ [git submodule]
└── train/
└── DeepSpeech/ [git submodule]
└── native_client/


The build command looks like this:



bazel build 
--config=monolithic
-c opt
--copt=-O3
--copt="-D_GLIBCXX_USE_CXX11_ABI=0"
--copt=-fvisibility=hidden
//native_client:libdeepspeech.so
//native_client:generate_trie


and I'm getting the following error:



ERROR: /work/tensorflow/native_client/BUILD:6:1: Executing genrule //native_client:ds_git_version failed (Exit 1)
realpath: /work/train/DeepSpeech/native_client/../.git/: Not a directory


It seems to be complaining that /work/train/DeepSpeech/.git isn't a directory, and it would be correct because /work/train/DeepSpeech/.git is a file, containing the path to the the git tree of the git submodule.



Here are the contents of /work/train/DeepSpeech/.git:



gitdir: ../../.git/modules/train/DeepSpeech


My question is: Is there a way to have bazel respect the submodule structure of my repository? Ideally, there would be some flags I could pass in my bazel build command that would make it magically work, but I'm open to other options.



Thanks for your help!







git bazel mozilla-deepspeech






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 6:27









Addison

1,5972035




1,5972035










asked Nov 21 '18 at 21:54









mathematiguymathematiguy

62




62













  • Excellent first question @mathematiguy - Good to see you're contributing to the community. I've proposed an edit for you, but for future posts, you can indent blocks of code using ctrl + k, or with 4 spaces, or with a tab. There's also a button in the editor.

    – Addison
    Nov 22 '18 at 0:12



















  • Excellent first question @mathematiguy - Good to see you're contributing to the community. I've proposed an edit for you, but for future posts, you can indent blocks of code using ctrl + k, or with 4 spaces, or with a tab. There's also a button in the editor.

    – Addison
    Nov 22 '18 at 0:12

















Excellent first question @mathematiguy - Good to see you're contributing to the community. I've proposed an edit for you, but for future posts, you can indent blocks of code using ctrl + k, or with 4 spaces, or with a tab. There's also a button in the editor.

– Addison
Nov 22 '18 at 0:12





Excellent first question @mathematiguy - Good to see you're contributing to the community. I've proposed an edit for you, but for future posts, you can indent blocks of code using ctrl + k, or with 4 spaces, or with a tab. There's also a button in the editor.

– Addison
Nov 22 '18 at 0:12












1 Answer
1






active

oldest

votes


















1














Bazel indeed doesn't understand Git submodules.



Bazel however has a notion of repositories, and you can specify the structure of your repositories in the WORKSPACE file that's in the root of your workspace, using so-called repository rules.



This page explains the concept of the WORKSPACE file, and I believe this is the rule you'll need.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420995%2fbazel-build-not-respecting-my-git-submodules%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Bazel indeed doesn't understand Git submodules.



    Bazel however has a notion of repositories, and you can specify the structure of your repositories in the WORKSPACE file that's in the root of your workspace, using so-called repository rules.



    This page explains the concept of the WORKSPACE file, and I believe this is the rule you'll need.






    share|improve this answer




























      1














      Bazel indeed doesn't understand Git submodules.



      Bazel however has a notion of repositories, and you can specify the structure of your repositories in the WORKSPACE file that's in the root of your workspace, using so-called repository rules.



      This page explains the concept of the WORKSPACE file, and I believe this is the rule you'll need.






      share|improve this answer


























        1












        1








        1







        Bazel indeed doesn't understand Git submodules.



        Bazel however has a notion of repositories, and you can specify the structure of your repositories in the WORKSPACE file that's in the root of your workspace, using so-called repository rules.



        This page explains the concept of the WORKSPACE file, and I believe this is the rule you'll need.






        share|improve this answer













        Bazel indeed doesn't understand Git submodules.



        Bazel however has a notion of repositories, and you can specify the structure of your repositories in the WORKSPACE file that's in the root of your workspace, using so-called repository rules.



        This page explains the concept of the WORKSPACE file, and I believe this is the rule you'll need.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 22 '18 at 7:24









        LászlóLászló

        2,110216




        2,110216
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420995%2fbazel-build-not-respecting-my-git-submodules%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?