Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to make femtolisp #3

Open
acook opened this issue Jan 23, 2013 · 12 comments
Open

Unable to make femtolisp #3

acook opened this issue Jan 23, 2013 · 12 comments

Comments

@acook
Copy link

acook commented Jan 23, 2013

Will it not build on OSX?

~/Pork/femtolisp on master
$ make
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c flisp.c -o flisp.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c builtins.c -o builtins.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c string.c -o string.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c equalhash.c -o equalhash.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c table.c -o table.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c iostream.c -o iostream.o
cd llt && make
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c flmain.c -o flmain.o
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c bitvector.c -o bitvector.o
In file included from bitvector.c:36:
dtypes.h:32:22: error: features.h: No such file or directory
dtypes.h:33:20: error: endian.h: No such file or directory
dtypes.h:34:1: warning: "LITTLE_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from bitvector.c:32:
/usr/include/i386/endian.h:93:1: warning: this is the location of the previous definition
In file included from bitvector.c:36:
dtypes.h:35:1: warning: "BIG_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from bitvector.c:32:
/usr/include/i386/endian.h:94:1: warning: this is the location of the previous definition
In file included from bitvector.c:36:
dtypes.h:36:1: warning: "PDP_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from bitvector.c:32:
/usr/include/i386/endian.h:95:1: warning: this is the location of the previous definition
In file included from bitvector.c:36:
dtypes.h:37:1: warning: "BYTE_ORDER" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from bitvector.c:32:
/usr/include/i386/endian.h:97:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from table.c:8:
llt/dtypes.h:32:22: error: features.h: No such file or directory
llt/dtypes.h:33:20: error: endian.h: No such file or directory
llt/dtypes.h:34:1: warning: "LITTLE_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from table.c:1:
/usr/include/i386/endian.h:93:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from table.c:8:
llt/dtypes.h:35:1: warning: "BIG_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from table.c:1:
/usr/include/i386/endian.h:94:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from table.c:8:
llt/dtypes.h:36:1: warning: "PDP_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from table.c:1:
/usr/include/i386/endian.h:95:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from table.c:8:
llt/dtypes.h:37:1: warning: "BYTE_ORDER" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from table.c:1:
/usr/include/i386/endian.h:97:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from iostream.c:8:
llt/dtypes.h:32:22: error: features.h: No such file or directory
llt/dtypes.h:33:20: error: endian.h: No such file or directory
llt/dtypes.h:34:1: warning: "LITTLE_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from iostream.c:1:
/usr/include/i386/endian.h:93:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from iostream.c:8:
llt/dtypes.h:35:1: warning: "BIG_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from iostream.c:1:
/usr/include/i386/endian.h:94:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from iostream.c:8:
llt/dtypes.h:36:1: warning: "PDP_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from iostream.c:1:
/usr/include/i386/endian.h:95:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from iostream.c:8:
llt/dtypes.h:37:1: warning: "BYTE_ORDER" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from iostream.c:1:
/usr/include/i386/endian.h:97:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from equalhash.c:8:
llt/dtypes.h:32:22: error: features.h: No such file or directory
llt/dtypes.h:33:20: error: endian.h: No such file or directory
llt/dtypes.h:34:1: warning: "LITTLE_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from equalhash.c:1:
/usr/include/i386/endian.h:93:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from equalhash.c:8:
llt/dtypes.h:35:1: warning: "BIG_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from equalhash.c:1:
/usr/include/i386/endian.h:94:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from equalhash.c:8:
llt/dtypes.h:36:1: warning: "PDP_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from equalhash.c:1:
/usr/include/i386/endian.h:95:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from equalhash.c:8:
llt/dtypes.h:37:1: warning: "BYTE_ORDER" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from equalhash.c:1:
/usr/include/i386/endian.h:97:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from builtins.c:16:
llt/dtypes.h:32:22: error: features.h: No such file or directory
llt/dtypes.h:33:20: error: endian.h: No such file or directory
llt/dtypes.h:34:1: warning: "LITTLE_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from builtins.c:5:
/usr/include/i386/endian.h:93:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from builtins.c:16:
llt/dtypes.h:35:1: warning: "BIG_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from builtins.c:5:
/usr/include/i386/endian.h:94:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from builtins.c:16:
llt/dtypes.h:36:1: warning: "PDP_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from builtins.c:5:
/usr/include/i386/endian.h:95:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from builtins.c:16:
llt/dtypes.h:37:1: warning: "BYTE_ORDER" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from builtins.c:5:
/usr/include/i386/endian.h:97:1: warning: In file included from llt/llt.h:5,
                 from string.c:16:
