gcc compiling problems on snow leopard

Problems due to upgrading from 32-bit to 64-bit architecture.

The error messages:

ld: warning: in poly_func.o, file is not of required architecture
ld: warning: in eliptic_poly.o, file is not of required architecture
ld: warning: in polymain.o, file is not of required architecture

Can be resolved by modifying the makefile, and instruct the compiler to compile it in 32-bit using -m32.
The sourcecode of the Makefile:

ALL:

CFLAGS=-g -m32

poly: polymain.o poly_func.o eliptic_poly.o eliptic_poly_main.o
	gcc -o poly polymain.o poly_func.o eliptic_poly.o eliptic_poly_main.o

poly_protocol.o: poly_protocol.c field2n.h
	gcc -c poly_protocol.c

polymain.o: polymain.c field2n.h
	gcc $(CFLAGS) -c polymain.c

poly_func.o: poly_func.c field2n.h
	gcc $(CFLAGS) -c poly_func.c

eliptic_poly.o: eliptic_poly.c field2n.h
	gcc $(CFLAGS) -c eliptic_poly.c

eliptic_poly_main.o: eliptic_poly_main.c field2n.h
	gcc -c eliptic_poly_main.c

polyCG: polyCG.o poly_func.o eliptic_poly.o polymain.o
	gcc -o polyCG polyCG.o poly_func.o eliptic_poly.o polymain.o

polyCG.o: polyCG.c field2n.h
	gcc -c polyCG.c

poly_mul_partial_CG: poly_mul_partial_CG.o poly_func.o eliptic_poly.o \
	polymain.o
	gcc -o poly_mul_partial_CG poly_mul_partial_CG.o \
	poly_func.o eliptic_poly.o polymain.o

poly_mul_partial_CG.o: poly_mul_partial_CG.c field2n.h
	gcc -c poly_mul_partial_CG.c

poly_mul_CG: poly_mul_CG.o poly_func.o eliptic_poly.o polymain.o
	gcc -o poly_mul_CG poly_mul_CG.o poly_func.o eliptic_poly.o polymain.o

poly_mul_CG.o: poly_mul_CG.c field2n.h
	gcc -c poly_mul_CG.c

test_left_right_eq: test_left_right_eq.o poly_func.o eliptic_poly.o polymain.o
	gcc -o test_left_right_eq test_left_right_eq.o poly_func.o eliptic_poly.o polymain.o

test_left_right_eq.o: test_left_right_eq.c field2n.h
	gcc -c test_left_right_eq.c
eliptic_poly_main_CG: eliptic_poly_main_CG.o poly_func.o eliptic_poly.o polymain.o
	gcc -o eliptic_poly_main_CG eliptic_poly_main_CG.o poly_func.o eliptic_poly.o polymain.o

eliptic_poly_main_CG.o: eliptic_poly_main_CG.c field2n.h

small_curve_CG: small_curve_CG.o poly_func.o eliptic_poly.o polymain.o
	gcc -o small_curve_CG small_curve_CG.o poly_func.o eliptic_poly.o polymain.o

small_curve_CG.o: small_curve_CG.c field2n.h
	gcc -c small_curve_CG.c

test_protocol_CG: test_protocol_CG.o poly_func.o eliptic_poly.o polymain.o
	gcc -o test_protocol_CG test_protocol_CG.o poly_func.o eliptic_poly.o polymain.o

test_protocol_CG.o: test_protocol_CG.c field2n.h
	gcc -c test_protocol_CG.c

calc_x_to_get_y: calc_x_to_get_y.o poly_func.o eliptic_poly.o polymain.o
	gcc $(CFLAGS) -o calc_x_to_get_y calc_x_to_get_y.o poly_func.o eliptic_poly.o polymain.o

calc_x_to_get_y.o: calc_x_to_get_y.c field2n.h
	gcc $(CFLAGS) -c calc_x_to_get_y.c

point_field2n_test: point_field2n_test.o poly_func.o eliptic_poly.o polymain.o
	gcc $(CFLAGS) -o point_field2n_test point_field2n_test.o poly_func.o eliptic_poly.o polymain.o

point_field2n_test.o: point_field2n_test.c field2n.h
	gcc $(CFLAGS) -c point_field2n_test.c

junk: junk.o poly_func.o eliptic_poly.o polymain.o
	gcc $(CFLAGS) -o junk junk.o poly_func.o eliptic_poly.o polymain.o

junk.o: junk.c field2n.h
	gcc $(CFLAGS) -c junk.c

Thank you for the big help of the coding wizard 🙂

*Similar problems on this:
1. http://www.mail-archive.com/pd-list@iem.at/msg30035.html
2. http://gmplib.org/list-archives/gmp-bugs/2009-October/001636.html
3. http://stackoverflow.com/questions/1455720/mac-osx-10-6-compiler-a-puzzling-experience-with-32-vs-64-bit
4. http://gmplib.org/list-archives/gmp-bugs/2009-November/001696.html
5. http://trac.macports.org/ticket/20933

Advertisements