Skip to content

Instantly share code, notes, and snippets.

View DavidEGrayson's full-sized avatar

David Grayson DavidEGrayson

View GitHub Profile
@DavidEGrayson
DavidEGrayson / msys2_env.bat
Last active December 10, 2021 09:20
My new favorite way to launch MSYS2
@echo off
cd %~dp0
set MSYSTEM=%~1
set _TERM=%~2
set _SH=%~3
set _ARGS=%~4
REM If MSYSTEM is empty, uses MSYS.
@DavidEGrayson
DavidEGrayson / gcc-11-arm-darwin.patch
Created June 11, 2021 21:57
GCC 11 patch for ARM darwin
diff -ur gcc-11.1.0/gcc/config/host-darwin.c gcc-11.1.0-fixed/gcc/config/host-darwin.c
--- gcc-11.1.0/gcc/config/host-darwin.c 2021-04-27 03:00:13.000000000 -0700
+++ gcc-11.1.0-fixed/gcc/config/host-darwin.c 2021-06-11 14:49:13.754000000 -0700
@@ -22,6 +22,10 @@
#include "coretypes.h"
#include "diagnostic-core.h"
#include "config/host-darwin.h"
+#include "hosthooks.h"
+#include "hosthooks-def.h"
+
diff --git a/code/15_hello_triangle.cpp b/code/15_hello_triangle.cpp
index 532520e..31f2bd7 100644
--- a/code/15_hello_triangle.cpp
+++ b/code/15_hello_triangle.cpp
@@ -642,12 +642,15 @@ private:
void drawFrame() {
vkWaitForFences(device, 1, &inFlightFences[currentFrame], VK_TRUE, UINT64_MAX);
+ VkFence waited = inFlightFences[currentFrame];
@DavidEGrayson
DavidEGrayson / bad.c
Created February 26, 2021 03:41
Test code for Vulkan loader issues in MSYS2
// Compile with: gcc -g bad.c -lvulkan -lgdi32 -lglfw3
#define VK_USE_PLATFORM_WIN32_KHR
#include <vulkan/vulkan.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
#include <string.h>
#include <stdlib.h>
@DavidEGrayson
DavidEGrayson / msys2_ruby_proposal.md
Last active October 27, 2020 18:40
I am planning to post this to the RubyInstaller Google group at some point. Feedback is welcome! Help me make a convincing argument for MSYS2, while not stepping on the toes of the RubyInstaller team.

Hello.

I am wondering whether it would be possible to implement all the good things provided by the RubyInstaller project as packages for MSYS2. I am not an expert on RubyInstaller or MSYS2, but I think I understand the basic ideas, and there seems to be a lot of overlap in what the two projects provide. I think there could be very big advantages to using MSYS2 as the standard environment for running Ruby on Windows, mainly because of the package manager and the ease of compiling and installing libraries.

MSYS2 is a newer, more up-to-date alternative to MSYS. MSYS2 provides a Linux-like environment on Windows. You get bash, gcc, autotools, libtool, pkg-config, git, and a wide variety of other popular libraries and utilities. You get a package manager (pacman) to help you install these tools and keep them updated. Here is some more introductory information about MSYS2:

http://stackoverflow.com/a/25023611/28128 https://sourceforge.net/p/msys2/wiki/MSYS2%20introduction/

MSYS2 actually provides three di

Building a mingw-w64 GCC cross-compiler with nixcrpkgs: instructions for Terry, October 2018

  1. Install Nix, the functional package manager. You'll need Linux (but macOS might work too).
  2. Make sure you have at least 4 GB of free space available for /tmp and a few GB of free space available for /nix.
  3. To get my recipes, run: git clone https://github.com/DavidEGrayson/nixcrpkgs && cd nixcrpkgs && git checkout 4f7b11d That commit is the current tip of the dev/david/2019 branch.
  4. To build a i686-w64-mingw32 C/C++ cross-compiling toolchain and a hello world program, run: nix-build -A win32.hello
  5. To build Qt and its examples, run: nix-build -A win32.qt.examples
  6. To just build the toolchain itself, run: nix-build -A win32.gcc
[root@alderaan gradual]# pacman -Sy archlinux-keyring
:: Synchronizing package databases...
core is up to date
extra is up to date
community is up to date
warning: archlinux-keyring-20180108-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
Packages (1) archlinux-keyring-20180108-1
@DavidEGrayson
DavidEGrayson / shell_session.txt
Last active December 23, 2017 04:47
AllowShortBlocksOnASingleLine is not working with clang-format 5.0.0 on Manjaro Linux
$ clang-format --version
clang-format version 5.0.0 (tags/RELEASE_500/final)
$ cat .clang-format
AllowShortBlocksOnASingleLine: true
$ cat test.cpp
int foo(int x)
{
if (x == 0) { return 1; }
@DavidEGrayson
DavidEGrayson / does_not_compile.txt
Last active November 12, 2017 17:44
This code does not compile using mingw-w64 gcc in MSYS2 (and probably not in any version of gcc)
$ cat somefile.h
struct a;
struct a *init();
void setd(struct a*p, int dd);
int getd(struct a*p);
void cleanup(struct a*p);
$ cat somefile.c
$ cat test.sh
#!/bin/sh
for a in 0; do
echo b=$(echo "c-d" | tr - _)
done
$ . test.sh
b=c_d