Search code examples
gccmakefileredisclang

redis make - linker input file not found: No such file or directory


I'm trying to compile the redis 3.2 sourcecode on my ubuntu 22.04 machine.

I have latest gcc, g++ and clang binaries on my path.

> gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

> g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

> clang --version
clang version 16.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix

When I try to compile with > make MALLOC=libc I get the following error when building the lua dependency:

cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2   x86_64 -c -o lapi.o lapi.c
cc: warning: x86_64: linker input file unused because linking not done
cc: error: x86_64: linker input file not found: No such file or directory

From what I understand, the -c is forcing only compilation and NOT allowing linking, causing the failure.

But I can't figure out how the -c flag is creeping in and its source.

Any help is highly appreciated, thanks!


Solution

  • I found the issue.

    My environment had a TARGET_ARCH variable set to x86_64 (export TARGET_ARCH=x86_64).

    This was causing the dangling x86_64 to end up in the compilation command, I'm not sure how.

    When I unset it, the make command ran successfully.