andyfischer/circa

Build error (OS X 10.6.8)

jtakakura opened this issue · 4 comments

I got the bellow error when I was building the source from git master:

$ ./make
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/release/src/names.o -c -ggdb -Wall -O1 -Iinclude build/release/src/names.cpp
g++ -o build/release/src/stateful_code.o -c -ggdb -Wall -O1 -Iinclude build/release/src/stateful_code.cpp
build/release/src/names.cpp: In function 'circa::Name circa::name_from_string(const char_)':
build/release/src/names.cpp:533: error: 'strndup' was not declared in this scope
scons: *_* [build/release/src/names.o] Error 1
scons: building terminated because of errors.

Hmm, not sure what would cause this. What version of g++ are you using? (or which Xcode version if it was installed from there)

I also ran into this on 10.6.8 with GCC 4.2.1.

Here's an explanation:
http://stackoverflow.com/questions/6062822/whats-wrong-with-strndup

I copied this implementation of strndup into names.cpp, but I imagine you'd rather have a cleaner solution ;)
http://opensource.apple.com/source/gcc/gcc-5575.11/libiberty/strndup.c

Related to GNU extentions to libc, I also needed to #define CIRCA_ENABLE_STDIN 0 in common_headers.h because circa::read_stdin_line in command_reader.cpp uses the GNU extension "getline".

Ahh, thanks Mark for that research. I replaced the strndup call with malloc/memcpy.

For the getline call, this isn't fixed yet. I think I will replace getline with something fancier like the editline library, and also move that command-line stuff out of the core library and into a separate app.

The GUI app Canvas should be ready in a few days, so we'll make sure that it can build on 10.6.8 (with the STDIN stuff turned off)

Fixed the build problem with missing getline (now it uses antirez/linenoise which uses gets()), so hopefully this is fixed