Giter Site home page Giter Site logo

Error compiling using mingw about gotk4 HOT 6 OPEN

Tom5521 avatar Tom5521 commented on June 16, 2024
Error compiling using mingw

from gotk4.

Comments (6)

SnoutBug avatar SnoutBug commented on June 16, 2024

I was getting the same error, though I've had some success with

PKG_CONFIG_PATH=/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig
CGO_ENABLED=1
GOOS=windows
CC="x86_64-w64-mingw32-gcc"
go build -v -ldflags -H=windowsgui

taken from here but now I am getting the errors below:

main
# main
/usr/lib/golang/pkg/tool/linux_amd64/link: running x86_64-w64-mingw32-gcc failed: exit status 1
/usr/lib/gcc/x86_64-w64-mingw32/13.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -ladwaita-1: No such file or directory
/usr/lib/gcc/x86_64-w64-mingw32/13.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgirepository-1.0: No such file or directory
/usr/lib/gcc/x86_64-w64-mingw32/13.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgirepository-1.0: No such file or directory
/usr/lib/gcc/x86_64-w64-mingw32/13.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgirepository-1.0: No such file or directory
collect2: error: ld returned 1 exit status

from gotk4.

SnoutBug avatar SnoutBug commented on June 16, 2024

After going on a hunt to find the required packages I found the needed files here.
The mingw packages for libadwaita and and gobject-introspection do not seem to exist for Fedora.

After placing the package in the appropriate location I managed to compile my app.

As a small sidenote: bcryptprimitives.dll was missing when I tried to run the app with Wine. It appears, this dll is only included with Wine 9 and seems to be required see here.

from gotk4.

Tom5521 avatar Tom5521 commented on June 16, 2024

After going on a hunt to find the required packages I found the needed files here.

How did you install the corresponding packages?

I didn't have any problem with libadwaita after extracting the .tar.zst file in /usr/x86_64-w64-mingw32/

But with gobject-introspection it was not the case...

github.com/diamondburned/gotk4/pkg/core/gerror
# github.com/diamondburned/gotk4/pkg/core/gerror
# [pkg-config --cflags  -- glib-2.0 gobject-introspection-1.0]
Package gobject-introspection-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gobject-introspection-1.0', required by 'virtual:world', not found

So I decided to do this:

find /usr/x86_64-w64-mingw32/ -name "gobject-introspection-1.0.pc"
# /usr/x86_64-w64-mingw32/lib/pkgconfig/gobject-introspection-1.0.pc
ln /usr/x86_64-w64-mingw32/lib/pkgconfig/gobject-introspection-1.0.pc /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig

But I get this error

github.com/diamondburned/gotk4/pkg/core/gerror
# github.com/diamondburned/gotk4/pkg/core/gerror
# [pkg-config --cflags  -- glib-2.0 gobject-introspection-1.0]
Package dependency requirement 'glib-2.0 >= 2.78.0' could not be satisfied.
Package 'glib-2.0' has version '2.77.1', required version is '>= 2.78.0'
Package dependency requirement 'gobject-2.0 >= 2.78.0' could not be satisfied.
Package 'gobject-2.0' has version '2.77.1', required version is '>= 2.78.0'

But I fixed it by modifying the file /usr/x86_64-w64-mingw32/lib/pkgconfig/gobject-introspection-1.0.pc

Changing these lines from this: Requires: glib-2.0 >= 2.78.0, gobject-2.0 >= 2.78.0 to this Requires: glib-2.0 >= 2.77.1, gobject-2.0 >= 2.77.1

I just want to know how safe it is to do that, or if the program will even work?

Or if I downloaded a wrong package that's why I had to do all the extra processing?

I leave this to leave more or less documented the process of how to get to this... in theory you just have to download and extract these 3 packages in /usr/x86_64-w64-mingw32/

And install these packages through dnf

  • mingw64-gtk4
  • mingw64-gcc
  • zstd (To extract the packages)

Right now I already have a docker image to be able to automate it so... it would already be

from gotk4.

diamondburned avatar diamondburned commented on June 16, 2024

Why not use MSYS2?

from gotk4.

founderio avatar founderio commented on June 16, 2024

Why not use MSYS2?

MSYS2 compiles for Windows on Windows, mingw32 compiles for Windows on Linux. Running a separate machine/VM with windows, specially in a CI environment, is extra hassle which can be avoided by just cross-compiling.

from gotk4.

diamondburned avatar diamondburned commented on June 16, 2024

Oh, interesting. That's a use case that I've never considered, unfortunately.

from gotk4.

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.