Menu

#104 gcc.mak not /bin/sh compliant

5.0
open-later
5
2007-01-04
2007-01-02
jkalucki
No

Uses expansions which may be /bin/bash features, not POSIX /bin/sh ones.

If you attempt to build STLPort5.0.2 or 5.1 on Ubuntu Edgy Eft, 6.10, with the gcc makefiles, you will get a makefile shell expansion error:

c++ -pthread -fexceptions -fident -fPIC -O2 -fuse-cxa-atexit -D_STLP_REAL_LOCALE_IMPLEMENTED -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I../../stlport -I/export/home/ptr/workshop/extern/boost -shared -Wl,-hlibstlport.so.5.0 -nostdlib -o obj/gcc/shared/libstlport.so.5.0.2 crt{i,beginS}.o obj/gcc/shared/dll_main.o obj/gcc/shared/fstream.o obj/gcc/shared/strstream.o obj/gcc/shared/sstream.o obj/gcc/shared/ios.o obj/gcc/shared/stdio_streambuf.o obj/gcc/shared/istream.o obj/gcc/shared/ostream.o obj/gcc/shared/iostream.o obj/gcc/shared/codecvt.o obj/gcc/shared/collate.o obj/gcc/shared/ctype.o obj/gcc/shared/monetary.o obj/gcc/shared/num_get.o obj/gcc/shared/num_put.o obj/gcc/shared/num_get_float.o obj/gcc/shared/num_put_float.o obj/gcc/shared/numpunct.o obj/gcc/shared/time_facets.o obj/gcc/shared/messages.o obj/gcc/shared/locale_impl.o obj/gcc/shared/locale_catalog.o obj/gcc/shared/facets_byname.o obj/gcc/shared/complex.o obj/gcc/shared/complex_exp.o obj/gcc/shared/complex_io.o obj/gcc/shared/complex_trig.o obj/gcc/shared/complex_io_w.o obj/gcc/shared/string_w.o obj/gcc/shared/c_locale.o obj/gcc/shared/cxa.o -Wl,--whole-archive -lsupc++ -Wl,--no-whole-archive -lgcc_s -lpthread -lc -lm crt{endS,n}.o
c++: crt{i,beginS}.o: No such file or directory
c++: crt{endS,n}.o: No such file or directory
make: *** Error 1

This issue is caused by STLport using what may be non-POSIX /bin/sh features in makefile ${shell xxx} expansions. Ubuntu Edgy Eft 6.10 links /bin/sh to /bin/dash, rather than /bin/bash, causing any script that depends on bash features to break.

Workaround is to link /bin/sh to /bin/bash:
sudo rm /bin/sh
sodu ln -s /bin/bash /bin/sh

FWIW: The long term fix would be for STLport to be both bash and dash compliant. Or, perhaps, fix dash to accept the {x,y,z} syntax.

See debates elsewhere on the Interweb about this controversial move by Ubuntu. I don't have a dog in this fight. Posting this to save someone else a few minutes of hassle.

Discussion

  • Petr Ovtchenkov

    Petr Ovtchenkov - 2007-01-04
    • assigned_to: nobody --> complement
    • status: open --> open-later
     
  • Petr Ovtchenkov

    Petr Ovtchenkov - 2007-01-04

    Logged In: YES
    user_id=615813
    Originator: NO

    Because this is non-principal code and I may follow born shell rules with little changes, I put it in my to-do list; I think it come with updated build system.

     
  • Richard GILL

    Richard GILL - 2007-07-03

    Logged In: YES
    user_id=1835045
    Originator: NO

    One better solution than to modify te host system is to override the $SHELL variable to point out to /bin/bash.

    cd build/lib
    echo 'export SHELL := /bin/bash' >> ../Makefiles/config.mak
    make -f gcc.mak ...

    For the long term, the best would be of course to make the makefiles posix or at least bourne (not bourne again) compatible.

     
  • Thomas Girard

    Thomas Girard - 2008-03-15

    Logged In: YES
    user_id=903280
    Originator: NO

    Hello,

    In Debian we use the following patch:
    http://svn.debian.org/viewsvn/\*checkout*/collab-maint/deb-maint/stlport5.1/trunk/debian/patches/bashism.diff?content-type=text%2Fplain&rev=7820

    It fixes bashisms only for Linux.

     

Log in to post a comment.