llt/dtypes.h:32:22: error: features.h: No such file or directory
llt/dtypes.h:33:20: error: endian.h: No such file or directory
llt/dtypes.h:34:1: warning: "LITTLE_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from string.c:4:
/usr/include/i386/endian.h:93:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from string.c:16:
llt/dtypes.h:35:1: warning: "BIG_ENDIAN" redefined
this is the location of the previous definitionIn file included from /usr/include/machine/endian.h:35
,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from string.c:4:
/usr/include/i386/endian.h:94:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from string.c:16:
llt/dtypes.h:36:1: warning: "PDP_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from string.c:4:
/usr/include/i386/endian.h:95:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from string.c:16:
llt/dtypes.h:37:1: warning: "BYTE_ORDER" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from string.c:4:
/usr/include/i386/endian.h:97:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from flmain.c:14:
llt/dtypes.h:32:22: error: features.h: No such file or directory
llt/dtypes.h:33:20: error: endian.h: No such file or directory
llt/dtypes.h:34:1: warning: "LITTLE_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from flmain.c:1:
/usr/include/i386/endian.h:93:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from flmain.c:14:
llt/dtypes.h:35:1: warning: "BIG_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from flmain.c:1:
/usr/include/i386/endian.h:94:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from flmain.c:14:
llt/dtypes.h:36:1: warning: "PDP_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from flmain.c:1:
/usr/include/i386/endian.h:95:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from flmain.c:14:
llt/dtypes.h:37:1: warning: "BYTE_ORDER" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from flmain.c:1:
/usr/include/i386/endian.h:97:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from flisp.c:45:
llt/dtypes.h:32:22: error: features.h: No such file or directory
llt/dtypes.h:33:20: error: endian.h: No such file or directory
llt/dtypes.h:34:1: warning: "LITTLE_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from flisp.c:32:
/usr/include/i386/endian.h:93:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from flisp.c:45:
llt/dtypes.h:35:1: warning: "BIG_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from flisp.c:32:
/usr/include/i386/endian.h:94:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from flisp.c:45:
llt/dtypes.h:36:1: warning: "PDP_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from flisp.c:32:
/usr/include/i386/endian.h:95:1: warning: this is the location of the previous definition
In file included from llt/llt.h:5,
                 from flisp.c:45:
