0
votes

I have a C application: FFT that is linked dynamically with eclipse but seeing the fact that I'm using a simulator that only deals with statically linked application i had to add the "-static" flag in my Makefile as following:

CC=gcc
CFLAGS=-g -static -c -Wall -O5 -mavx
LDFLAGS=

SOURCES=$ fft.c
OBJECTS=$(SOURCES:.c=.o)

EXECUTABLE=fft


all: $(TASKMAP) $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS) 
$(CC) $(LDFLAGS) $(OBJECTS) -lm -o $@

.c.o:
    $(CC) $(CFLAGS) $< -lm -o $@


clean: 
    rm -fr $(OBJECTS) $(EXECUTABLE)

Normally the static link should work but when i type the following command:

:~/workspace/fft$ file fft

I get this message:

fft: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xa499c8104f09cd85fbfbb33c75e51c606f117acf, not stripped

could someone help me on this?

1
"I'm using a simulator that only deals with statically linked application" But compiling with your host GCC. What simulator? Also, I'm fairly certain -O5 is not a laid optimization level; -O3 is the highest. And what's with the extra $ in the SOURCES list?Jonathon Reinhart

1 Answers

3
votes

You need to add the -static flags to the LDFLAGS section.

You also don't need -static flags in the CFLAGS.