VLSIDA / OpenRAM

An open-source static random access memory (SRAM) compiler.
http://www.openram.org
BSD 3-Clause "New" or "Revised" License
809 stars 199 forks source link

Installation Problem #162

Closed hakan-demirli closed 1 year ago

hakan-demirli commented 1 year ago

OS: Ubuntu 20.04.03 Docker version 20.10.21, build baeda1f Steps Followed:

git clone https://github.com/VLSIDA/OpenRAM
cd OpenRAM/docker
make build

The error:

Removing intermediate container e34bca9e422a
 ---> 8c0cd8bb8731
Step 61/74 : COPY mrg.patch /root/magic
 ---> 9f7403a19450
Step 62/74 : RUN git apply mrg.patch
 ---> Running in 26066a2ba0f1
mrg.patch:10: space before tab in indent.
                if (idx < i || i == -1) i = idx;
error: patch failed: commands/CmdLQ.c:1745
error: commands/CmdLQ.c: patch does not apply
The command '/bin/sh -c git apply mrg.patch' returned a non-zero code: 1
docker tag  vlsida/openram-ubuntu:2022-11-03 vlsida/openram-ubuntu:latest
Error response from daemon: No such image: vlsida/openram-ubuntu:2022-11-03
make: *** [Makefile:11: build] Error 1

If I edit the docker file and add --reject --whitespace=fix to the git command. The error evolves into this:

Step 62/74 : RUN git apply --reject --whitespace=fix mrg.patch
 ---> Running in 5646a674572b
Checking patch commands/CmdLQ.c...
error: while searching for:
            if (sl->lab_flags & PORT_DIR_MASK)?
            {?
                idx = (int)sl->lab_port;?
                if (idx < i) i = idx;?
            }?
        }?
#ifdef MAGIC_WRAPPER?

error: patch failed: commands/CmdLQ.c:1745
error: while searching for:
            {?
                idx = (int)sl->lab_port;?
                if (idx > refidx)?
                    if (idx < i) i = idx;?
            }?
        }?
#ifdef MAGIC_WRAPPER?

error: patch failed: commands/CmdLQ.c:1764
Applying patch commands/CmdLQ.c with 2 rejects...
Rejected hunk #1.
Rejected hunk #2.
The command '/bin/sh -c git apply --reject --whitespace=fix mrg.patch' returned a non-zero code: 1
hakan-demirli commented 1 year ago

The solution is to apply dos2unix to all files before compiling.

find /path -type f -print0 | xargs -0 dos2unix --
hakan-demirli commented 1 year ago

Nope. The line endings were correct in the repo. My git preferences were wonky. Git automatically converts line endings if autocrlf = true is set in preferences. That was the case for me. Changing my gitpereferences fixed it.

[core]
    autocrlf = false
    eol = lf

Related: https://github.com/RTimothyEdwards/open_pdks/issues/334