How to build llvm for --target=freebsd

Greetings!

How to build llvm on linux such that I can get all required libraries when I specify “–target=x86_64-unknown-freebsd9.0” when running on Linux machine.

I built llvm + clang + compiler-rt using CMake on Linux machine and I could run sample program using “–target=x86_64-unknown-freebsd9.0”.

However when I use "-fprofile-instr-generate’ with “–target=x86_64-unknown-freebsd9.0” I am observing error saying – “lib/clang/3.7.0/lib/freebsd/libclang_rt.profile-x86_64.a: No such file or dir”.

Thanks,

hi via llvm-dev <llvm-dev@lists.llvm.org> writes:

Greetings!

How to build llvm on linux such that I can get all required libraries when
I specify "--target=x86_64-unknown-freebsd9.0" when running on Linux
machine.

I built llvm + clang + compiler-rt using CMake on Linux machine and I could
run sample program using "--target=x86_64-unknown-freebsd9.0".

However when I use "-fprofile-instr-generate' with
"--target=x86_64-unknown-freebsd9.0" I am observing error saying --
"lib/clang/3.7.0/lib/freebsd/libclang_rt.profile-x86_64.a: No such file or
dir".

It's likely that the profile runtime was only built for your host by the
cmake build. You'd need to cross compile a freebsd toolchain to make
fprofile-instr-generate work, but I think that building cross compiler
toolchains with cmake runs into problems currently. See also "[RFC]
Strategies for Bootstrapping Compiler-RT builtins":

  http://lists.llvm.org/pipermail/llvm-dev/2015-November/091916.html