| author | |
| committer | |
| log | 8d60ffe314306e5295fb76338c6391e5fe986dea |
| tree | 06e551cf499421ce89656181b814c02c86875034 |
| parent | 8409e518abad78cef8984b798c404bdc2923efbf |
big surprise, C++ is to blame3 files changed, 23 insertions(+), 0 deletions(-)
README.md+14| ... | @@ -90,3 +90,17 @@ cmake .. -DCMAKE_BUILD_TYPE=Release -DZIG_LIBC_DIR=path/to/libc/dir | ... | @@ -90,3 +90,17 @@ cmake .. -DCMAKE_BUILD_TYPE=Release -DZIG_LIBC_DIR=path/to/libc/dir |
| 90 | make | 90 | make |
| 91 | sudo make install | 91 | sudo make install |
| 92 | ``` | 92 | ``` |
| 93 | |||
| 94 | ### Troubleshooting | ||
| 95 | |||
| 96 | If you get one of these: | ||
| 97 | |||
| 98 | * `undefined reference to `_ZNK4llvm17SubtargetFeatures9getStringB5cxx11Ev'` | ||
| 99 | * `undefined reference to `llvm::SubtargetFeatures::getString() const'` | ||
| 100 | |||
| 101 | This is because of [C++'s Dual ABI](https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html). | ||
| 102 | Most likely LLVM was compiled with one compiler while Zig was compiled with a | ||
| 103 | different one, for example GCC vs clang. | ||
| 104 | |||
| 105 | To fix this, compile Zig with the same compiler that LLVM was compiled with, or | ||
| 106 | add `-DZIG_LLVM_OLD_CXX_ABI=yes` to the cmake configure line. |
src/config.h.in+2| ... | @@ -10,4 +10,6 @@ | ... | @@ -10,4 +10,6 @@ |
| 10 | #define ZIG_STD_DIR "@CMAKE_INSTALL_PREFIX@/@ZIG_STD_DEST@" | 10 | #define ZIG_STD_DIR "@CMAKE_INSTALL_PREFIX@/@ZIG_STD_DEST@" |
| 11 | #define ZIG_LIBC_DIR "@ZIG_LIBC_DIR@" | 11 | #define ZIG_LIBC_DIR "@ZIG_LIBC_DIR@" |
| 12 | 12 | ||
| 13 | #cmakedefine ZIG_LLVM_OLD_CXX_ABI | ||
| 14 | |||
| 13 | #endif | 15 | #endif |
src/zig_llvm.cpp+7| ... | @@ -5,6 +5,13 @@ | ... | @@ -5,6 +5,13 @@ |
| 5 | * See http://opensource.org/licenses/MIT | 5 | * See http://opensource.org/licenses/MIT |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | // This must go before all includes. | ||
| 9 | #include "config.h" | ||
| 10 | #if defined(ZIG_LLVM_OLD_CXX_ABI) | ||
| 11 | #define _GLIBCXX_USE_CXX11_ABI 0 | ||
| 12 | #endif | ||
| 13 | |||
| 14 | |||
| 8 | #include "zig_llvm.hpp" | 15 | #include "zig_llvm.hpp" |
| 9 | 16 | ||
| 10 | /* | 17 | /* |