bartobri / no-more-secrets

A command line tool that recreates the famous data decryption effect seen in the 1992 movie Sneakers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fails to build with clang 8

YtvwlD opened this issue · comments

I tried to build this program on my phone and got the following error:

$ clang --version
clang version 8.0.0 (tags/RELEASE_800/final)
Target: arm-unknown-linux-android
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
$ make
cc -Wextra -Wall -O2 -o obj/nmstermio.o -c src/nmstermio.c
src/nmstermio.c:299:9: error: expression is not
      assignable
                stdin = freopen("/dev/tty", "r"...
                ~~~~~ ^
1 error generated.
make: *** [Makefile:37: obj/nmstermio.o] Error 1

It worked on my laptop:

$ gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make
mkdir obj
cc -Wextra -Wall -O2 -o obj/input.o -c src/input.c
cc -Wextra -Wall -O2 -o obj/error.o -c src/error.c
cc -Wextra -Wall -O2 -o obj/nmscharset.o -c src/nmscharset.c
cc -Wextra -Wall -O2 -o obj/nmstermio.o -c src/nmstermio.c
cc -Wextra -Wall -O2 -o obj/nmseffect.o -c src/nmseffect.c
cc -Wextra -Wall -O2 -o obj/nms.o -c src/nms.c
mkdir bin
cc -Wextra -Wall -O2 -o bin/nms obj/input.o obj/error.o obj/nmscharset.o obj/nmstermio.o obj/nmseffect.o obj/nms.o

So, I tried using clang there:

$ clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ make CC=clang
mkdir obj
clang -Wextra -Wall -O2 -o obj/input.o -c src/input.c
clang -Wextra -Wall -O2 -o obj/error.o -c src/error.c
clang -Wextra -Wall -O2 -o obj/nmscharset.o -c src/nmscharset.c
clang -Wextra -Wall -O2 -o obj/nmstermio.o -c src/nmstermio.c
clang -Wextra -Wall -O2 -o obj/nmseffect.o -c src/nmseffect.c
clang -Wextra -Wall -O2 -o obj/nms.o -c src/nms.c
mkdir bin
clang -Wextra -Wall -O2 -o bin/nms obj/input.o obj/error.o obj/nmscharset.o obj/nmstermio.o obj/nmseffect.o obj/nms.o

So, I think the difference here is the version of clang.

commented

I have the same experience. On my Mac standard procedure is working. On MINT I had to install clang and it worked only with version 6.

On my Android with Termux it was not possible to make with gcc or clang because only version 8 ist available.

I guess the solution would be to simply rename the variable, but I didn't try that. (It compiled on Termux for me after I removed this line.)

Thanks for the info, guys. I have not tried to compile with clang but i'll try and see what I can do.

commented

@YtvwlD Can you elaborate? I'm not yet so experienced bash. What exactly did you do?

@cheezeburgers This has nothing to do with Bash. I opened the file in a text editor and put // in front of the line.

commented

@YtvwlD In which line specific? I // the line it tells me is the issue but it fails even harder after that with more errors.

After goolge the usage of freopen, I found a solution. I am not very sure about it. I even not read the code that call the function.
It's very simple to fix it.

  1. Just delete stdin = and you can compile it successfully.
  2. Then, change prefix ?= /usr/local in makefile to prefix ?= /data/data/com.termux/files/usr.
  3. make & make install as usual