(2018-06-29, 00:28)n0n4m3 Wrote: this post is not really concerning the new build, but i am new here and do not know a better forum...
The best forum for this type of discussion would be
https://forum.libreelec.tv, or github.com if you're able to identify the pull request that introduced the problem (which, in this case, is
PR2785).
(2018-06-29, 00:28)n0n4m3 Wrote: I am compiling LibreELEC for my own and today i encountered a compiling error(compile_command+=: not found ....)
Fortunately we're aware of this issue, but the bug is rather subtle, triggered by an unusual build host configuration.
Check your build host and see if you have
/bin/sh
symbolically linked to
/bin/bash
, ie.
text:
$ ls -la /bin/sh
lrwxrwxrwx 1 root root 4 Nov 5 2017 /bin/sh -> bash
tl;dr: the
configure
script used by
popt
is broken. Sym link
/bin/sh
to
/bin/dash
.
What is happening is that the
configure
script in the
popt
package is executed, which invokes
#!/bin/sh
which, due to the sym link, actually invokes
bash
. Eventually
configure
is supposed to re-invoke itself using the configured
CONFIG_SHELL
, ie.
$TOOLCHAIN/bin/dash
, but doesn't, because the sym linked shell (which is
bash
, and not
sh
or even
dash
)
meets all the preconditions for
configure
, so a new (and correct) shell is never invoked.
configure
then proceeds to generate the
libtool
script, and while generating this code it will
test the currently executing shell which should by now be
$TOOLCHAIN/bin/dash
but because the shell is still
/bin/sh
(ie.
bash
), it generates code that includes "bashisms".
Consequently,
libtool
is invoked with the
$TOOLCHAIN/bin/dash
shell which is unable to understand the generated bashism:
text:
# Append VALUE to the end of shell variable VAR.
func_append ()
{
eval "$1+=\$2"
}
The solution of course is to fix the
popt
package, but this hasn't been updated in years, and the
configure
code is horrible - you fix one bug only to reveal another. We might look for an updated package, if there is one, but this isn't the only package with this problem, so I'm not sure it's worth fixing - apparently
jq
and
tvheadend
may suffer from the same problem.
Your proposed fix will only work so long as everyone is using
$TOOLCHAIN/bin/dash
which is not guaranteed as there is the option to not use
dash
(so you could in fact build with
CONFIG_SHELL=/bin/bash
on the command line, which should work for you and avoid the confusion over
sh
/
bash
/
dash
, it will just take longer to build as
bash
is slower than
dash
).
The alternative, and the solution I'm recommending, is just to not sym link
/bin/sh
to
bash
in the first place, as
sh
and
bash
are very different shells. This may at one time have been a standard, over 3-4+ years ago, but I don't think it is recommended these days - the system shell should be a POSIX compliant shell, and
bash
is not POSIX compliant. Ubuntu, for instance, will now use
/bin/dash
as the standard system shell as
dash
is POSIX compliant (Ubuntu will sym link
/bin/sh
to
dash
)
You can still configure your own user account to use whatever shell you prefer, including
/bin/bash
- just don't sym link the system shell to
/bin/bash
.