- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
在我的 Macbook Pro 主板出现故障之前,我正在使用 Flex、Bison 和 LLVM 编写我的编程语言。老实说,我不记得我当时链接的 LLVM 版本(我会在从驱动器中抢救数据后尝试找出它),但我知道我现在使用的最新版本来自 git (clang 版本 3.9.0(http://llvm.org/git/clang.git 7658b570923dcdfaaec04d837b7e8862eff895f8)(http://llvm.org/git/llvm.git 4edb79d2d975816fee53b814703812b2287ed455))有一些我必须补偿的小 API 更改。
实际上,我最终用 MSI GS40 替换了我的 Macbook,并选择了 Arch Linux 作为我的新主操作系统。所以我这里的两个主要变量是 Linux 与 OS X 以及所涉及的不同版本的 LLVM/Clang/GCC。
我像在 OS X 上一样构建 LLVM:
git clone http://llvm.org/git/llvm.git
git clone http://llvm.org/git/clang.git llvm/tools/clang
git clone http://llvm.org/git/clang-tools-extra.git llvm/tools/clang/tools/extra
git clone http://llvm.org/git/compiler-rt.git llvm/projects/compiler-rt
git clone http://llvm.org/git/libcxx.git llvm/projects/libcxx
git clone http://llvm.org/git/libcxxabi.git llvm/projects/libcxxabi
mkdir build_llvm
cd build_llvm && cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=prefix=/usr/local/llvm ../llvm
make
make install
直到这一次我才意识到它创建了一个“prefix=”文件夹,因为 LLVM 的文档使它看起来就像是命令(实际上你会省略 prefix=
).所以我只是手动将输出 llvm
文件夹移动到一个新位置,并将 include
目录导出到我的 .bash_profile 中。
我现在正在编译项目,但我无法与 LLVM 链接并收到以下错误:
mycompiler.codegen.o: In function `CodeGenContext':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:59: undefined reference to `llvm::sys::getProcessTriple()'
mycompiler.codegen.o: In function `CodeGenContext::handleError(int, int, llvm::StringRef, llvm::Twine const&)':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:87: undefined reference to `llvm::Twine::str() const'
mycompiler.codegen.o: In function `CompilationUnit::debugPrintInternal(std::ostream&, CodeGenContext&, llvm::Twine const&)':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:2200: undefined reference to `llvm::Twine::str() const'
mycompiler.codegen.o: In function `NamespaceDeclarationNode::debugPrintInternal(std::ostream&, CodeGenContext&, llvm::Twine const&)':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:2220: undefined reference to `llvm::Twine::str() const'
mycompiler.codegen.o: In function `UsingDeclarationNode::debugPrintInternal(std::ostream&, CodeGenContext&, llvm::Twine const&)':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:2226: undefined reference to `llvm::Twine::str() const'
mycompiler.codegen.o: In function `Int8Node::debugPrintInternal(std::ostream&, CodeGenContext&, llvm::Twine const&)':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:2237: undefined reference to `llvm::Twine::str() const'
mycompiler.codegen.o:/home/storage/data/mycompiler/mycompiler.codegen.cpp:2242: more undefined references to `llvm::Twine::str() const' follow
clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:27: recipe for target 'mycompiler' failed
make: *** [mycompiler] Error 1
奇怪的是,它们应该在包含的 LLVMSupport 库中。
我的生成文件:
all: mycompiler
LLVMCONFIG = llvm-config
CPPFLAGS = `$(LLVMCONFIG) --cxxflags` -v
LDFLAGS = `$(LLVMCONFIG) --ldflags` -v -rdynamic
LIBS = `$(LLVMCONFIG) --libs --system-libs`
LEGACY_FLEX_WARNS = -Wno-deprecated-register
OBJECTS = mycompiler.lexer.o \
mycompiler.parser.o \
mycompiler.driver.o \
mycompiler.codegen.o
mycompiler.parser.hpp: mycompiler.parser.cpp
mycompiler.parser.cpp: mycompiler.y
bison -d $^ --verbose --report=all --report-file=bison_report
mycompiler.lexer.cpp: mycompiler.l mycompiler.parser.hpp
flex mycompiler.l
%.o: %.cpp
clang++ $(LEGACY_FLEX_WARNS) -c $< $(CPPFLAGS) -o $@
mycompiler: $(OBJECTS)
clang++ -g $^ $(LDFLAGS) $(LIBS) -o $@
clean:
rm -f *.o *.bc *~ *.output
rm -f mycompiler.lexer.cpp mycompiler.lexer.hpp mycompiler.parser.cpp mycompiler.parser.hpp
rm -f mycompiler bison_report
您会注意到我包含了用于详细输出的 -v
,因此我可以看到所有的库以及 llvm-config 包含的此类库。我实际上已经尝试了几种不同的构建参数,但最终遇到了更多链接器问题。
这是完整构建的详细输出示例:
bison -d mycompiler.y --verbose --report=all --report-file=bison_report
flex mycompiler.l
clang++ -Wno-deprecated-register -c mycompiler.lexer.cpp `llvm-config --cxxflags` -v -o mycompiler.lexer.o
clang version 3.9.0 (http://llvm.org/git/clang.git 7658b570923dcdfaaec04d837b7e8862eff895f8) (http://llvm.org/git/llvm.git 4edb79d2d975816fee53b814703812b2287ed455)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/storage/data/build_llvm/build/llvm/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/home/storage/data/build_llvm/build/llvm/bin/clang-3.9" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name mycompiler.lexer.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-file /home/storage/data/mycompiler/mycompiler.lexer.o -resource-dir /home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0 -I /home/storage/data/build_llvm/build/llvm/include -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1 -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/x86_64-pc-linux-gnu -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward -internal-isystem /usr/local/include -internal-isystem /home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-deprecated-register -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -pedantic -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/storage/data/mycompiler -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -o mycompiler.lexer.o -x c++ mycompiler.lexer.cpp
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
clang -cc1 version 3.9.0 based upon LLVM 3.9.0svn default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/home/storage/data/build_llvm/build/llvm/include
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/x86_64-pc-linux-gnu
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward
/usr/local/include
/home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0/include
/usr/include
End of search list.
mycompiler.l:393:12: warning: unused function 'isValidChar' [-Wunused-function]
static int isValidChar(const char c)
^
2 warnings generated.
clang++ -Wno-deprecated-register -c mycompiler.parser.cpp `llvm-config --cxxflags` -v -o mycompiler.parser.o
clang version 3.9.0 (http://llvm.org/git/clang.git 7658b570923dcdfaaec04d837b7e8862eff895f8) (http://llvm.org/git/llvm.git 4edb79d2d975816fee53b814703812b2287ed455)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/storage/data/build_llvm/build/llvm/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/home/storage/data/build_llvm/build/llvm/bin/clang-3.9" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name mycompiler.parser.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-file /home/storage/data/mycompiler/mycompiler.parser.o -resource-dir /home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0 -I /home/storage/data/build_llvm/build/llvm/include -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1 -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/x86_64-pc-linux-gnu -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward -internal-isystem /usr/local/include -internal-isystem /home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-deprecated-register -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -pedantic -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/storage/data/mycompiler -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -o mycompiler.parser.o -x c++ mycompiler.parser.cpp
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
clang -cc1 version 3.9.0 based upon LLVM 3.9.0svn default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/home/storage/data/build_llvm/build/llvm/include
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/x86_64-pc-linux-gnu
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward
/usr/local/include
/home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0/include
/usr/include
End of search list.
1 warning generated.
clang++ -Wno-deprecated-register -c mycompiler.driver.cpp `llvm-config --cxxflags` -v -o mycompiler.driver.o
clang version 3.9.0 (http://llvm.org/git/clang.git 7658b570923dcdfaaec04d837b7e8862eff895f8) (http://llvm.org/git/llvm.git 4edb79d2d975816fee53b814703812b2287ed455)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/storage/data/build_llvm/build/llvm/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/home/storage/data/build_llvm/build/llvm/bin/clang-3.9" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name mycompiler.driver.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-file /home/storage/data/mycompiler/mycompiler.driver.o -resource-dir /home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0 -I /home/storage/data/build_llvm/build/llvm/include -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1 -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/x86_64-pc-linux-gnu -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward -internal-isystem /usr/local/include -internal-isystem /home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-deprecated-register -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -pedantic -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/storage/data/mycompiler -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -o mycompiler.driver.o -x c++ mycompiler.driver.cpp
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
clang -cc1 version 3.9.0 based upon LLVM 3.9.0svn default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/home/storage/data/build_llvm/build/llvm/include
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/x86_64-pc-linux-gnu
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward
/usr/local/include
/home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0/include
/usr/include
End of search list.
mycompiler.driver.cpp:99:15: warning: unused variable 'output' [-Wunused-variable]
FILE *output = yyget_out(myscanner); // TODO: where do we want to redirect this?
^
2 warnings generated.
clang++ -Wno-deprecated-register -c mycompiler.codegen.cpp `llvm-config --cxxflags` -v -o mycompiler.codegen.o
clang version 3.9.0 (http://llvm.org/git/clang.git 7658b570923dcdfaaec04d837b7e8862eff895f8) (http://llvm.org/git/llvm.git 4edb79d2d975816fee53b814703812b2287ed455)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/storage/data/build_llvm/build/llvm/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/home/storage/data/build_llvm/build/llvm/bin/clang-3.9" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name mycompiler.codegen.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-file /home/storage/data/mycompiler/mycompiler.codegen.o -resource-dir /home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0 -I /home/storage/data/build_llvm/build/llvm/include -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1 -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/x86_64-pc-linux-gnu -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward -internal-isystem /usr/local/include -internal-isystem /home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-deprecated-register -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -pedantic -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/storage/data/mycompiler -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -o mycompiler.codegen.o -x c++ mycompiler.codegen.cpp
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
clang -cc1 version 3.9.0 based upon LLVM 3.9.0svn default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/home/storage/data/build_llvm/build/llvm/include
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/x86_64-pc-linux-gnu
/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward
/usr/local/include
/home/storage/data/build_llvm/build/llvm/bin/../lib/clang/3.9.0/include
/usr/include
End of search list.
1 warning generated.
clang++ -g mycompiler.lexer.o mycompiler.parser.o mycompiler.driver.o mycompiler.codegen.o `llvm-config --ldflags` -v -rdynamic `llvm-config --link-static --libs --system-libs` -o mycompiler
clang version 3.9.0 (http://llvm.org/git/clang.git 7658b570923dcdfaaec04d837b7e8862eff895f8) (http://llvm.org/git/llvm.git 4edb79d2d975816fee53b814703812b2287ed455)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/storage/data/build_llvm/build/llvm/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/usr/bin/ld" -export-dynamic --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o mycompiler /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/crtbegin.o -L/home/storage/data/build_llvm/build/llvm/lib -L/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../.. -L/home/storage/data/build_llvm/build/llvm/bin/../lib -L/lib -L/usr/lib mycompiler.lexer.o mycompiler.parser.o mycompiler.driver.o mycompiler.codegen.o -lLLVMTableGen -lLLVMLTO -lLLVMObjCARCOpts -lLLVMPasses -lLLVMCoverage -lLLVMOrcJIT -lLLVMObjectYAML -lLLVMMIRParser -lLLVMInterpreter -lLLVMLineEditor -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMLibDriver -lLLVMOption -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMBPFAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMipo -lLLVMVectorize -lLLVMObject -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUInfo -lLLVMAMDGPUAsmPrinter -lLLVMAMDGPUUtils -lLLVMAArch64Disassembler -lLLVMMCDisassembler -lLLVMAArch64CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMInstrumentation -lLLVMProfileData -lLLVMTransformUtils -lLLVMBitWriter -lLLVMBitReader -lLLVMAnalysis -lLLVMCore -lLLVMAArch64AsmParser -lLLVMMCParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport -lrt -ldl -lcurses -lpthread -lz -lm -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/crtend.o /usr/lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib64/crtn.o
mycompiler.codegen.o: In function `CodeGenContext':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:59: undefined reference to `llvm::sys::getProcessTriple()'
mycompiler.codegen.o: In function `CodeGenContext::handleError(int, int, llvm::StringRef, llvm::Twine const&)':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:87: undefined reference to `llvm::Twine::str() const'
mycompiler.codegen.o: In function `CompilationUnit::debugPrintInternal(std::ostream&, CodeGenContext&, llvm::Twine const&)':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:2200: undefined reference to `llvm::Twine::str() const'
mycompiler.codegen.o: In function `NamespaceDeclarationNode::debugPrintInternal(std::ostream&, CodeGenContext&, llvm::Twine const&)':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:2220: undefined reference to `llvm::Twine::str() const'
mycompiler.codegen.o: In function `UsingDeclarationNode::debugPrintInternal(std::ostream&, CodeGenContext&, llvm::Twine const&)':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:2226: undefined reference to `llvm::Twine::str() const'
mycompiler.codegen.o: In function `Int8Node::debugPrintInternal(std::ostream&, CodeGenContext&, llvm::Twine const&)':
/home/storage/data/mycompiler/mycompiler.codegen.cpp:2237: undefined reference to `llvm::Twine::str() const'
mycompiler.codegen.o:/home/storage/data/mycompiler/mycompiler.codegen.cpp:2242: more undefined references to `llvm::Twine::str() const' follow
clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:27: recipe for target 'mycompiler' failed
make: *** [mycompiler] Error 1
请注意,我目前通过简单地使用 --libs
参数到 llvm-config
来包括所有 LLVM 组件。我也尝试通过选择我需要的各种组件来修改它,结果相同。
warning: unknown warning option '-Wno-maybe-uninitialized';
显然也是这个版本的 LLVM 中的新内容,因为我之前没有收到该警告。
我确信这在 Arch 上是可能的,因为我发现有类似错误的搜索之一是在 Arch Wiki 上,但是你可以看到我已经在遵循在这个 stackoverflow post 上回答的建议.
如有任何帮助,我们将不胜感激。
对于那些感兴趣的人,可以在以下链接中找到一些相关信息:
最佳答案
很好...
所以这似乎是 GCC 5.0 和 Clang 之间 ABI 不兼容的错误。 :(
我现在可以通过在我的 Makefile 中从 clang++ 切换到 g++ 轻松修复。
有趣的是,g++ 的构建速度似乎比 clang 快得多。我说的是快几个数量级。
关于linux - Arch Linux 上来自 git (3.9.0svn) 的最新 LLVM 的“ undefined reference ”链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37900835/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
Linux 管道可以缓冲多少数据?这是可配置的吗? 如果管道的两端在同一个进程中,但线程不同,这会有什么不同吗? 请注意:这个“同一个进程,两个线程”的问题是理论上的边栏,真正的问题是关于缓冲的。 最
我找到了here [最后一页] 一种有趣的通过 Linux 启动 Linux 的方法。不幸的是,它只是被提及,我在网上找不到任何有用的链接。那么有人听说过一种避免引导加载程序而使用 Linux 的方法
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我试图了解 ld-linux.so 如何在 Linux 上解析对版本化符号的引用。我有以下文件: 测试.c: void f(); int main() { f(); } a.c 和 b.c:
与 RetroPie 的工作原理类似,我可以使用 Linux 应用程序作为我的桌面环境吗?我实际上并不需要像实际桌面和安装应用程序这样的东西。我只需要一种干净简单的方法来在 RaspberryPi 上
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 10 年前。 Improve thi
有什么方法可以覆盖现有的源代码,我应该用 PyQt、PyGTK、Java 等从头开始构建吗? 最佳答案 如果您指的是软件本身而不是它所连接的存储库,那么自定义应用程序的方法就是 fork 项目。据我所
我的情况是:我在一个磁盘上安装了两个 linux。我将第一个安装在/dev/sda1 中,然后在/dev/sda2 中安装第二个然后我运行第一个系统,我写了一个脚本来在第一个系统运行时更新它。
我在 i2c-0 总线上使用地址为 0x3f 的系统监视器设备。该设备在设备树中配置有 pmbus 驱动程序。 问题是,加载 linux 内核时,这个“Sysmon”设备没有供电。因此,当我在总线 0
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 11 年前。 Improve thi
我正试图在 linux 模块中分配一大块内存,而 kalloc 做不到。 我知道唯一的方法是使用 alloc_bootmem(unsigned long size) 但我只能从 linux 内核而不是
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我有 .sh 文件来运行应用程序。在该文件中,我想动态设置服务器名称,而不是每次都配置。 我尝试了以下方法,它在 CentOS 中运行良好。 nohup /voip/java/jdk1.8.0_71/
我是在 Linux 上开发嵌入式 C++ 程序的新手。我有我的 Debian 操作系统,我在其中开发和编译了我的 C++ 项目(一个简单的控制台进程)。 我想将我的应用程序放到另一个 Debian 操
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 4 年前。 Improve this ques
我使用4.19.78版本的稳定内核,我想找到带有企鹅二进制数据的C数组。系统启动时显示。我需要在哪里搜索该内容? 我在 include/linux/linux_logo.h 文件中只找到了一些 Log
我知道可以使用 gdb 的服务器模式远程调试代码,我知道可以调试针对另一种架构交叉编译的代码,但是是否可以更进一步,从远程调试 Linux 应用程序OS X 使用 gdbserver? 最佳答案 当然
是否有任何可能的方法来运行在另一个 Linux 上编译的二进制文件?我知道当然最简单的是在另一台机器上重建它,但假设我们唯一能得到的是一个二进制文件,那么这可能与否? (我知道这可能并不容易,但我只是
我是一名优秀的程序员,十分优秀!