Coder Social home page Coder Social logo

Windows support about bloaty HOT 15 CLOSED

google avatar google commented on July 26, 2024 1
Windows support

from bloaty.

Comments (15)

haberman avatar haberman commented on July 26, 2024 5

I would love to have Windows support, both for building/running on Windows and for analyzing Windows executables.

I'd be happy to take patches to make Bloaty compile on Cygwin and/or MSVC, and any bugfixes for those platforms. I'd also be happy to take patches that enable automated Windows testing on AppVeyor.

I would be curious to know why Cygwin requires -gnu++11 instead of c++11.

from bloaty.

parbo avatar parbo commented on July 26, 2024 1

@andrew-donnell I solved it by building bloaty in Ubuntu in WSL instead.

from bloaty.

learn-more avatar learn-more commented on July 26, 2024

In that case the first step (imo) would be to add CMake support,
so that we do not have to use cygwin to build on windows.

(I am suggesting CMake because both dependencies support that).

After that:

  • Edit the CMake configuration so that it works for windows (msvc)
  • Make it build for windows (msvc)
  • Setup AppVeyor builds

bloaty needs gnu++11 because otherwise __bswap_32 (and 16, 64) are not defined.
re2 needs it for the RW locks.

from bloaty.

haberman avatar haberman commented on July 26, 2024

Sounds good. I don't know anything about CMake, but all of that sounds great and patches are welcome!

I think I would prefer to keep the existing Makefile also, so that CMake is not a hard dependency on Linux / OS X.

from bloaty.

learn-more avatar learn-more commented on July 26, 2024

After looking into it some more:

Creating a (working) cmake configuration for windows/msvc is fairly simple, but then some problems with some of the design choices present themselves:

  • Minimum version is visual studio 2015 (because of constexpr)
  • c++filt does not exist on windows, so that mechanism wont fly.
  • Without cygwin, the fork / pipe kinda functions are not going to work on windows.

For the demangling, maybe __cxa_demangle could be used? (and preferably as library, so that windows can use it as well!)

One minor issue:
msvc is choking on the construction from BuildActionBuf:
syntax error: identifier 'IndexSequence<,unsigned int, ?? >' src\dwarf.cc:1353

from bloaty.

haberman avatar haberman commented on July 26, 2024

Thanks for looking into it!

  • How many people have VS2015? It is unreasonable to require VS2015?
  • How many changes are required to support an earlier version of VS? I don't think there is anywhere that constexpr is integral to the design of Bloaty.
  • Yes definitely we'd need some other way of demangling on Windows. It looks like there is a UnDecorateSymbolName() function available.
  • Even on Linux it would be nice to link in the demangler instead of shelling out. I bet we could extract the demangling code from LLVM llvm/lib/Demangle/ItaniumDemangle.cpp to avoid shelling out to c++filt.
  • fork/pipe are only necessary if we're shelling out, but if we have native file readers on for both files and symbols, that shouldn't be a problem.

Hmm, it's hard to know what MVSC is complaining about in BuildActionBuf. I have a virtual machine with Windows installed but I'm having troubles using the community edition of MSVC.

from bloaty.

learn-more avatar learn-more commented on July 26, 2024
  • VS2015 is not unreasonable, however I do not have that at home.
  • VS2013 should be reasonable to support, constexpr should be removed and it looks like some vararg template constructions are not entirely supported.
  • UnDecorateSymbolName is an option on windows, however it will only demangle MSVC symbols.

I have cloned your repository, added the initial cmake + appveyor stuff in it, and gave you push access (so that you can test stuff).

from bloaty.

Phyllostachys avatar Phyllostachys commented on July 26, 2024

If it adds anything to this conversation, I was able to get everything to build in msys2 + mingw-w64, besides needing to define WEXITED. I need to do some more to see if it actually works and I'm not really sure why I was expecting it to run on PE files (duh, on my part). It does work pretty nicely on my ARM elf files though.

from bloaty.

learn-more avatar learn-more commented on July 26, 2024

This might be a better first step then!

Initially I tried with cygwin because I did not know that msys2 has support for popen and that kinda stuff,
but the cygwin builds crashed when testing it.
That is why I moved on to trying msvc.

@Phyllostachys : Are the cmake files in https://github.com/learn-more/bloaty needed at all to get this working? (I assume not)

from bloaty.

Phyllostachys avatar Phyllostachys commented on July 26, 2024

Correct, I didn't use any cmake files, just the makefile that comes with the repo. I think I found this issue after that fact or else I would have tried those too.

from bloaty.

skochinsky avatar skochinsky commented on July 26, 2024

In case someone needs a bloaty-like tool for MSVC-compiled binary right now, I can recommend SymbolSort. It works on .obj files (via dumpbin) or compiled binaries with PDB symbols.

from bloaty.

parbo avatar parbo commented on July 26, 2024

I'd like to be able to use bloaty to analyze android elf binaries on Windows. I'm getting these errors: Command line error D8004: '/W' requires an argument

from bloaty.

andrew-donnell avatar andrew-donnell commented on July 26, 2024

Any tips on building on Windows? I used cygwin to clone, but I'm running into issues building in MSVS. I keep getting:
Error D8004: '/W' requires an argument or
Error D8021: 'invalid numeric argument '/Wno-sign-compare'.

from bloaty.

andrew-donnell avatar andrew-donnell commented on July 26, 2024

I'd like to be able to use bloaty to analyze android elf binaries on Windows. I'm getting these errors: Command line error D8004: '/W' requires an argument

@parbo I had the same issue. I was able to resolve in VS by going into properties and adding an argument (could also be done by modifying the cmake .txt file) but then I ran into the Error D8021: 'invalid numeric argument '/Wno-sign-compare' issue. When I took that out, all hell broke loose 😝

from bloaty.

learn-more avatar learn-more commented on July 26, 2024

@haberman this is solved now

from bloaty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.