We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4261 - ./configure works only with /bin/sh -> /bin/bash, and does not with /bin/sh -> /bin/dash
Summary: ./configure works only with /bin/sh -> /bin/bash, and does not with /bin/sh -...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: 2.0.8
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.16
Depends on:
Blocks:
 
Reported: 2018-09-17 22:08 UTC by the.dmol
Modified: 2021-01-09 22:54 UTC (History)
6 users (show)

See Also:


Attachments
configure-posix-conformance.patch (2.99 KB, patch)
2020-06-01 20:34 UTC, Matt Whitlock
Details | Diff
dash-bug-workaround.patch (3.10 KB, patch)
2020-06-01 20:34 UTC, Matt Whitlock
Details | Diff
dash-bug-workaround.patch (3.01 KB, patch)
2020-06-01 20:41 UTC, Matt Whitlock
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description the.dmol 2018-09-17 22:08:47 UTC
Void linux has "/bin/dash" symblinked to "/bin/sh" by default. 

When running configure it successfully terminates:

checking for Vivante FB API... no
../configure: 1: ../configure: objects: not found
../configure: 1: ../configure: objects: not found
../configure: 1: ../configure: objects: not found
../configure: 1: ../configure: objects: not found
../configure: 1: ../configure: objects: not found
../configure: 1: ../configure: objects: not found
../configure: 1: ../configure: objects: not found
../configure: 1: ../configure: objects: not found
checking for linker option --enable-new-dtags... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sdl2-config
config.status: creating sdl2-config.cmake
config.status: creating SDL2.spec
config.status: creating sdl2.pc
config.status: creating include/SDL_config.h
config.status: include/SDL_config.h is unchanged
config.status: executing libtool commands
config.status: executing sdl2_config commands
config.status: executing summary commands
-en SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   : mmx 3dnow sse sse2 sse3
Audio drivers   : disk dummy oss alsa(dynamic) pulse(dynamic)
Video drivers   : dummy x11(dynamic) opengl opengl_es1 opengl_es2 vulkan wayland(dynamic)
X11 libraries   : xcursor xdbe xinerama xinput2 xinput2_multitouch xrandr xscrnsaver xshape xvidmode
Input drivers   : linuxev linuxkd
Using libsamplerate : YES
Using libudev       : YES
Using dbus          : YES
Using ime           : YES
Using ibus          : NO
Using fcitx         : NO


(please, notice the silently ignored "objects: not found") 

When I try to build it next, it fails however:

 make
make: *** No rule to make target '@echo', needed by 'gen/relative-pointer-unstable-v1-client-protocol.h'.  Stop.


