uxmal / reko

Reko is a binary decompiler.
https://uxmal.github.io/reko
GNU General Public License v2.0
2.16k stars 253 forks source link

Build fails without /p:TargetFrameworkVersion="v4.5" on Ubuntu 16.04 LTS #251

Closed Lukas-Dresel closed 8 years ago

Lukas-Dresel commented 8 years ago

I setup a new virtual machine running Ubuntu 16.04 LTS and installed mono-xbuild, mono-complete and mono-devel.

I attempt building from the src/ subdirectory by calling xbuild Reko-decompiler.sln

This gives me a whole slew of errors, which i can provide if necessary, but most notably the following ones:

CSC: error CS0518: The predefined type 'System.Object' is not defined or imported This continues with System.ValueType, System.Attribute and others

When building with /p:TargetFrameworkVersion="v4.5" the build completes.

Lukas-Dresel commented 8 years ago

This should at least be mentioned somewhere on the README, or am i doing something wrong?

uxmal commented 8 years ago

Thanks for reporting this; can you provide a full dump of the errors in a zipped up file, so I can analyze? My Ubuntu environment doesn't exhibit this error, so I'd like to understand what differs.

uxmal commented 8 years ago

I just pushed 2136ff2 that ensures that all csproj files are referring to .NET version 4.0. It might make a difference. I suggest you try rebuilding with that commit and see if it helps.

Lukas-Dresel commented 8 years ago

Unfortunately for some reason github doesn't like me uploading stuff, i don't know why.

Instead the output of my build can be found here: http://pastebin.com/Wp5EgFFu

I'll check if it builds now.

Lukas-Dresel commented 8 years ago

The same problem occurs, but less often. New output here: http://pastebin.com/956VB6Lp This might however be a result of already compiled stuff, haven't figured out how to make a clean from the commandline yet

uxmal commented 8 years ago

Appreciate your effort. It's National Day over here so I may not be able to analyze this until tonight.

uxmal commented 8 years ago

Have you considered updating your toolchain? The Travis-CI logs (https://travis-ci.org/uxmal/reko) report no errors when running with the following

XBuild Engine Version 12.0
Mono, Version 4.2.3.0

The errors you are seeing are extreme; obviously System.Object must exist in any CLR implementation. My first guess is that you have garbage from a previous build. To build clean, use xbuild /target:clean (yes, use slash, xbuild copies its behavior from msbuild)

Lukas-Dresel commented 8 years ago

Okay, so i just tested a clean and remake, the error still persists. I'm out of ideas what it could be by now...

I could try updating the toolchain, but would have to do so manually since sudo apt upgrade mono-devel mono-complete mono-xbuild reports all three as up to date. (specifically version 4.2.1.102+dfsg2-7ubuntu4)

Maybe i can switch to experimental ubuntu apt repos to fix this

Lukas-Dresel commented 8 years ago

But for now i'm out of ideas what else it could be, specifically because it works with forcing the target .net framework to version 4.5 from the commandline.

uxmal commented 8 years ago

It's odd because there are no longer -- to my knowledge -- any dependencies on fwk 4.5 in the codebase. However, it could be that the affected projects (I'm thinking Decompiler.csproj) has some other settings in it that is causing xbuild / mono to lose it.

Unfortunately, I'm unable to reproduce this on my own Ubuntu VM, nor during the Travis CI builds. I'm going to look at Decompiler.csproj and see if there is anything that might be the cause.

Lukas-Dresel commented 8 years ago

What toolchain version are u using in your VM? Installed from package manager or built or pre-built?

uxmal commented 8 years ago

It's been such a long time since I built the VMm but I definitlely grabbed the mono pieces from go-mono, not the default Ubuntu repo. I'm a Linux n00b so I didn't try building myself. (let's move onto https://gitter.im/uxmal/reko if you're able, to avoid spamming)

uxmal commented 8 years ago

I'm resolving this as "workaround exists", namely the one you mentioned in the title of this issue. Adding the following link, describing why there are missing CLR assemblies on RedHat: https://bugzilla.redhat.com/show_bug.cgi?id=1255204 and where to grab missing CLR assemblies: git://github.com/mono/reference-assemblies.git