mun-lang / lld-rs Goto Github PK
View Code? Open in Web Editor NEWWrapper around LLVM's LLD
License: Other
Wrapper around LLVM's LLD
License: Other
When trying to build this I get the error fatal error C1083: Cannot open include file: 'lld/Common/CommonLinkerContext.h': No such file or directory
.
Where are the headers for lld included? The llvm-config cxx flags only include these two folders -IC:\llvm\llvm\include -IC:\llvm_build\include
, but I don't see where the -IC:\llvm\lld\include
flag is (or if it even exists).
For clarification, my llvm source is in the C:\llvm
folder and my binaries (the built version) is on C:\llvm_build
. I'm using LLVM 14.0.6.
Thanks in advance for your help.
Hey there,
I ran across this project for a quite similar use case: I was building a LLVM based compiler that basically compiles RISC-V assembly to x86_64(and possibly more architecture) assembly. Since LLVM emits object code, I was using a linker previously, but as lld-rs
shows, this can be done via linking against lld directly in the Rust code.
I do want to use lld-rs
instead of re-inventing the same thing, but unfortunately I'm using LLVM 15 now while lld-rs only supports LLVM 14 in the main branch. I did notice stale branches related to LLVM 15, which makes me want to check here: what plan do you have in mind for maintaining multiple LLVM versions? I do understand upgrading a major version of LLVM can be risky and Mun might stick to LLVM 14 for a while, but just want to consult here: any plan on supporting more LLVM versions at the same time, like what inkwell does now?
hi! I'm having trouble building this crate, I have lld 14.0.6.
Compiling lld_rs v130.0.0
The following warnings were emitted during compilation:
warning: wrapper/lld-c.cpp: In function ‘LldInvokeResult mun_lld_link(LldFlavor, int, const char* const*)’:
warning: wrapper/lld-c.cpp:59:45: error: invalid initialization of non-const reference of type ‘llvm::raw_ostream&’ from an rvalue of type ‘bool’
warning: 59 | result.success = lld::elf::link(args, false, outputStream, errorStream);
warning: | ^~~~~
warning: In file included from wrapper/lld-c.cpp:2:
warning: /usr/include/lld/Common/Driver.h:42:65: note: in passing argument 2 of ‘bool lld::elf::link(llvm::ArrayRef<const char*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool)’
warning: 42 | bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
warning: | ~~~~~~~~~~~~~~~~~~~^~~~~~~~
warning: wrapper/lld-c.cpp:65:46: error: invalid initialization of non-const reference of type ‘llvm::raw_ostream&’ from an rvalue of type ‘bool’
warning: 65 | result.success = lld::wasm::link(args, false, outputStream, errorStream);
warning: | ^~~~~
warning: /usr/include/lld/Common/Driver.h:52:65: note: in passing argument 2 of ‘bool lld::wasm::link(llvm::ArrayRef<const char*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool)’
warning: 52 | bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
warning: | ~~~~~~~~~~~~~~~~~~~^~~~~~~~
warning: wrapper/lld-c.cpp:71:29: error: ‘lld::mach_o’ has not been declared
warning: 71 | result.success = lld::mach_o::link(args, false, outputStream, errorStream);
warning: | ^~~~~~
warning: wrapper/lld-c.cpp:78:46: error: invalid initialization of non-const reference of type ‘llvm::raw_ostream&’ from an rvalue of type ‘bool’
warning: 78 | result.success = lld::coff::link(args, false, outputStream, errorStream);
warning: | ^~~~~
warning: /usr/include/lld/Common/Driver.h:32:65: note: in passing argument 2 of ‘bool lld::coff::link(llvm::ArrayRef<const char*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool)’
warning: 32 | bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
warning: | ~~~~~~~~~~~~~~~~~~~^~~~~~~~
error: failed to run custom build command for `lld_rs v130.0.0`
Caused by:
process didn't exit successfully: `/home/.../target/release/build/lld_rs-c2d9473ee64f3d31/build-script-build` (exit status: 1)
--- stdout
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
cargo:rerun-if-env-changed=CXX_x86_64-unknown-linux-gnu
CXX_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CXX_x86_64_unknown_linux_gnu
CXX_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CXX
HOST_CXX = None
cargo:rerun-if-env-changed=CXX
CXX = None
cargo:rerun-if-env-changed=CXXFLAGS_x86_64-unknown-linux-gnu
CXXFLAGS_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CXXFLAGS_x86_64_unknown_linux_gnu
CXXFLAGS_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CXXFLAGS
HOST_CXXFLAGS = None
cargo:rerun-if-env-changed=CXXFLAGS
CXXFLAGS = Some("-I/usr/include -std=c++14 -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS ")
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I/usr/include" "-std=c++14" "-fno-exceptions" "-D_GNU_SOURCE" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-o" "/home/.../target/release/build/lld_rs-8a2d78b5e8aee8ff/out/wrapper/lld-c.o" "-c" "wrapper/lld-c.cpp"
cargo:warning=wrapper/lld-c.cpp: In function ‘LldInvokeResult mun_lld_link(LldFlavor, int, const char* const*)’:
cargo:warning=wrapper/lld-c.cpp:59:45: error: invalid initialization of non-const reference of type ‘llvm::raw_ostream&’ from an rvalue of type ‘bool’
cargo:warning= 59 | result.success = lld::elf::link(args, false, outputStream, errorStream);
cargo:warning= | ^~~~~
cargo:warning=In file included from wrapper/lld-c.cpp:2:
cargo:warning=/usr/include/lld/Common/Driver.h:42:65: note: in passing argument 2 of ‘bool lld::elf::link(llvm::ArrayRef<const char*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool)’
cargo:warning= 42 | bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
cargo:warning= | ~~~~~~~~~~~~~~~~~~~^~~~~~~~
cargo:warning=wrapper/lld-c.cpp:65:46: error: invalid initialization of non-const reference of type ‘llvm::raw_ostream&’ from an rvalue of type ‘bool’
cargo:warning= 65 | result.success = lld::wasm::link(args, false, outputStream, errorStream);
cargo:warning= | ^~~~~
cargo:warning=/usr/include/lld/Common/Driver.h:52:65: note: in passing argument 2 of ‘bool lld::wasm::link(llvm::ArrayRef<const char*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool)’
cargo:warning= 52 | bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
cargo:warning= | ~~~~~~~~~~~~~~~~~~~^~~~~~~~
cargo:warning=wrapper/lld-c.cpp:71:29: error: ‘lld::mach_o’ has not been declared
cargo:warning= 71 | result.success = lld::mach_o::link(args, false, outputStream, errorStream);
cargo:warning= | ^~~~~~
cargo:warning=wrapper/lld-c.cpp:78:46: error: invalid initialization of non-const reference of type ‘llvm::raw_ostream&’ from an rvalue of type ‘bool’
cargo:warning= 78 | result.success = lld::coff::link(args, false, outputStream, errorStream);
cargo:warning= | ^~~~~
cargo:warning=/usr/include/lld/Common/Driver.h:32:65: note: in passing argument 2 of ‘bool lld::coff::link(llvm::ArrayRef<const char*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool)’
cargo:warning= 32 | bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
cargo:warning= | ~~~~~~~~~~~~~~~~~~~^~~~~~~~
exit status: 1
--- stderr
error occurred: Command "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I/usr/include" "-std=c++14" "-fno-exceptions" "-D_GNU_SOURCE" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-o" "/home/.../target/release/build/lld_rs-8a2d78b5e8aee8ff/out/wrapper/lld-c.o" "-c" "wrapper/lld-c.cpp" with args "c++" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
any plans to support llvm 16?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.