windows에서 org-babel 때문에 gcc가 필요하다면 Git For Windows SDK

1 minute read

nil

This build-extra repository is a core part of the Git for Windows SDK, the build environment for Git for Windows. Any issues should be reported using the project’s main Git fork.

git-for-windows/build-extra - github.com

babel. org-mode에서 코드 블록을 실행하면 결과가 자동으로 첨부되는 신세계. C++도 물론 지원한다. 다만 windows에서 사용하려면 좀 번거롭다. emacs는 항상 이렇다. windows에서는 한방에 안 돼.

C++ 코드 블록을 실행하려면 gcc가 필요하다. 현재 git bash를 emacs shell로 사용 중이다. 여기에는 gcc가 없어서 따로 설치해야 한다. cygwin 같은 걸 깔아야 하는 걸까?

Git for Windows SDK라는 게 있다. Git for Windows 개발 환경. 그래 이거면 다 된다. MSYS2와 MinGW를 잘 버무려 필요한 툴은 다 있다. gcc는 물론이고 패키지 매니저인 pacman까정. Git for Windows까지 포함하고 있어서 이거 하나만 깔면 된다.

(when windows?
  (let* ((combine-path (lambda (dir dir-or-file)
                         (concat (file-name-as-directory dir) dir-or-file)))
         (base-dir "C:/git-sdk-64")
         (msys2-bin-dir (funcall combine-path base-dir "usr/bin"))
         (mingw64-bin-dir (funcall combine-path base-dir "mingw64/bin"))
         (bash-path (funcall combine-path msys2-bin-dir "bash.exe")))
    (add-to-list 'exec-path msys2-bin-dir)
    (add-to-list 'exec-path mingw64-bin-dir)
    (setq explicit-shell-file-name bash-path)
    (setq shell-file-name bash-path)
    (setenv "SHELL" bash-path)
    (setq explicit-bash.exe-args '("--noediting" "--login" "-i"))
    (setenv "PATH" (concat mingw64-bin-dir path-separator
                           (concat msys2-bin-dir path-separator
                                   (getenv "PATH"))))))

이렇게 사용 중.

if [[ "$MSYSTEM" == "MSYS" ]]; then
    export PATH=/c/Users/ohyecloudy/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:$ORIGINAL_PATH
fi

bashrc에 mingw64가 우선권을 가지게 새로 배치

Update <2017-04-16 Sun> mingw64-bin-dir을 우선 탐색하도록. bashrc 추가

C-x C-s C-x C-c