Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

OneDreamCloser

macrumors member
Original poster
Jun 16, 2008
30
0
hi all,

i m trying to run a tool written in C in X11,
after re-declaring some things and tweaking the Makefile,
i got the "make depend" working but when i do "make all"
i get this error ...

/usr/bin/ld: ALGORITHMS/algorithms.o bad magic number (not a Mach-O file)
/usr/bin/ld: INPUTACTIONS/inputActions.o bad magic number (not a Mach-O file)
/usr/bin/ld: OUTPUTACTIONS/outputActions.o bad magic number (not a Mach-O file)
/usr/bin/ld: FABRICS/fabrics.o bad magic number (not a Mach-O file)
/usr/bin/ld: TRAFFIC/traffic.o bad magic number (not a Mach-O file)
collect2: ld returned 1 exit status
make[2]: *** [sim] Error 1
make[1]: *** [thisoptall] Error 2
make: *** [all] Error 2

normally, doing
1. make depend ( correct )
2. make all ( incorrect ??? )
3. createsim -sim ( should work )
( attached you can find the source code and the makefile in case you needed to have a look )

the problem is that i don t know what the message "bad magic number (not a Mach-O file)" means ...
i would be thankful if someone could help me overcome this problem

thanx in advance
 

Attachments

  • Makefile.txt
    13.7 KB · Views: 318
  • simv2.35.zip
    592.1 KB · Views: 104
A make clean will get rid of all of the .o files that already exist. This looks like it was distributed with some of the things already compiled (presumably for another system like Linux, these look like ELF objects).

After the make clean, try to start from step 1 and see if things go better.

-Lee
 
A make clean will get rid of all of the .o files that already exist. This looks like it was distributed with some of the things already compiled (presumably for another system like Linux, these look like ELF objects).

After the make clean, try to start from step 1 and see if things go better.

-Lee

Thanks lee1210 for the help, but i already have tried that and unfortunately it didn t work, any other ideas ?
 
From a terminal, do a file ALGORITHMS/algorithms.o (and so on for the other object files) and post the results here so we can see what kind of files these are.

Edit: I downloaded the zip file and tried:

make cleanall
make depend
make all

And I got the following error:
Code:
make[2]: *** No rule to make target `ALGORITHMS/algorithms.o', needed by `sim'.  Stop.

Edit2: From the makefile, I tried the following steps
cd ALGORITHMS
make optall


But I got the following error:
Code:
make algorithms.o CFLAGS="-O3 -Wall -Wshadow -I.. -DLIST_HISTOGRAM -DLIST_STATS "
gcc -O3 -Wall -Wshadow -I.. -DLIST_HISTOGRAM -DLIST_STATS    -c -o ap2driver.o ap2driver.c
ap2driver.c:62:20: error: malloc.h: No such file or directory
ap2driver.c: In function 'ap2driver':
ap2driver.c:79: warning: implicit declaration of function 'malloc'
ap2driver.c:79: warning: incompatible implicit declaration of built-in function 'malloc'
ap2driver.c: In function 'assign2graph':
ap2driver.c:127: warning: incompatible implicit declaration of built-in function 'malloc'
make[1]: *** [ap2driver.o] Error 1
make: *** [optall] Error 2
 
Seems your code tries to include "malloc.h" and that file doesn't exist. It is not a standard C header file, or a standard Posix header file. Changing it to

Code:
#include <stdlib.h>
is likely to help.
 
thank you all for your help,

make clean didn t work properly
so a make cleanall or i a rm -f did the work

i redeclared the library malloc.h with sys/malloc.h and everything it s ok now

thank you all
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.