Instalacja msys2 msys64 mingw64 glade c gcc


Instalacja msys2 (msys64 mingw64) Glade C GCC

Zainstaluj msys2 ze strony msys2.org

Pobierz http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe

Zakładamy instalację w katalogu c:\msys64

Aktualizacja menadżera pakietów Pacman:

pacman -Syuu

# pokazuje: warning: terminate MSYS2 without returning to shell and check for updates again
warning: for example close your terminal window instead of calling exit
Close window and run above command again.

pacman -Q # pokazuje wszystkie pakiety

Instalacja -> wszystko na raz:

pacman --sync --needed base-devel mingw-w64-{i686,x86_64}-toolchain git mingw-w64-x86_64-gtk3 mingw-w64-x86_64-devhelp mingw-w64-x86_64-glade mingw-w64-x86_64-gedit mc

Instalacja -> install mingw-w64, QT Creator, and gdb. To do that run command:

pacman -S mingw-w64-i686-qt mingw-w64-i686-qt-creator mingw-w64-x86_64-qt mingw-w64-x86_64-qt-creator mingw-w64-i686-gdb mingw-w64-x86_64-gdb

You will be asked which qt version to install, static or non-static.

pacman -S mingw-w64-x86_64-toolchain
pacman --sync --needed --noconfirm base-devel mingw-w64-{i686,x86_64}-toolchain git
pacman -S mingw-w64-x86_64-git
pacman -S mingw-w64-x86_64-gtk3
pacman -S mingw-w64-x86_64-devhelp
export PKG_CONFIG_PATH=/mingw64/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig
export PATH="/usr/local/bin:/usr/bin:/bin:/opt/bin:/mingw64/usr/local/bin:/mingw64/usr/bin:/mingw64/bin:/mingw64/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" 
pacman -S mingw-w64-x86_64-gedit glade mc
pacman -S mingw-w64-x86_64-glade
pacman -S mingw-w64-x86_64-mc

 

Ustawienie git, ustawnienie polaczenia do Githuba:

ssh-keygen -t rsa -b 4096 -C "info@system66.com" # generowanie klucza ssh ktory pozniej skopiuj do Githuba
ssh -T git@github.com # testowanie polaczenia do githuba przez ssh
git config --global user.name "System 66"
git config --global core.editor gedit # ustawienie domyslnego edytora
git config --global color.ui true

 

Ściąganie repo z Githuba (przyklad: projekt “balank_window” repo Githuba “system66”:
git pull <remote> <branchname>

mkdir blank_window
cd blank_window
git init
git add .
git remote add upstream git://github.com/system66/blank_window.git
git pull upstream master

# or different project:
git remote add upstream git://github.com/system66/busy4.me.git
git pull upstream master

 

Working on existing project on Github. Project name: “busy4.me” User: “system66”

1. Get project from Github:

git clone https://github.com/system66/busy4.me.git

# or… 

git clone git://github.com/system66/busy4.me.git

 

  1. Do some changes, add file, add folders…)
cd busy4.me
git add .
git status # check if something for commit
git commit -m “Comment”
git remote rm origin
git remote add origin git@github.com:system66/busy4.me

 

3. Send changes to Github:

git push -u origin master

 

Nowy projekt

Zrób nowy katalog z projektem, katalogi i pliki zrodlowe. Przykladowa struktura programu C z “glade”:
(projekt zrobiony w Debianie i przeniesiony do Windows)
—————————————–
..
makefile
|src
|–main.c
|glade
|– main_window.glade
—————————————–
W katalogu projektu:

git init
git add . # dodanie wszystich plikow projektu do repo
git push --set-upstream origin master # popchanie do Githuba
git push -u origin master
git remote add origin git@github.com:system66/blank_window

Kompilacja:

make

 

Podczas compilacji wywala ze brak bibliotek gtk+:

$ make
gcc -c -g -O0 -Wall -pthread -pipe src/main.c `pkg-config --cflags --libs gtk+-3.0` -o main.o
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
/bin/sh: gcc: command not found
make: *** [makefile:29: main.o] Error 127

Zobacz jakie jest ustawienie sciezek do katalogow:

export

Zmienilem PKG_CONFIG_PATH:

export PATH="/usr/local/bin:/usr/bin:/bin:/opt/bin:/mingw64/usr/local/bin:/mingw64/usr/bin:/mingw64/bin:/mingw64/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl"

Teraz kompiluje ale dalej inny błąd:

$ make
gcc -o busy4 main.o -pthread `pkg-config --cflags --libs gtk+-3.0` -export-dynamic
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols?

Jest skompilowany program .exe ale po uruchomieniu brak bibliotek
libgtk-3-0.dll
Libgoobject-2.0-0.dll
Inne ktore pewnie beda potrzebne pozniej:

libffi-6.dll libgdk-3-0.dll libglib-2.0-0.dll libgmodule-2.0-0.dll libgtk-3-0.dll libgobject-2.0-0.dll libgio-2.0-0.dll libatk-1.0-0.dll libcairo-gobject-2.dll libcairo-2.dll libepoxy-0.dll libpcre-1.dll libwinpthread-1.dll libgdk_pixbuf-2.0-0.dll libpango-1.0-0.dll

Aby pokazac podlegle biblioteki dll uzyj ‘ldd’ po Linuxem (‘otool’ pod OSX) 

Program pod Windows “Dependency Walker 2.2”

ldd busy4.exe

 

Nie zapamietuje zmian, dodalem to co ponizej do pliku .bash_profile

# Darius Mark
PKG_CONFIG_PATH="/mingw64/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig"
export PKG_CONFIG_PATH

PATH="/usr/local/bin:/usr/bin:/bin:/opt/bin:/mingw64/usr/local/bin:/mingw64/usr/bin:/mingw64/bin:/mingw64/opt/bin" 
PATH="$PATH:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/" 
PATH="$PATH:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" 
export PATH

# more tweaks
LS_COLORS=$LS_COLORS:'di=0;37:' ; export LS_COLORS
alias az=autozip   #a handy script i keep in /opt/bin
alias vi=vim
alias ls='ls -p'
alias ll='ls -l'
alias lt='ls -lptr|tail'
alias h=history
set -o vi
shopt -s checkwinsize

uname -a
cd $HOME

 

 

Refrences:

Opis instalacji QT z MSYS2 :

MinGW-w64, QTCreator and gdb installation with MSYS2. Compiler, debugger and IDE installation for programming in C and C++, 32 and 64-bit code. from C_Programming

https://gist.github.com/papesch/b401aa68d0a7c7c96095fa64a7c9f684
https://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/
https://stackoverflow.com/questions/43311621/c-correct-way-to-statically-dynamically-link-with-mingw-w64
https://www.codeproject.com/articles/84461/mingw-static-and-dynamic-libraries
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/win32.html