Não é possível encontrar -lgcc

1

Estou tentando compilar meu próximo programa básico após o hello-world. Isto contém dois módulos de suporte. Eu tenho Ubuntu rodando em uma VM através do VirtualBox em um mac. Tudo está atualizado, mas não consigo criar:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status

Eu também estou apenas aprendendo sobre makefiles, então é provável que algo esteja por aí. main inclui b , que inclui c . Estou tentando vincular em <stdlib.h> e <math.h> .

Meu makefile :

# Specify the C complier
CC = gcc

# List the compiler flags you want to pass to the compiler
#  -g            compile with debug information
#  -Wall         give all diagnostic warnings
#  -pedantic     require compliance with ANSI standard
#  -O0           do not optimize generated code
#  -std=gnu99    use the Gnu C99 standard language definition
#  -m32          emit code for IA32 architecture
#  -D_GNU_SOURCE use GNU library extension
#  -v            verbose, display detailed information about the exact
#                sequence of commands used to compile and link a program
CFLAGS = -g -Wall -pedantic -O0 -std=gnu99 -m32 -D_GNU_SOURCE

# The LDFLAGS variable sets flags for linker
#  -lm    link in libm (math library)
#  -m32   link with IA32 libraries
LDFLAGS = -lm -m32

# In this section, list the files that are part of the project.
# If you add/change names of header/source files, here is where you
# edit the makefile.
# List your c header files
HEADERS = c.h b.h
# List your c source files
SOURCES = c.c b.c main.c
OBJECTS = $(SOURCES:.c=.o)
# List your libraries
#LIBRARIES = -L.
# specify the build target (what is your program name?)
TARGET = validator

# The first target defined in the makefile is the one
# used when make is invoked with no argument. Given the definitions
# above, this makefile file will build the one named TARGET and
# assume that it depends on all the named OBJECTS files.
default: $(TARGET)

$(TARGET) : $(OBJECTS) makefile.dependencies
    $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LDFLAGS) $(LIBRARIES)

# In make's default rules, a .o automatically depends on its .c file
# (so editing the .c will cause recompilation into its .o file).
# The line below creates additional dependencies, most notably that it
# will cause the .c to be recompiled if any included .h file changes.
makefile.dependencies:: $(SOURCES) $(HEADERS)
    $(CC) $(CFLAGS) -MM $(SOURCES) > makefile.dependencies

-include makefile.dependencies

# Phony means not a "real" target, it doesn't build anything
# The phony target "clean" that is used to remove all compiled object files.
.PHONY: clean

clean:
    @rm -f $(TARGET) $(OBJECTS) core makefile.dependencies
    
por tarabyte 08.12.2014 / 05:22

1 resposta

0

Oh, deixa pra lá. Acabei de perceber que não pareço ter bibliotecas de 32 bits. O makefile deve ter -m64 no lugar de -m32 .

    
por 08.12.2014 / 05:25

Tags