Git Product home page Git Product logo

Comments (6)

curiouslarry avatar curiouslarry commented on August 16, 2024

How does one build rmapi-0.0.4 on linux using "go"? The only prebuilt release is version 0.0.2 and that does not work for me (it uploads the file as an empty directory)

from rmapi.

dgoerger avatar dgoerger commented on August 16, 2024

I'm on OpenBSD, but the command should work the same on Linux. I use the following to compile a statically-linked binary:

go get -u github.com/juruen/rmapi
go build -ldflags "-linkmode external -extldflags -static" -a github.com/juruen/rmapi

Static linking will result in a larger binary (16.5M vs ~9M on OpenBSD), but on Linux it means that a binary compiled on CentOS 64bit will also work on Ubuntu 64bit, despite those operating systems using different versions of glibc and other libraries. That makes it more portable.

If you don't need it statically-linked, this will yield a smaller binary:

go get -u github.com/juruen/rmapi
go build -a github.com/juruen/rmapi

I hope this helps! (while I'm here, thanks devs for this great project!)

from rmapi.

dgoerger avatar dgoerger commented on August 16, 2024

@curiouslarry I did some digging, and actually you probably don't want to statically link rmapi against Linux's glibc---glibc has lazy loading of network functions, and the resulting binary isn't actually static, which could result in undefined behaviour and messy nonsense. Hmm. I take back my recommendation if you're using Linux. Sorry for the confusion.

However I was able to compile a static amd64 binary using Linux's musl libc---musl libc is designed for static linking---and tested it against Linuxes as old as CentOS 6.10. If you trust a random person on the Internet to compile code without injecting malicious nonsense into the binary (I didn't, but you shouldn't trust my saying so), I've temporarily uploaded a compiled copy of 0.0.4 to my SDF webspace.

But for personal use, dynamic linking should be fine:

go get -u github.com/juruen/rmapi
go build -a github.com/juruen/rmapi

Procedure to compile a musl libc static binary:

$ # fetch source
$ go get -u github.com/juruen/rmapi
$ # link against musl libc instead of glibc
$ export CC=/usr/bin/musl-gcc
$ # compile
$ go build -ldflags "-linkmode external -extldflags -static" -a github.com/juruen/rmapi
$ # confirm the binary is statically-linked (i.e. no dynamic links)
$ readelf -d ./rmapi
There is no dynamic section in this file.

from rmapi.

curiouslarry avatar curiouslarry commented on August 16, 2024

Thanks for the help and was able to build. However, whenever I do a "put xx.pdf" it creates a directory rather than a single pdf file. When I do this from my mac osx, everything works fine. Any help would be appreciated.

from rmapi.

dgoerger avatar dgoerger commented on August 16, 2024

I'm unable to reproduce this on Linux. What distro and version of Go are you using?

$ uname -a && go version

Does it still happen with this version? That one works for me (compiled on CentOS 7, run from CentOS 6).

from rmapi.

juruen avatar juruen commented on August 16, 2024

Closing this as there's a new built package for Linux that has been just released.

from rmapi.

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.