go-qml / qml

QML support for the Go language
Other
1.96k stars 186 forks source link

LGPLv3 and Proprietary software #146

Closed mickgardner closed 9 years ago

mickgardner commented 9 years ago

Hi, Apologies if this is a stupid question: My understanding is that Golang does static linking. Given that go-qml is under LGPL license, does this mean that go-qml is incompatible with proprietary licensed software developed with go-qml?

ghost commented 9 years ago

I don't believe this is the case. cgo does not do static linking by default. You can see this if you pass one of the compiled examples to ldd:

$ go build -o basiclayouts basiclayouts.go
$ ldd basiclayouts
  linux-vdso.so.1 (0x00007fff9af2f000)
  libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f8e7f99f000)
  libQt5Widgets.so.5 => /usr/lib/libQt5Widgets.so.5 (0x00007f8e7f304000)
  libQt5Quick.so.5 => /usr/lib/libQt5Quick.so.5 (0x00007f8e7ef1e000)
  libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x00007f8e7e9db000)
  libQt5Qml.so.5 => /usr/lib/libQt5Qml.so.5 (0x00007f8e7e5b9000)
  libQt5Network.so.5 => /usr/lib/libQt5Network.so.5 (0x00007f8e7fd2e000)
  libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x00007f8e7e0eb000)
  libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f8e7dece000)
  libm.so.6 => /usr/lib/libm.so.6 (0x00007f8e7dbc9000)
  libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f8e7d9b3000)
  libc.so.6 => /usr/lib/libc.so.6 (0x00007f8e7d610000)
  /lib64/ld-linux-x86-64.so.2 (0x00007f8e7fcae000)
  libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f8e7d3bf000)
  libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f8e7d0b1000)
  libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f8e7cd6f000)
  libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f8e7cb39000)
  libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007f8e7c8e0000)
  libz.so.1 => /usr/lib/libz.so.1 (0x00007f8e7c6ca000)
  libGL.so.1 => /usr/lib/libGL.so.1 (0x00007f8e7c430000)
  libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007f8e7c1b7000)
  libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007f8e7bd3d000)
  libicui18n.so.54 => /usr/lib/libicui18n.so.54 (0x00007f8e7b8e6000)
  libicuuc.so.54 => /usr/lib/libicuuc.so.54 (0x00007f8e7b556000)
  libpcre16.so.0 => /usr/lib/libpcre16.so.0 (0x00007f8e7b2f1000)
  libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f8e7b0ed000)
  librt.so.1 => /usr/lib/librt.so.1 (0x00007f8e7aee5000)
  libsystemd.so.0 => /usr/lib/libsystemd.so.0 (0x00007f8e7fcff000)
  libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f8e7ac76000)
  libffi.so.6 => /usr/lib/libffi.so.6 (0x00007f8e7aa6d000)
  libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f8e7a84b000)
  libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f8e7a5a2000)
  libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007f8e7a384000)
  libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f8e7a15a000)
  libglapi.so.0 => /usr/lib/libglapi.so.0 (0x00007f8e79f30000)
  libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f8e79d1e000)
  libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x00007f8e79b1b000)
  libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00007f8e79915000)
  libX11-xcb.so.1 => /usr/lib/libX11-xcb.so.1 (0x00007f8e79713000)
  libxcb-glx.so.0 => /usr/lib/libxcb-glx.so.0 (0x00007f8e794f9000)
  libxcb-dri2.so.0 => /usr/lib/libxcb-dri2.so.0 (0x00007f8e792f4000)
  libxcb-dri3.so.0 => /usr/lib/libxcb-dri3.so.0 (0x00007f8e790f1000)
  libxcb-present.so.0 => /usr/lib/libxcb-present.so.0 (0x00007f8e78eee000)
  libxcb-randr.so.0 => /usr/lib/libxcb-randr.so.0 (0x00007f8e78ce0000)
  libxcb-xfixes.so.0 => /usr/lib/libxcb-xfixes.so.0 (0x00007f8e78ad8000)
  libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0x00007f8e788ce000)
  libxcb-shape.so.0 => /usr/lib/libxcb-shape.so.0 (0x00007f8e786ca000)
  libxcb-sync.so.1 => /usr/lib/libxcb-sync.so.1 (0x00007f8e784c3000)
  libxshmfence.so.1 => /usr/lib/libxshmfence.so.1 (0x00007f8e782c0000)
  libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x00007f8e780ba000)
  libdrm.so.2 => /usr/lib/libdrm.so.2 (0x00007f8e77ead000)
  libicudata.so.54 => /usr/lib/libicudata.so.54 (0x00007f8e76483000)
  libcap.so.2 => /usr/lib/libcap.so.2 (0x00007f8e7627f000)
  liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f8e76059000)
  liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007f8e75e4e000)
  libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007f8e75b6d000)
  libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007f8e7595b000)
  libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007f8e75744000)
  libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f8e75540000)
  libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f8e7533a000)
  libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007f8e7512a000)
  libattr.so.1 => /usr/lib/libattr.so.1 (0x00007f8e74f25000)
mickgardner commented 9 years ago

Thanks for clarifying that. I must have been thinking of this from the FAQ (http://golang.org/doc/faq):

"The linkers in the gc tool chain (5l, 6l, and 8l) do static linking. All Go binaries therefore include the Go run-time, along with the run-time type information necessary to support dynamic type checks, reflection, and even panic-time stack traces.

A simple C "hello, world" program compiled and linked statically using gcc on Linux is around 750 kB, including an implementation of printf. An equivalent Go program using fmt.Printf is around 1.9 MB, but that includes more powerful run-time support and type information. "

Doesn't this imply that if I develop an application with go-qml that the go-qml code will be included in the binary that I distribute, therefore breaking the "dynamic linking" requirement of the LGPL?

niemeyer commented 9 years ago

It does, and you are right to question that. For that reason, there is an explicit statement in the LICENSE file giving you permission to link it statically.

You can lincense your own code however you wish, as long as the provisions of the LGPL are respected for the go-qml code itself, even if linking statically.

Please see the LICENSE file content for full details.