tdenniston / bish

Bish is a language that compiles to Bash. It's designed to give shell scripting a more comfortable and modern feel.
MIT License
1.48k stars 36 forks source link

Not able to compile on OS X 10.10.2 #45

Closed p3k closed 9 years ago

p3k commented 9 years ago

I am not sure if I am having the C++ Stdlib – how could I verify it? And how would I install it if necessary? I am using MacPorts.

Anyway, here is the compiler output:

⚡  make
g++ -g -O0 -c src/CallGraph.cpp -o obj/CallGraph.o -MMD -MF obj/CallGraph.d -MT obj/CallGraph.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
couldn't understand kern.osversion `14.1.0'
g++ -g -O0 -c src/Compile.cpp -o obj/Compile.o -MMD -MF obj/Compile.d -MT obj/Compile.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
couldn't understand kern.osversion `14.1.0'
g++ -g -O0 -c src/FindCalls.cpp -o obj/FindCalls.o -MMD -MF obj/FindCalls.d -MT obj/FindCalls.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
couldn't understand kern.osversion `14.1.0'
g++ -g -O0 -c src/IR.cpp -o obj/IR.o -MMD -MF obj/IR.d -MT obj/IR.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
couldn't understand kern.osversion `14.1.0'
g++ -g -O0 -c src/IRVisitor.cpp -o obj/IRVisitor.o -MMD -MF obj/IRVisitor.d -MT obj/IRVisitor.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
couldn't understand kern.osversion `14.1.0'
g++ -g -O0 -c src/IRAncestorsPass.cpp -o obj/IRAncestorsPass.o -MMD -MF obj/IRAncestorsPass.d -MT obj/IRAncestorsPass.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
couldn't understand kern.osversion `14.1.0'
g++ -g -O0 -c src/CodeGen_Bash.cpp -o obj/CodeGen_Bash.o -MMD -MF obj/CodeGen_Bash.d -MT obj/CodeGen_Bash.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
couldn't understand kern.osversion `14.1.0'
src/CodeGen_Bash.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
src/CodeGen_Bash.cpp:41:   instantiated from here
src/CodeGen_Bash.cpp:41: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
src/CodeGen_Bash.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
src/CodeGen_Bash.cpp:41:   instantiated from here
src/CodeGen_Bash.cpp:41: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
src/CodeGen_Bash.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
src/CodeGen_Bash.cpp:41:   instantiated from here
src/CodeGen_Bash.cpp:41: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
src/CodeGen_Bash.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
src/CodeGen_Bash.cpp:41:   instantiated from here
src/CodeGen_Bash.cpp:41: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
make: *** [obj/CodeGen_Bash.o] Error 1
tdenniston commented 9 years ago

Hmm. Did you recently update to 10.10? And did you update your ports when you did? I googled for "couldn't understand kern.osversion `14.1.0'" and turned up a couple of links that seem to indicate that you might be using the gcc installation from before your upgrade.

Also, could you post the output of g++ -v?

heyvito commented 9 years ago

Compiled on Yosemite 10.10.2 (without MacPorts) without problems. Output of g++ -v:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix
p3k commented 9 years ago

Thanks for the swift replies!

Are my Xcode command-line tools b0rked in some way?

$ gcc -v
couldn't understand kern.osversion `14.1.0'
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

Anyway, after switching to the MacPort version of gcc everything built smoothly.

$ sudo port select gcc mp-gcc48
Selecting 'mp-gcc48' for 'gcc' succeeded. 'mp-gcc48' is now active.
$ make
g++ -g -O0 -c src/CodeGen_Bash.cpp -o obj/CodeGen_Bash.o -MMD -MF obj/CodeGen_Bash.d -MT obj/CodeGen_Bash.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
g++ -g -O0 -c src/Parser.cpp -o obj/Parser.o -MMD -MF obj/Parser.d -MT obj/Parser.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
g++ -g -O0 -c src/SymbolTable.cpp -o obj/SymbolTable.o -MMD -MF obj/SymbolTable.d -MT obj/SymbolTable.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
g++ -g -O0 -c src/TypeChecker.cpp -o obj/TypeChecker.o -MMD -MF obj/TypeChecker.d -MT obj/TypeChecker.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
g++ -g -O0 -c src/Util.cpp -o obj/Util.o -MMD -MF obj/Util.d -MT obj/Util.o -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
ld -r -o obj/bish.o obj/CallGraph.o obj/Compile.o obj/FindCalls.o obj/IR.o obj/IRVisitor.o obj/IRAncestorsPass.o obj/CodeGen_Bash.o obj/Parser.o obj/SymbolTable.o obj/TypeChecker.o obj/Util.o
ar q obj/libbish.a obj/bish.o
ar: creating archive obj/libbish.a
ranlib obj/libbish.a
g++ -g -O0 -o bish src/bish.cpp obj/libbish.a -DSTDLIB_PATH="\"/Users/tobi/.bish/src/StdLib.bish\""
p3k commented 9 years ago

OK, I think I found my mistake (or rather: relic of ancient times). I have had /Developer/usr/bin in my PATH and there exist a lot of old binaries – among them the 4.2.1 version of gcc shown above.

After removal I now get the output as @victorgama :)

tdenniston commented 9 years ago

Glad you got it sorted out!