Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static binary with builtin lld and libclang #170

Open
prologic opened this issue Apr 2, 2020 · 10 comments
Open

static binary with builtin lld and libclang #170

prologic opened this issue Apr 2, 2020 · 10 comments

Comments

@prologic
Copy link
Contributor

prologic commented Apr 2, 2020

Can we compile tre as a statically linked binary without os.Exec'ing to clang and ld?

@Nv7-GitHub
Copy link

That would be super cool! However, how would it be done?

@prologic
Copy link
Contributor Author

Are there no llvm Go libraires that can do this?

@Nv7-GitHub
Copy link

There seem to be a few, so I'm going to try to compile them, so far it isn't working, so I've opened some Issues

@Nv7-GitHub
Copy link

This seems to be the only actively maintained one, so I made an issue here: tinygo-org/go-llvm#22

Some other ones I found are:

@prologic
Copy link
Contributor Author

Nice!

@Nv7-GitHub
Copy link

I was able to get it to work with https://github.com/Nv7-GitHub/go-llvm and brew install llvm@9

The binary size is 57MB....

@prologic
Copy link
Contributor Author

That's really nice! I love it! Is it also statically linked?

@Nv7-GitHub
Copy link

Kind of...
Here is what it is linked to:

        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
        /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
        /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
        /usr/local/opt/libffi/lib/libffi.7.dylib (compatibility version 9.0.0, current version 9.0.0)
        /usr/local/opt/llvm@9/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)

So it isn't linked to libLLVM, but it requires LLVM's libc++ and libffi

@prologic
Copy link
Contributor Author

I see

@Nv7-GitHub
Copy link

I don't think it can build static binaries though, just create LLVM IR/bitcode and JIT compile and run it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants