sed: can't read Makefile: No such file or directory

6,399

The Makefile is not created until you've run the configure script. Try placing the sed command after the invocation of configure.

I haven't checked if the sed edit is doing what it should or not, but the main issue is probably that the Makefile simply doesn't exist yet at that point in your script.

In general, I would avoid sed -i as its semantics is different for GNU and BSD sed. It's safer to sed ... file >tmpfile && mv tmpfile file.

Share:
6,399

Related videos on Youtube

user977828
Author by

user977828

Updated on September 18, 2022

Comments

  • user977828
    user977828 over 1 year

    I tried to replace a line in a Makefile with sed -i -e 's|$(bindir)\/embossupdate|:|' Makefile, but I got sed: can't read Makefile: No such file or directory

    FROM ubuntu:16.04
    ...
    # EMBOSS (ftp://emboss.open-bio.org/pub/EMBOSS/)
    ENV EMBOSS_VER 6.6.0
    RUN apt-get install libhpdf-dev libpng12-dev libgd-dev -y
    ADD EMBOSS-${EMBOSS_VER}.tar.gz /usr/local/
    WORKDIR /usr/local/EMBOSS-${EMBOSS_VER}
    RUN sed -i -e 's|$(bindir)\/embossupdate|:|' Makefile        
    RUN ./configure  --enable-64 --with-thread  --without-x
    RUN make
    RUN ldconfig
    RUN make install
    

    What did I do wrong with the sed command?

    • cuonglm
      cuonglm over 7 years
      It's not about sed, but sounds like you don't have Makefile in EMBOSS-${EMBOSS_VER}.
    • Andreas Wiese
      Andreas Wiese over 7 years
      I think cuonglm is right. Further, your sed-expression won't do what you except, as you forgot to escape $, which will match the end-of-line in this expression.
    • Kusalananda
      Kusalananda over 7 years
      @AndreasWiese The $ is an ordinary character unless at the end of the expression (or at the end of a group) in a BRE.