When I switch system alternative to let /bin/sh be /bin/bash it is configured fine (without the ""objects: not found"), and builds successfully. 

It took quite a few hours to figure out what's wrong. I hope, fixing it will save them for somebody else.

Thanks!
Comment 1 Ryan C. Gordon 2018-09-18 04:02:39 UTC
Can you tell me what version of dash you're using? The version in Ubuntu 16.10 appears to work with SDL's configure script (just running "mkdir buildbot ; cd buildbot ; dash ../configure"  ...but /bin/sh is also symlinked to dash, fwiw).

dash --version doesn't work, but Ubuntu's apt cache tells me it's version "0.5.8-2.3ubuntu1" ... so about 0.5.8?

--ryan.
Comment 2 the.dmol 2018-09-18 09:22:30 UTC
dash-0.5.10.2_1
Comment 3 Kim Scarborough 2019-09-29 10:28:32 UTC
I just got hit by this as well, and was going crazy trying to figure it out until I found this bug. Please, if this can't be fixed, at least make a note of it in the docs.
Comment 4 Ryan C. Gordon 2019-09-29 13:46:38 UTC

Just tried this on Ubuntu 19.04, and I _still_ can't reproduce it:

$ apt-cache show dash |grep Version
Version: 0.5.10.2-4ubuntu1

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Sep 26 19:27 /bin/sh -> dash

I changed my login shell from bash to /bin/sh, regenerated the configure script, and ran configure, and I can't get this to happen.

So there's got to be _something_ causing this, but it's not as simple as /bin/sh pointing to dash.

--ryan.
Comment 5 Michael Orlitzky 2020-04-08 17:16:12 UTC
The reason you're unable to reproduce this is because Debian purposely cripples their Dash package so that bash will always be used for ./configure scripts:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=842242

Clever, right?

To work around that helpful contribution, try specifying CONFIG_SHELL=/bin/dash on the command-line when you run ./configure, e.g.

  $ CONFIG_SHELL="/bin/dash" ./configure

If that doesn't work for some reason, you can always download and build your own copy of dash (it only takes a second), and then point /bin/sh to the one you've just built. The copy you build will not be crippled, and autotools will happily use it.

We have a report of this in Gentoo now too,

  https://bugs.gentoo.org/714094

but with any luck it's easy to fix now that you know how to reproduce it.
Comment 6 Matt Whitlock 2020-06-01 20:34:04 UTC
Created attachment 4365 [details]
configure-posix-conformance.patch

There are actually two distinct classes of problems at play here. On the one hand, libsdl2's configure.ac has some POSIX conformance issues — namely, the use of 'echo -n' and the passage of arguments containing embedded backslashes to 'echo', neither of which is defined by POSIX. The attached patch takes care of these issues.
Comment 7 Matt Whitlock 2020-06-01 20:34:12 UTC
Created attachment 4366 [details]
dash-bug-workaround.patch

On the other hand, Dash has a confirmed bug[1] in its handling of backslash escape sequences following embedded newlines within backquoted command substitution. The attached patch works around this bug.

____________

[1] https://www.mail-archive.com/dash@vger.kernel.org/msg01935.html
Comment 8 Matt Whitlock 2020-06-01 20:41:38 UTC
Created attachment 4367 [details]
dash-bug-workaround.patch

Apologies. The patch I submitted was based upon the application of a downstream (Gentoo) patch. Attached here is a replacement that applies cleanly to upstream libsdl 2.0.12.
Comment 9 Michael Orlitzky 2020-06-01 20:53:21 UTC
(In reply to Matt Whitlock from comment #8)
> 
> Apologies. The patch I submitted was based upon the application of a
> downstream (Gentoo) patch.

Sorry =\

I dropped that patch from app-shells/dash-0.5.10.2 (the ~arch version) for exactly this reason.
Comment 10 Matt Whitlock 2020-06-01 21:10:10 UTC
(In reply to Michael Orlitzky from comment #9)
> (In reply to Matt Whitlock from comment #8)
> > 
> > Apologies. The patch I submitted was based upon the application of a
> > downstream (Gentoo) patch.
> 
> I dropped that patch

I was referring to libsdl2-2.0.12-static-libs.patch, which is a patch in Gentoo to make libsdl2 support building static libraries. It is unrelated to Dash.
Comment 11 Michael Orlitzky 2020-06-01 22:14:09 UTC
(In reply to Matt Whitlock from comment #10)
> 
> I was referring to libsdl2-2.0.12-static-libs.patch, which is a patch in
> Gentoo to make libsdl2 support building static libraries. It is unrelated to
> Dash.

Oh, I thought you were talking about the problems resulting from dash-0.5.9.1-dumb-echo.patch. Please ignore me =)

Thanks for working on this by the way.
Comment 12 Matt Whitlock 2020-06-03 19:03:17 UTC
The Dash bug has been fixed in Dash 0.5.11. The workaround is no longer needed as of that version, although it does not hurt to keep it.

The POSIX conformance patch is still relevant.
Comment 13 Ozkan Sezer 2020-12-27 11:02:00 UTC
configure-posix-conformance.patch applied as https://hg.libsdl.org/SDL/rev/ba2e2b27a6e0
Closing as fixed.
Comment 14 rose.garcia-eggl2fk 2021-01-09 17:12:42 UTC
this bug doesn't seem to be entirely fixed yet.

i applied https://hg.libsdl.org/SDL/raw-diff/ba2e2b27a6e0/configure.ac (the patch supposedly fixing this) to 2.0.14 release sources, rebuilt configure with autoreconf -i, and still get the following output when running ./configure:

./configure: 1: ./configure: objects: not found
[several times]

when running gnu make (3.82):

make: *** No rule to make target `build/SDL.lo', needed by `build/libSDL2.la'.  Stop.

my first guess was that the sed statements used to process DEPENDS are not posix conforming (i use busybox sed), but trying with gnu sed instead made no difference.

the produced Makefile contains this part generated from the cat << EOF > Makefile part of the configure script:

# Special dependency for SDL.c, since it depends on SDL_revision.h
/src/build/sdl2/SDL2-2.0.14/src/SDL.c: update-revision
/SDL.lo: /src/build/sdl2/SDL2-2.0.14/src/SDL.c $(objects)/.created      $(RUN_CMD_CC)$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MMD -MT $@ -c $< -o $@
/SDL_assert.lo: /src/build/sdl2/SDL2-2.0.14/src/SDL_assert.c $(objects)/.created        $(RUN_CMD_CC)$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MMD -MT $@ -c $< -o $@
/SDL_dataqueue.lo: /src/build/sdl2/SDL2-2.0.14/src/SDL_dataqueue.c $(objects)/.created  $(RUN_CMD_CC)$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MMD -MT $@ -c $< -o $@
[etc]

only when running SHELL=bash SH=bash bash configure the configure errors go away and Makefile contains

# Special dependency for SDL.c, since it depends on SDL_revision.h
/src/build/sdl2/SDL2-2.0.14/src/SDL.c: update-revision

$(objects)/SDL.lo: /src/build/sdl2/SDL2-2.0.14/src/SDL.c $(objects)/.created
        $(RUN_CMD_CC)$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MMD -MT $@ -c $< -o $@

$(objects)/SDL_assert.lo: /src/build/sdl2/SDL2-2.0.14/src/SDL_assert.c $(objects)/.created
        $(RUN_CMD_CC)$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MMD -MT $@ -c $< -o $@
[etc]

with which the make process can be successfully started.
my dash version is 0.5.11.2, built from source.
Comment 15 Ozkan Sezer 2021-01-09 17:44:20 UTC
(In reply to rose.garcia-eggl2fk from comment #14)
> this bug doesn't seem to be entirely fixed yet.

Please give us a patch.
Comment 16 rose.garcia-eggl2fk 2021-01-09 22:54:25 UTC
actually, i was using dash-0.5.10.2, and not as claimed 0.5.11.2. after updating dash, the problem went away (even vanilla 2.0.14 sources build).
the confusion is the result of dash not even having a --version command line switch (-v didn't work either, and the manpage doesn't mention anything displaying the version). sorry for the noise.