MinGW-w64 offline installer
1. Install MSYS2
- Download the installer for MSYS2 from its official website.
- Run the installer and follow the on-screen instructions to install MSYS2 (usually in
C:/msys64
).
2.1 Download Individual Packages
If you’re preparing an offline repository: 1. On a system with internet access, use the pacman
command to generate download links for all required packages: bash pacman -Sp --needed base base-devel mingw-w64-x86_64-toolchain > package_list.txt
- This creates a file package_list.txt
with URLs for all the required packages. 2. Download all the packages from the generated list and copy them to your offline_packages
folder.
2.2 Copy Offline Packages
- Insert the flash drive containing the
offline_packages
folder. - Copy the folder to a path accessible by MSYS2. For example:
C:/msys64/home/BinhNN2/offline_packages
- Ensure the path structure is correct and matches the instructions.
4. Recreate the Database Archive
Use the repo-add
command to generate a valid offline.db
: bash repo-add offline.db.tar.gz *.pkg.tar.*
- Explanation: - repo-add
: This command generates or updates a repository database file. - offline.db.tar.gz
: This ensures the correct extension is used for the database archive. - *.pkg.tar.*
: Matches all package files in the directory.
After running this command, you should see output indicating that the database file has been created and updated.
5. Edit pacman.conf
Open the MSYS2 configuration file for pacman using a text editor:
C:/msys64/etc/pacman.conf
Locate and comment out the following repositories by adding a
#
at the beginning of their lines:# [mingw32] # Include = /etc/pacman.d/mirrorlist.mingw32 # [mingw64] # Include = /etc/pacman.d/mirrorlist.mingw64 # [msys] # Include = /etc/pacman.d/mirrorlist.msys
Add a new repository definition for the offline packages at the bottom:
[offline] SigLevel = Optional Server = file:///home/BinhNN2/offline_packages
Save and close the file.
6. Synchronize Pacman Database
- Open an MSYS2 terminal (
msys2.exe
) and run:bash pacman -Syu
- This synchronizes the package manager with your offline repository.
7. Install Required Packages
- Install the required development tools and toolchain packages:
bash pacman -S --needed base base-devel mingw-w64-x86_64-toolchain
- Ensure the installation completes successfully.
8. Validation
- Test the installation by running a simple command, such as checking the GCC version:
bash gcc --version
- If the version is displayed, the setup is complete.
. Download Individual Packages
If you’re preparing an offline repository: 1. On a system with internet access, use the pacman
command to generate download links for all required packages: bash pacman -Sp --needed base base-devel mingw-w64-x86_64-toolchain > package_list.txt
- This creates a file package_list.txt
with URLs for all the required packages. 2. Download all the packages from the generated list and copy them to your offline_packages
folder.