问题
When i try using git submodules and type the usual command git submodule
on my Intel Edison running Yocto Linux and git 2.0.1, I just get the following error message:
$> git submodule init
git: 'submodule' is not a git command. See 'git --help'
System version is:
$> uname -r
3.10.17-poky-edison+
$> git --version
git version 2.0.1
$> configure_edison --version
159
No tracks of that error on google.
Is there an extra package to install ? Or is it because of git 2.0.1 ?
On my Ubuntu (git 1.9.1) these commands work just fine.
回答1:
Yes, the Git on Edison might be a light weight version. As mentioned by msw in the comments, the best option is to build git from source. But I believe the next version of Yocto package might come with a new version of git.
回答2:
It appears when building git
with Yocto the behavior is as intended. Unfortunately the intended behavior is not what you would expect. On Ubuntu, git-submodule
is included in the package git
, on Yocto in package git-perltools
. When you run bitbake git
the following packages are built (Thud):
ferry@delfion:~/.../out/linux64/build/tmp/work/corei7-32-poky-linux/git/2.18.1-r0/deploy-debs/corei7-32$ ls -l
- git_2.18.1-r0_i386.deb
- git-bash-completion_2.18.1-r0_i386.deb
- git-dbg_2.18.1-r0_i386.deb
- git-dev_2.18.1-r0_i386.deb
- git-doc_2.18.1-r0_i386.deb
- git-perltools_2.18.1-r0_i386.deb
- gitweb_2.18.1-r0_i386.deb
with git-perltools
containing git-submodule
.
How could you know in advance? Checkout https://layers.openembedded.org. You can easily find: http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/git/git.inc?h=thud, which contains:
PERLTOOLS = " \
${libexecdir}/git-core/git-add--interactive \
${libexecdir}/git-core/git-archimport \
${libexecdir}/git-core/git-cvsexportcommit \
${libexecdir}/git-core/git-cvsimport \
${libexecdir}/git-core/git-cvsserver \
${bindir}/git-cvsserver \
${libexecdir}/git-core/git-difftool \
${libexecdir}/git-core/git-send-email \
${libexecdir}/git-core/git-svn \
${libexecdir}/git-core/git-instaweb \
${libexecdir}/git-core/git-submodule \
${libexecdir}/git-core/git-am \
${libexecdir}/git-core/git-request-pull \
${datadir}/gitweb/gitweb.cgi \
${datadir}/git-core/templates/hooks/prepare-commit-msg.sample \
${datadir}/git-core/templates/hooks/pre-rebase.sample \
${datadir}/git-core/templates/hooks/fsmonitor-watchman.sample \
"
# Git tools requiring perl
PACKAGES =+ "${PN}-perltools"
FILES_${PN}-perltools += " \
${PERLTOOLS} \
${libdir}/perl \
${datadir}/perl5 \
"
So adding not only git
, but also git-perltools
to your core-image
will get you what you want + a bit more.
OTOH Yocto has a nice feature that builds you a cross-compiler environment on your host. So you can configure to use f.i. QT Creator to build using the sdk and remote debug the target from your host. That way you don't need to build/install your toolchain on the Intel Edison. More on this here: https://edison-fw.github.io/meta-intel-edison/3-Building-the-SDK.html
Ferry Toth (aka htot@github)
回答3:
The question is old but as I fell on the same problem on Edison board is here my workaround, it may still interest some people.
The yocto version I am using for Edison is this one: https://github.com/edison-fw/meta-intel-edison
The problem happens because the git version on Edison board is missing some parts. In this case the git-submodules binary is missing in /usr/libexec/git-core
So once you have built the yocto image following the explanations you can find on the same link above (or here https://edison-fw.github.io/meta-intel-edison/) and flashed your board, you will have to copy the file git-submodules from your host pc to your edison board.
On your host, once in your build directory (path/to/edison/out/linux64/build), type:
find . -name "git-submodule"
And you will get different locations for the same file. Take one of it.
Copy it on the edison board to /usr/libexec/git-core.
Now the git with submodule should hopefully work...
UPDATE:
Ferry answer is better but in someways it does not work on my side (yocto sumo). Package git-perltools
is part of git
package, so no need to add it to your core-image, but it is still not installed. I found that package git-perltools
depends on findutils
to be installed, so adding findutils
to core-image might be needed for Ferry's answer to work.
NB:
I would have preferred to comment Ferry answer, but I don't have the rights.
来源:https://stackoverflow.com/questions/35159477/error-git-submodule-is-not-a-git-command-on-intel-edison-and-git-2-0-1