llt/dtypes.h:37:1: warning: "BYTE_ORDER" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from flisp.c:32:
/usr/include/i386/endian.h:97:1: warning: this is the location of the previous definition
make[1]: *** [bitvector.o] Error 1
make: *** [equalhash.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [llt/libllt.a] Error 2
make: *** [string.o] Error 1
make: *** [builtins.o] Error 1
make: *** [iostream.o] Error 1
make: *** [table.o] Error 1
make: *** [flmain.o] Error 1
In file included from operators.c:5,
                 from cvalues.c:1,
                 from flisp.c:390:
llt/ieee754.h:14: error: duplicate member ‘mantissa’
llt/ieee754.h:15: error: duplicate member ‘exponent’
llt/ieee754.h:15: error: duplicate member ‘({anonymous})’
llt/ieee754.h:16: error: duplicate member ‘negative’
llt/ieee754.h:16: error: duplicate member ‘({anonymous})’
llt/ieee754.h:16: error: duplicate member ‘({anonymous})’
llt/ieee754.h:34: error: duplicate member ‘mantissa1’
llt/ieee754.h:35: error: duplicate member ‘mantissa0’
llt/ieee754.h:35: error: duplicate member ‘({anonymous})’
llt/ieee754.h:36: error: duplicate member ‘exponent’
llt/ieee754.h:36: error: duplicate member ‘({anonymous})’
llt/ieee754.h:36: error: duplicate member ‘({anonymous})’
llt/ieee754.h:37: error: duplicate member ‘negative’
llt/ieee754.h:37: error: duplicate member ‘({anonymous})’
llt/ieee754.h:37: error: duplicate member ‘({anonymous})’
llt/ieee754.h:37: error: duplicate member ‘({anonymous})’
llt/ieee754.h:56: error: duplicate member ‘mantissa1’
llt/ieee754.h:57: error: duplicate member ‘mantissa0’
llt/ieee754.h:57: error: duplicate member ‘({anonymous})’
llt/ieee754.h:58: error: duplicate member ‘exponent’
llt/ieee754.h:58: error: duplicate member ‘({anonymous})’
llt/ieee754.h:58: error: duplicate member ‘({anonymous})’
llt/ieee754.h:59: error: duplicate member ‘negative’
llt/ieee754.h:59: error: duplicate member ‘({anonymous})’
llt/ieee754.h:59: error: duplicate member ‘({anonymous})’
llt/ieee754.h:59: error: duplicate member ‘({anonymous})’
llt/ieee754.h:60: error: duplicate member ‘empty’
llt/ieee754.h:60: error: duplicate member ‘({anonymous})’
llt/ieee754.h:60: error: duplicate member ‘({anonymous})’
llt/ieee754.h:60: error: duplicate member ‘({anonymous})’
llt/ieee754.h:60: error: duplicate member ‘({anonymous})’
make: *** [flisp.o] Error 1
@JeffBezanson
Copy link
Owner

Try replacing -DLINUX in Makefile with -DMACOSX. I should put that in the readme.

@acook
Copy link
Author

acook commented Jan 24, 2013

Ah I see the comment. Okay, made that change and got a different, even more ambiguous (to me) error:

~/Pork/femtolisp on master !
$ make clean
rm -f *.o
rm -f *.do
rm -f flisp
rm -f libflisp.a
rm -f libflisp.da
~/Pork/femtolisp on master !
$ make
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c flisp.c -o flisp.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c builtins.c -o builtins.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c string.c -o string.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c equalhash.c -o equalhash.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c table.c -o table.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c iostream.c -o iostream.o
cd llt && make
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c flmain.c -o flmain.o
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c bitvector.c -o bitvector.o
In file included from bitvector.c:36:
dtypes.h:32:22: error: features.h: No such file or directory
dtypes.h:33:20: error: endian.h: No such file or directory
dtypes.h:34:1: warning: "LITTLE_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from bitvector.c:32:
/usr/include/i386/endian.h:93:1: warning: this is the location of the previous definition
In file included from bitvector.c:36:
dtypes.h:35:1: warning: "BIG_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from bitvector.c:32:
/usr/include/i386/endian.h:94:1: warning: this is the location of the previous definition
In file included from bitvector.c:36:
dtypes.h:36:1: warning: "PDP_ENDIAN" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from bitvector.c:32:
/usr/include/i386/endian.h:95:1: warning: this is the location of the previous definition
In file included from bitvector.c:36:
dtypes.h:37:1: warning: "BYTE_ORDER" redefined
In file included from /usr/include/machine/endian.h:35,
                 from /usr/include/sys/wait.h:193,
                 from /usr/include/stdlib.h:65,
                 from bitvector.c:32:
/usr/include/i386/endian.h:97:1: warning: this is the location of the previous definition
make[1]: *** [bitvector.o] Error 1
make: *** [llt/libllt.a] Error 2
make: *** Waiting for unfinished jobs....
~/Pork/femtolisp on master !
$ ls
attic/      examples/    lib/        llt/        tests/       tiny/        .git/      FLOSSING      LICENSE        Makefile                ascii-mona-lisa  ascii-mona-lisa-2  todo
todo-scrap  flisp.boot   builtins.c  cvalues.c   equal.c      equalhash.c  flisp.c    flmain.c      iostream.c     opaque_type_template.c  operators.c      print.c            read.c
string.c    table.c      types.c     .gitignore  equalhash.h  flisp.h      opcodes.h  compiler.lsp  mkboot0.lsp    mkboot1.lsp             system.lsp       Makefile.macosx    README.md
builtins.o  equalhash.o  flisp.o     flmain.o    iostream.o   string.o     table.o    aliases.scm   bootstrap.sh*

@JeffBezanson
Copy link
Owner

Sorry about that. The same change is needed in llt/Makefile. Obviously some refactoring is needed.

@acook
Copy link
Author

acook commented Jan 24, 2013

I don't know Make syntax, but I assume you could do something like:

#ifndef OS
#define OS = LINUX

CONFIG = -D$(OS) -DARCH_X86_64 -DBITS64 -D__CPU__=686

I'm assuming $(VARS) are environment variables, which they may not be.

Anyway, its still not building.

~/Pork/femtolisp on master !
$ make clean; make
rm -f *.o
rm -f *.do
rm -f flisp
rm -f libflisp.a
rm -f libflisp.da
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c flisp.c -o flisp.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c builtins.c -o builtins.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c string.c -o string.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c equalhash.c -o equalhash.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c table.c -o table.o
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c iostream.c -o iostream.o
cd llt && make
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c flmain.c -o flmain.o
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c bitvector.c -o bitvector.o
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c hashing.c -o hashing.o
cd tests && ../flisp unittest.lsp
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c socket.c -o socket.o
/bin/sh: ../flisp: No such file or directory
make: *** [test] Error 127
make: *** Waiting for unfinished jobs....
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c timefuncs.c -o timefuncs.o
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c ptrhash.c -o ptrhash.o
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c utf8.c -o utf8.o
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c ios.c -o ios.o
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c dirpath.c -o dirpath.o
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c htable.c -o htable.o
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c bitvector-ops.c -o bitvector-ops.o
dirpath.c:116:53: error: /Developer/Headers/FlatCarbon/Processes.h: No such file or directory
dirpath.c:117:49: error: /Developer/Headers/FlatCarbon/Files.h: No such file or directory
dirpath.c: In function ‘get_exename’:
dirpath.c:120: error: ‘ProcessSerialNumber’ undeclared (first use in this function)
dirpath.c:120: error: (Each undeclared identifier is reported only once
dirpath.c:120: error: for each function it appears in.)
dirpath.c:120: error: expected ; before ‘PSN’
dirpath.c:121: error: ‘FSRef’ undeclared (first use in this function)
dirpath.c:121: error: expected ; before ‘ref’
dirpath.c:123: warning: implicit declaration of function ‘GetCurrentProcess’
dirpath.c:123: error: ‘PSN’ undeclared (first use in this function)
dirpath.c:124: warning: implicit declaration of function ‘GetProcessBundleLocation’
dirpath.c:124: error: ‘ref’ undeclared (first use in this function)
dirpath.c:125: warning: implicit declaration of function ‘FSRefMakePath’
make[1]: *** [dirpath.o] Error 1
make[1]: *** Waiting for unfinished jobs....
ios.c:50: warning: ‘_fd_poll’ defined but not used
make: *** [llt/libllt.a] Error 2
~/Pork/femtolisp on master ?

It doesn't look like its a LINUX setting in the Makefile issue anymore:

$ ack LINUX
Makefile
12:# OS flags: LINUX, WIN32, MACOSX

builtins.c
384:#ifdef LINUX

flisp.c
2298:#ifdef LINUX

llt/Makefile
10:# OS flags: LINUX, WIN32, MACOSX

llt/dirpath.c
63:#ifdef LINUX

llt/dtypes.h
31:#ifdef LINUX

llt/lookup3.c
48:#ifdef LINUX

llt/timefuncs.c
85:#ifdef LINUX
109:#if defined(LINUX) || defined(MACOSX)

@aeosynth
Copy link

aeosynth commented Jun 1, 2013

still can't make, latest master

$ make -f Makefile.macosx 
cc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers" -c flisp.c -o flisp.o
clang: warning: argument unused during compilation: '-falign-functions'
In file included from flisp.c:45:
In file included from llt/llt.h:5:
llt/dtypes.h:23:11: warning: 'MACOSX' macro redefined
#  define MACOSX
          ^
<command line>:3:9: note: previous definition is here
#define MACOSX 1
        ^
In file included from flisp.c:45:
In file included from llt/llt.h:6:
llt/utils.h:6:11: warning: 'ARCH_X86_64' macro redefined
#  define ARCH_X86_64
          ^
<command line>:4:9: note: previous definition is here
#define ARCH_X86_64 1
        ^
2 warnings generated.
cc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers" -c builtins.c -o builtins.o
clang: warning: argument unused during compilation: '-falign-functions'
In file included from builtins.c:16:
In file included from llt/llt.h:5:
llt/dtypes.h:23:11: warning: 'MACOSX' macro redefined
#  define MACOSX
          ^
<command line>:3:9: note: previous definition is here
#define MACOSX 1
        ^
In file included from builtins.c:16:
In file included from llt/llt.h:6:
llt/utils.h:6:11: warning: 'ARCH_X86_64' macro redefined
#  define ARCH_X86_64
          ^
<command line>:4:9: note: previous definition is here
#define ARCH_X86_64 1
        ^
2 warnings generated.
cc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers" -c string.c -o string.o
clang: warning: argument unused during compilation: '-falign-functions'
In file included from string.c:16:
In file included from llt/llt.h:5:
llt/dtypes.h:23:11: warning: 'MACOSX' macro redefined
#  define MACOSX
          ^
<command line>:3:9: note: previous definition is here
#define MACOSX 1
        ^
In file included from string.c:16:
In file included from llt/llt.h:6:
llt/utils.h:6:11: warning: 'ARCH_X86_64' macro redefined
#  define ARCH_X86_64
          ^
<command line>:4:9: note: previous definition is here
#define ARCH_X86_64 1
        ^
2 warnings generated.
cc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers" -c equalhash.c -o equalhash.o
clang: warning: argument unused during compilation: '-falign-functions'
In file included from equalhash.c:8:
In file included from llt/llt.h:5:
llt/dtypes.h:23:11: warning: 'MACOSX' macro redefined
#  define MACOSX
          ^
<command line>:3:9: note: previous definition is here
#define MACOSX 1
        ^
In file included from equalhash.c:8:
In file included from llt/llt.h:6:
llt/utils.h:6:11: warning: 'ARCH_X86_64' macro redefined
#  define ARCH_X86_64
          ^
<command line>:4:9: note: previous definition is here
#define ARCH_X86_64 1
        ^
2 warnings generated.
cc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers" -c table.c -o table.o
clang: warning: argument unused during compilation: '-falign-functions'
In file included from table.c:8:
In file included from llt/llt.h:5:
llt/dtypes.h:23:11: warning: 'MACOSX' macro redefined
#  define MACOSX
          ^
<command line>:3:9: note: previous definition is here
#define MACOSX 1
        ^
In file included from table.c:8:
In file included from llt/llt.h:6:
llt/utils.h:6:11: warning: 'ARCH_X86_64' macro redefined
#  define ARCH_X86_64
          ^
<command line>:4:9: note: previous definition is here
#define ARCH_X86_64 1
        ^
2 warnings generated.
cc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers" -c iostream.c -o iostream.o
clang: warning: argument unused during compilation: '-falign-functions'
In file included from iostream.c:8:
In file included from llt/llt.h:5:
llt/dtypes.h:23:11: warning: 'MACOSX' macro redefined
#  define MACOSX
          ^
<command line>:3:9: note: previous definition is here
#define MACOSX 1
        ^
In file included from iostream.c:8:
In file included from llt/llt.h:6:
llt/utils.h:6:11: warning: 'ARCH_X86_64' macro redefined
#  define ARCH_X86_64
          ^
<command line>:4:9: note: previous definition is here
#define ARCH_X86_64 1
        ^
iostream.c:114:9: warning: variable 'arg' is used uninitialized whenever 'if'
      condition is true [-Wsometimes-uninitialized]
    if (nargs > 1) {
        ^~~~~~~~~
iostream.c:123:22: note: uninitialized use occurs here
    (void)toiostream(arg, "read");
                     ^~~
iostream.c:114:5: note: remove the 'if' if its condition is always false
    if (nargs > 1) {
    ^~~~~~~~~~~~~~~~
iostream.c:113:16: note: initialize the variable 'arg' to silence this warning
    value_t arg;
               ^
                = 0
3 warnings generated.
cd llt && make -f Makefile.macosx
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c bitvector.c -o bitvector.o
In file included from bitvector.c:36:
dtypes.h:23:1: warning: "MACOSX" redefined
<command-line>: warning: this is the location of the previous definition
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c hashing.c -o hashing.o
In file included from hashing.c:7:
dtypes.h:23:1: warning: "MACOSX" redefined
<command-line>: warning: this is the location of the previous definition
In file included from hashing.c:8:
utils.h:6:1: warning: "ARCH_X86_64" redefined
<command-line>: warning: this is the location of the previous definition
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c socket.c -o socket.o
In file included from socket.c:8:
dtypes.h:23:1: warning: "MACOSX" redefined
<command-line>: warning: this is the location of the previous definition
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c timefuncs.c -o timefuncs.o
In file included from timefuncs.c:11:
dtypes.h:23:1: warning: "MACOSX" redefined
<command-line>: warning: this is the location of the previous definition
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c ptrhash.c -o ptrhash.o
In file included from ptrhash.c:12:
dtypes.h:23:1: warning: "MACOSX" redefined
<command-line>: warning: this is the location of the previous definition
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c utf8.c -o utf8.o
In file included from utf8.c:22:
dtypes.h:23:1: warning: "MACOSX" redefined
<command-line>: warning: this is the location of the previous definition
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c ios.c -o ios.o
In file included from ios.c:10:
dtypes.h:23:1: warning: "MACOSX" redefined
<command-line>: warning: this is the location of the previous definition
In file included from ios.c:25:
utils.h:6:1: warning: "ARCH_X86_64" redefined
<command-line>: warning: this is the location of the previous definition
gcc -O3 -DNDEBUG -Wall -Wno-strict-aliasing  -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -c dirpath.c -o dirpath.o
In file included from dirpath.c:11:
dtypes.h:23:1: warning: "MACOSX" redefined
<command-line>: warning: this is the location of the previous definition
dirpath.c:116:34: error: FlatCarbon/Processes.h: No such file or directory
dirpath.c:117:30: error: FlatCarbon/Files.h: No such file or directory
dirpath.c: In function ‘get_exename’:
dirpath.c:120: error: ‘ProcessSerialNumber’ undeclared (first use in this function)
dirpath.c:120: error: (Each undeclared identifier is reported only once
dirpath.c:120: error: for each function it appears in.)
dirpath.c:120: error: expected ‘;’ before ‘PSN’
dirpath.c:121: error: ‘FSRef’ undeclared (first use in this function)
dirpath.c:121: error: expected ‘;’ before ‘ref’
dirpath.c:123: warning: implicit declaration of function ‘GetCurrentProcess’
dirpath.c:123: error: ‘PSN’ undeclared (first use in this function)
dirpath.c:124: warning: implicit declaration of function ‘GetProcessBundleLocation’
dirpath.c:124: error: ‘ref’ undeclared (first use in this function)
dirpath.c:125: warning: implicit declaration of function ‘FSRefMakePath’
make[1]: *** [dirpath.o] Error 1
make: *** [llt/libllt.a] Error 2

@JeffBezanson
Copy link
Owner

Looks like get_exename at the bottom of llt/dirpath.c needs to be replaced for Mac.

Could you try replacing the includes and function definition with one using _NSGetExecutablePath, documented here:

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/dyld.3.html

@aeosynth
Copy link

aeosynth commented Jun 9, 2013

i'm not a c hacker, but here's my attempt:

~/src/clone/femtolisp master                                                                                                                                                                                                                                                    
$ git diff
diff --git a/llt/dirpath.c b/llt/dirpath.c
index b68b8ca..534172f 100644
--- a/llt/dirpath.c
+++ b/llt/dirpath.c
@@ -119,16 +119,10 @@ char *get_exename(char *buf, size_t size)
     return buf;
 }
 #elif defined(MACOSX)
-#include <FlatCarbon/Processes.h>
-#include <FlatCarbon/Files.h>
+#include <mach-o/dyld.h>
 char *get_exename(char *buf, size_t size)
 {
-    ProcessSerialNumber PSN;
-    FSRef ref;
-
-    if (GetCurrentProcess(&PSN) < 0 ||
-        GetProcessBundleLocation(&PSN, &ref) < 0 ||
-        FSRefMakePath(&ref, buf, size) < 0)
+    if (_NSGetExecutablePath(buf, size) == -1)
         return NULL;

     return buf;
~/src/clone/femtolisp master                                                                                                                                                                                                                                                    
$ make -f Makefile.macosx 
cc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers" flisp.o builtins.o string.o equalhash.o table.o iostream.o flmain.o -o flisp llt/libllt.a -lm -framework ApplicationServices libflisp.a
cd tests && ../flisp unittest.lsp
/bin/sh: line 1:  2165 Segmentation fault: 11  ../flisp unittest.lsp
make: *** [test] Error 139

@JeffBezanson
Copy link
Owner

According to the man page we would need

uint32_t size32 = size;
...
_NSGetExecutablePath(buf, &size32)

@aeosynth
Copy link

fixed, same error:

$ make -f Makefile.macosx 
cc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers" flisp.o builtins.o string.o equalhash.o table.o iostream.o flmain.o -o flisp llt/libllt.a -lm -framework ApplicationServices libflisp.a
cd tests && ../flisp unittest.lsp
/bin/sh: line 1: 14409 Segmentation fault: 11  ../flisp unittest.lsp
make: *** [test] Error 139

edit: whoops, use make -f Makefile.macosx instead of make

@gitfoxi
Copy link

gitfoxi commented Jan 4, 2014

unittest.lsp passes over here but torture.scm segfaults. But maybe that's the point of torture.scm.

@primitivorm
Copy link

I try to compile with mingw64 on Windows and I get the following error:

c:\src\femtolisp>make
gcc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt  -DUSE_COMPU
TED_GOTO -c flisp.c -o flisp.o
In file included from llt/llt.h:5:0,
                 from flisp.c:46:
llt/dtypes.h:29:0: warning: "WIN32" redefined
 #  define WIN32
 ^
<built-in>: note: this is the location of the previous definition
In file included from llt/llt.h:6:0,
                 from flisp.c:46:
llt/utils.h:10:6: error: #error "unsupported target: 16-bit x86"
 #    error "unsupported target: 16-bit x86"
      ^
Makefile:26: recipe for target 'flisp.o' failed
make: *** [flisp.o] Error 1

c:\src\femtolisp>

Can somebody help me please?

@g3ntleman
Copy link

I'm seeing a different problem on current macOS:

I followed the readme for building femtolisp on current macOS. It fails with the following errors:

cc -O2 -DNDEBUG -falign-functions -Wall -Wno-strict-aliasing -Illt -DUSE_COMPUTED_GOTO -DMACOSX -DARCH_X86_64 -DBITS64 -D__CPU__=686 -I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers" flisp.o builtins.o string.o equalhash.o table.o iostream.o flmain.o
-o flisp llt/libllt.a -lm -framework ApplicationServices libflisp.a
ld: warning: ld: warning: ignoring file libflisp.a, file was built for archive which is not the architecture being linked (x86_64): libflisp.aignoring file llt/libllt.a, file was built for archive which is not the architecture being linked (x86_64): llt/libllt.a

Undefined symbols for architecture x86_64:
"_D_NINF", referenced from:
_isnumtok_base in flisp.o
"_D_NNAN", referenced from:
_isnumtok_base in flisp.o
"_D_PINF", referenced from:
_isnumtok_base in flisp.o

....

So it appears that the linker command is not correct. Also, the SDK header path does not seem to be used (and carbon is no longer available on 64 bit platforms). I was able to compile without the above SDK header path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants