Bug 57742 - [LLVM] Build broken -> Option already exists!
Summary: [LLVM] Build broken -> Option already exists!
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2017-06-24 14:07 UTC by pr0vieh
Modified: 2017-11-06 18:11 UTC (History)
6 users (show)

See Also:
Tags:
Is this bug a regression?: Yes
Last known good build: https://jenkins.mono-project.com/job/test-mono-mainline-aot+llvm/34/


Attachments

Description pr0vieh 2017-06-24 14:07:00 UTC
./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.
/proc/self/maps:
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
https://jenkins.mono-project.com/job/test-mono-mainline-aot+llvm/label=ubuntu-1404-amd64/200/parsed_console/log_content.html#ERROR1

greets Pr0vieH
Comment 1 Zoltan Varga 2017-06-24 20:10:03 UTC
You only need the --with-llvm= option.
Comment 2 pr0vieh 2017-06-24 21:49:40 UTC
./configure --with-llvm=$monoprefix

hit exactly the same issue :/

btw. i use the llvm master

greets Pr0vieH
Comment 3 pr0vieh 2017-06-24 23:57:11 UTC
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

greets Pr0vieH
Comment 4 Ludovic Henry 2017-07-07 14:30:57 UTC
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!"
Comment 5 Mark Laws 2017-07-19 05:07:26 UTC
I also have this issue if I try to link the LLVM libraries statically. The issue does not occur when using --enable-loadedllvm.
Comment 6 Zoltan Varga 2017-07-19 05:44:49 UTC
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.
Comment 7 Vladimir Kargov 2017-09-21 20:20:40 UTC
(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
> something.

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?
Comment 8 Vladimir Kargov 2017-11-04 07:58:08 UTC
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.
Comment 9 Ludovic Henry 2017-11-06 18:11:52 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.