Note that there are some explanatory texts on larger screens.

plurals
  1. POAdapt Makefile for cross-compilation
    primarykey
    data
    text
    <p>I have a makefile that works fine when I compile using <code>/usr/bin/gcc</code> to compile it. However I'm trying to compile it using a crosstool-ng compiler. I've changed CC to the cross-compilers location, and added a prefix to the directory that holds the compiler, but I get an error compiling.</p> <p>The Makefile is here (sorry, it's long):</p> <pre><code>CFLAGS ?= -Wall -O0 -ggdb3 PREFIX = /home/me/crosstool-ng-1.18.0/x-tools/i586-system-linux-gnu/ CC = /home/me/crosstool-ng-1.18.0/x-tools/i586-system-linux-gnu/bin/i586-system-linux-gnu-gcc ALL_CFLAGS = $(CFLAGS) -D_GNU_SOURCE .phony: all all: food libfood.so.1.0.0 foo_query .phony: tools tool tools: libfood_print foo_print .phony: install install: libfood.so.1.0.0 cp libfood.so.1.0.0 $(PREFIX)/lib cd $(PREFIX)/lib ; \ ln -sf libfood.so.1.0.0 libfood.so.1 ; \ ln -sf libfood.so.1 libfood.so cp libfood.h $(PREFIX)/include cp foo_data.h $(PREFIX)/include cp food $(PREFIX)/bin cp foo_query $(PREFIX)/bin %.o: %.c $(CC) $(ALL_CFLAGS) -c $&lt; food: food.o foo.o $(CC) $(ALL_CFLAGS) -o $@ $^ -lm -lpthread libfood.so.1.0.0: libfood.o $(CC) -shared -Wl,-soname,libfood.so.1 -o libfood.so.1.0.0 libfood.o libfood_print: libfood_print.o $(CC) $(ALL_CFLAGS) -o $@ $^ -lfood foo_print: foo_print.o foo.o $(CC) $(ALL_CFLAGS) -o $@ $^ -lm -lpthread foo_query: foo_query.o $(CC) $(ALL_CFLAGS) -o $@ $^ -lfood food.o: food.c foo.h foo_data.h foo.o: foo.c foo.h foo_data.h foo_print.o: foo_print.c foo_data.h foo_query.o: foo_query.c foo_data.h libfood.o: libfood.c libfood.h $(CC) $(ALL_CFLAGS) -fPIC -c $&lt; foo_print.o: foo_print.c foo.h .phony:clean clean: rm -rf *.o *~ food libfood.so.1.0.0 foo_print libfood_print foo_query </code></pre> <p>The error message I'm getting says <code>cannot find -lfood collect2: ld returned 1 exit status</code></p> <p>If anyone could suggest a fix for this I'd be very grateful.</p> <p>EDIT: My Solution:</p> <p>I should probably have been clearer but this Makefile was being used to build a package that was included in buildroot. I tried the suggestion by Jonatan, but unfortunately I still got the same error. My workaround was to run buildroot using <code>make -k</code>, and then build again using <code>make</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload