./configure --with-llvm=$monoprefix --enable-llvm=yes
CSC [basic] System.ValueTuple.dll
CSC [basic] System.Text.Encoding.CodePages.dll
CSC [build-linux] mscorlib.dll
mono: /monomaster/llvm/include/llvm/Support/CommandLine.h:682: void llvm::cl::parser<DataType>::addLiteralOption(const char*, const DT&, const char*) [with DT = llvm::ScheduleDAGSDNodes* (*)(llvm::SelectionDAGISel*, llvm::CodeGenOpt::Level); DataType = llvm::ScheduleDAGSDNodes* (*)(llvm::SelectionDAGISel*, llvm::CodeGenOpt::Level)]: Assertion `findOption(Name) == Values.size() && "Option already exists!"' failed.
405c1000-405d1000 rwxp 00000000 00:00 0
558a0147a000-558a02a32000 r-xp 00000000 09:02 29506570 /monomaster/mono/mono/mini/mono-sgen
558a02c31000-558a02cdd000 r--p 015b7000 09:02 29506570 /monomaster/mono/mono/mini/mono-sgen
558a02cdd000-558a02ce5000 rw-p 01663000 09:02 29506570 /monomaster/mono/mono/mini/mono-sgen
i think this is the same problem @ jenkins
You only need the --with-llvm= option.
hit exactly the same issue :/
btw. i use the llvm master
I usually use that...
./configure --with-llvm=/mono --enable-llvm-runtime
this builds fine but my tool instantly crashes :/
see this https://bugzilla.xamarin.com/show_bug.cgi?id=56316
I confirm this also happens on our CI: https://jenkins.mono-project.com/job/test-mono-mainline-aot+llvm/label=ubuntu-1404-amd64/213/parsed_console/log_content.html#ERROR1
The error on CI is slightly different but I think related: "CommandLine Error: Option 'x86-use-base-pointer' registered more than once!"
I also have this issue if I try to link the LLVM libraries statically. The issue does not occur when using --enable-loadedllvm.
This probably happens because we have a statically linked runtime, and we load the profiler library which is dynamically linked against libmonosgen.so, so we end up with two copies of the llvm code in memory or something.
(In reply Zoltan Varga from comment #6)
> This probably happens because we have a statically linked runtime, and we
> load the profiler library which is dynamically linked against
> libmonosgen.so, so we end up with two copies of the llvm code in memory or
I can confirm this is indeed the problem. If I don't link against libmono the LLVM build succeeds. (https://github.com/vkargov/mono/commit/901435bdc29e53ad2c4a1662e0af3f59676bb1ec)
Is there a reason why the profiler is linked against libmono? It works fine without it on Linux and OSX, so perhaps it's not needed at all?
The linking issue described has been fixed by https://github.com/mono/mono/pull/5726, so the LLVM build option should work on the master branch.
I'm not entirely certain the change covers all possible scenarios though.
The way the profiler is linked with the runtime has changed in https://github.com/mono/mono/commit/70abfb795a444e54259d07127436866489ae9221. Please reopen if you can still reproduce.