Mercerenies / latitude

Latitude - A prototype-oriented programming language
MIT License
7 stars 0 forks source link

Latitude fails to compile on OSX #48

Open taw opened 2 years ago

taw commented 2 years ago
$ git clone https://github.com/Mercerenies/latitude
$ cd latitude
$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src/
bison -d Parser.y
Parser.y:5.1-5: invalid directive: `%code'
Parser.y:5.7-9: syntax error, unexpected identifier
make[1]: *** [Parser.tab.c] Error 1
make: *** [Project] Error 2
$ bison --version
bison (GNU Bison) 2.3
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Mercerenies commented 2 years ago

Hi, thank you for your interest in Latitude!

Unfortunately, it looks like you're running a fairly old version of Bison. I've been compiling against BIson 3.4.1 (from 2019) locally, and based on the copyright declaration it looks like you're running a version from 2006. I suspect the %code directive (which is unique to Bison, not a yacc holdover) was added later. Is it possible for you to get an ugpraded Bison on your machine? If you get it working, please let me know what version works with Latitude, so I can add it to the documentation. Thanks for reporting!

taw commented 2 years ago

That's the bison that comes with OSX. There's a bunch of old software included with OSX dev tools (I'm guessing because of GPL 2 vs GPL 3 drama or something, not even sure).

Anyway, if I get one from homebrew and set the PATH to it, I get a bunch of warnings, and then this error next:

/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src/
c++  -c -Wall -std=gnu++1y Number.cpp
Number.cpp:31:22: error: reference to 'distance' is ambiguous
            typename distance<
                     ^
/usr/local/include/boost/mpl/distance.hpp:67:8: note: candidate found by name lookup is 'boost::mpl::distance'
struct distance
       ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:698:1: note: candidate found by name lookup is 'std::__1::distance'
distance(_InputIter __first, _InputIter __last)
^
/usr/local/include/boost/iterator/distance.hpp:49:9: note: candidate found by name lookup is 'boost::iterators::distance_adl_barrier::distance'
        distance(SinglePassIterator first, SinglePassIterator last)
        ^
/usr/local/include/boost/range/distance.hpp:30:9: note: candidate found by name lookup is 'boost::range_distance_adl_barrier::distance'
        distance( const T& r )
        ^
1 error generated.
make[1]: *** [Number.o] Error 1
make: *** [Project] Error 2
c++ --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Mercerenies commented 2 years ago

Interesting. It looks like there are some issues with Latitude when compiling with clang. You're welcome to try gcc in the meantime, but this is definitely something I'll need to look into further, as clang fails to build this repo on my machine too. Thank you for bringing this to my attention. It's very possible I'd never tried using anything other than g++ when first developing this.