go-qml / qml

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

Cross compiling from ubuntu to windows, go-qml.a linking fails. #133

Closed Splizard closed 9 years ago

Splizard commented 9 years ago

Trying to cross compile a go-qml app from Ubuntu to Windows

/tmp/go-build056472970/gopkg.in/qml.v1.a(_all.o): malformed pe file: __ZN9QtPrivate15ConnectionTypesINS_4ListIJbEEELb1EE5typesEv: invalid symbol binding 105
gopkg.in/qml%2ev1(/326094): undefined: _ZTS22QDynamicMetaObjectData
gopkg.in/qml%2ev1(/326630): undefined: _ZTS7QObject
...... (more undefined references)

Building and linking appears to works fine otherwise:

GOOS=windows \
GOARCH=386 \
CGO_ENABLED=1 \
CC=i686-w64-mingw32-gcc \
CXX=i686-w64-mingw32-g++ \
CPATH="/usr/i686-w64-mingw32" \
go build -v gopkg.in/qml.v1

I'm using the binaries as suggested in the Readme (http://download.qt-project.org/official_releases/qt/5.1/5.1.1/qt-windows-opensource-5.1.1-mingw48_opengl-x86-offline.exe)

Splizard commented 9 years ago

Strange seems to have compiled by using the i586 include directory.

GOPATH=~/Go \
    GOOS=windows \
    GOARCH=386 \
    CGO_ENABLED=1 \
    CC=i686-w64-mingw32-gcc \
    CXX=i686-w64-mingw32-g++ \
    CPATH="/usr/i586-mingw32msvc/incude" \
    go build