I'm working on an older Mac OS X 10.5 (Leopard) with a PowerPC. Its ancient by most standards, but its a test platform for the processor architecture. Because Apple abandoned it some time ago, we need to build some stuff ourselves (like Git, which has a distant dependecy on libedit through another dependency).
The "_main", referenced from...
error can be resolved by detecting OS X, and using -dynamiclib
instead of --shared
. See https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/000-Introduction/Introduction.html.
The compat.h:4:1: warning: "__RCSID" redefined
can probably be resolved by a guard like #ifndef __RCSID
or an #undef __RCSID
.
PowerMac::libedit$ make clean
rm -f *.o
rm -f *~ \#*\#
rm -f common.h emacs.h fcns.h help.h vi.h help.c fcns.c editline.c common.h.tmp editline.c.tmp emacs.h.tmp fcns.c.tmp fcns.h.tmp help.c.tmp help.h.tmp vi.h.tmp
PowerMac::libedit$ export CFLAGS="-arch ppc -arch ppc64 -force_cpusubtype_ALL"
PowerMac::libedit$ make
sh ./makelist -h ./vi.c > vi.h.tmp && \
mv vi.h.tmp vi.h
sh ./makelist -h ./emacs.c > emacs.h.tmp && \
mv emacs.h.tmp emacs.h
sh ./makelist -h ./common.c > common.h.tmp && \
mv common.h.tmp common.h
sh ./makelist -fh vi.h emacs.h common.h > fcns.h.tmp && \
mv fcns.h.tmp fcns.h
sh ./makelist -bh ./vi.c ./emacs.c ./common.c > help.h.tmp && \
mv help.h.tmp help.h
sh ./makelist -bc ./vi.c ./emacs.c ./common.c > help.c.tmp && \
mv help.c.tmp help.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c chared.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c common.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c el.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c emacs.c
sh ./makelist -fc vi.h emacs.h common.h > fcns.c.tmp && \
mv fcns.c.tmp fcns.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c fcns.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c hist.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c history.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c key.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c map.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c parse.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c prompt.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c read.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c refresh.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c search.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c sig.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c term.c
term.c: In function 'term_set':
term.c:931: warning: passing argument 1 of 'tgetstr' discards qualifiers from pointer target type
term.c: In function 'term_set':
term.c:931: warning: passing argument 1 of 'tgetstr' discards qualifiers from pointer target type
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c tokenizer.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c tty.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c vi.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c help.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c fgetln.c
In file included from fgetln.c:2:
compat.h:4:1: warning: "__RCSID" redefined
In file included from /usr/include/sys/_types.h:32,
from /usr/include/_types.h:27,
from /usr/include/stdio.h:64,
from fgetln.c:1:
/usr/include/sys/cdefs.h:206:1:In file included from fgetln.c:2 :
warning: compat.h:4:1:this is the location of the previous definition
In file included from fgetln.c:2warning: :
compat.h:5:1:"__RCSID" redefined
warning: In file included from /usr/include/sys/_types.h:32"__COPYRIGHT" redefined
,
from /usr/include/_types.h:27In file included from /usr/include/sys/_types.h:32,
from /usr/include/stdio.h:64,
from /usr/include/_types.h:27,
from fgetln.c:1,
from /usr/include/stdio.h:64:
,
from fgetln.c:1/usr/include/sys/cdefs.h:206:1::
/usr/include/sys/cdefs.h:202:1:warning: this is the location of the previous definitionwarning:
this is the location of the previous definition
In file included from fgetln.c:2:
compat.h:5:1: warning: "__COPYRIGHT" redefined
In file included from /usr/include/sys/_types.h:32,
from /usr/include/_types.h:27,
from /usr/include/stdio.h:64,
from fgetln.c:1:
/usr/include/sys/cdefs.h:202:1: warning: this is the location of the previous definition
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c readline.c
gcc -arch ppc -arch ppc64 -force_cpusubtype_ALL -I. -I. -c strlcpy.c
ar -r libedit.a chared.o common.o el.o emacs.o fcns.o hist.o history.o key.o map.o parse.o prompt.o read.o refresh.o search.o sig.o term.o tokenizer.o tty.o vi.o help.o fgetln.o readline.o strlcpy.o
gcc --shared -o libedit.so chared.o common.o el.o emacs.o fcns.o hist.o history.o key.o map.o parse.o prompt.o read.o refresh.o search.o sig.o term.o tokenizer.o tty.o vi.o help.o fgetln.o readline.o strlcpy.o
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
"_tgetflag", referenced from:
_term_set in term.o
_term_set in term.o
_term_set in term.o
_term_set in term.o
_term_set in term.o
_term_set in term.o
"_tgetent", referenced from:
_term_set in term.o
"_tputs", referenced from:
_term_move_to_line in term.o
_term_move_to_line in term.o
_term_move_to_line in term.o
_term_move_to_char in term.o
_term_move_to_char in term.o
_term_move_to_char in term.o
_term_deletechars in term.o
_term_deletechars in term.o
_term_deletechars in term.o
_term_deletechars in term.o
_term_insertwrite in term.o
_term_insertwrite in term.o
_term_insertwrite in term.o
_term_insertwrite in term.o
_term_insertwrite in term.o
_term_insertwrite in term.o
_term_clear_EOL in term.o
_term_clear_screen in term.o
_term_clear_screen in term.o
_term_clear_screen in term.o
_term_beep in term.o
_term_echotc in term.o
_term_echotc in term.o
_term_echotc in term.o
"_tgetnum", referenced from:
_term_set in term.o
_term_set in term.o
"_tgetstr", referenced from:
_term_set in term.o
_term_echotc in term.o
"_tgoto", referenced from:
_term_move_to_line in term.o
_term_move_to_line in term.o
_term_move_to_char in term.o
_term_move_to_char in term.o
_term_move_to_char in term.o
_term_deletechars in term.o
_term_insertwrite in term.o
_term_echotc in term.o
_term_echotc in term.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libedit.so] Error 1
PowerMac::libedit$
Sorry about the crummy formatting. It appears SourceForge honored the code block using back ticks, but it discarded all the newlines...