用mingw編譯tcc原始碼
0.在https://sourceforge.net/projects/mingw-w64/下載最新的mingw壓縮包,解壓到D:\目錄。我選擇的是win32版本。解壓後的目錄是D:\mingw32。
1.設定環境變數
set path=%path%;D:\mingw32\bin set include=%include%;D:\mingw32\include set lib=%lib%;D:\mingw32\lib
2.把下載的壓縮包檔案解壓縮。進入win32目錄。
D:\tcc-0.9.26\win32>dir D:\tcc-0.9.26\win32 的目錄 2016/10/12 08:37 . 2016/10/12 08:37 .. 2013/02/15 22:24 1,766 build-tcc.bat 2016/10/12 08:37 examples 2016/10/12 08:37 include 2016/10/12 08:37 lib 2013/02/15 22:24 4,505 tcc-win32.txt 2016/10/12 08:37 tools
3.執行批處理檔案
D:\tcc-0.9.26\win32>build-tcc D:\tcc-0.9.26\win32>echo #define TCC_VERSION "0.9.26" 1>..\config.h D:\tcc-0.9.26\win32>gcc -Os -s -fno-strict-aliasing -DTCC_TARGET_PE -DTCC_TARGET_I386 tools/tiny_impdef.c -o tiny_impdef.exe D:\tcc-0.9.26\win32>gcc -Os -s -fno-strict-aliasing -DTCC_TARGET_PE -DTCC_TARGET_I386 tools/tiny_libmaker.c -o tiny_libmaker.exe D:\tcc-0.9.26\win32>if not exist libtcc\nul mkdir libtcc D:\tcc-0.9.26\win32>copy ..\libtcc.h libtcc\libtcc.h 已複製 1 個檔案。 D:\tcc-0.9.26\win32>gcc -Os -s -fno-strict-aliasing -DTCC_TARGET_PE -DTCC_TARGET_I386 -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll - Wl,-out-implib,libtcc/libtcc.a D:\tcc-0.9.26\win32>tiny_impdef libtcc.dll -o libtcc/libtcc.def D:\tcc-0.9.26\win32>gcc -Os -s -fno-strict-aliasing -DTCC_TARGET_PE -DTCC_TARGET_I386 ../tcc.c -o tcc.exe -ltcc -Llibtcc ../tcc.c: In function 'execvp_win32': ../tcc.c:81:39: warning: passing argument 3 of 'spawnvp' from incompatible pointer type [-Wincompatible-pointer-types] int ret = spawnvp(P_NOWAIT, prog, (char const*const*)argv); ^ In file included from ../tcc.c:78:0: D:/mingw32/i686-w64-mingw32/include/process.h:191:20: note: expected 'char * const*' but argument is of type 'const char * const*' intptr_t __cdecl spawnvp(int,const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; ^~~~~~~ D:\tcc-0.9.26\win32>copy ..\include\*.h include ..\include\float.h ..\include\stdarg.h ..\include\stdbool.h ..\include\stddef.h ..\include\tcclib.h ..\include\varargs.h 已複製 6 個檔案。 D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c ../lib/libtcc1.c D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c lib/crt1.c D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c lib/wincrt1.c D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c lib/dllcrt1.c D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c lib/dllmain.c D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c lib/chkstk.S D:\tcc-0.9.26\win32>goto lib32 D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c ../lib/alloca86.S D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c ../lib/alloca86-bt.S D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c ../lib/bcheck.c ../lib/bcheck.c:46: warning: #warning Bound checking does not support malloc (etc.) in this environment. D:\tcc-0.9.26\win32>tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o D:\tcc-0.9.26\win32>del *.o D:\tcc-0.9.26\win32>dir *.exe D:\tcc-0.9.26\win32 的目錄 2016/10/12 09:01 17,920 tcc.exe 2016/10/12 09:00 15,872 tiny_impdef.exe 2016/10/12 09:00 15,360 tiny_libmaker.exe
4.執行tcc.exe
D:\tcc-0.9.26\win32>tcc tcc version 0.9.26 - Tiny C Compiler - Copyright (C) 2001-2006 Fabrice Bellard Usage: tcc [options...] [-o outfile] [-c] infile(s)... tcc [options...] -run infile [arguments...] General options: -c compile only - generate an object file -o outfile set output filename 。。。
5.最新的tcc原始碼在http://repo.or.cz/w/tinycc.git,在win32下多了個vc2015目錄,裡面有相應的sln和proj檔案。編譯應該就更方便了。
相關文章
- 用mingw編譯lua5.3原始碼編譯原始碼
- windows下用mingw編譯linux專案Windows編譯Linux
- windows 下使用 mingw編譯器 除錯時 無法跟進原始碼Windows編譯除錯原始碼
- TCC-Transaction 原始碼分析 —— TCC 實現原始碼
- VScode編譯opencv(Cmake + MinGW)VSCode編譯OpenCV
- MinGW環境編譯WonderTrader攻略編譯
- 在windows上用mingw w64編譯配置llvmWindows編譯LVM
- 原始碼編譯Vim 8原始碼編譯
- MongoDB(0)- 原始碼編譯MongoDB原始碼編譯
- 編譯Android原始碼編譯Android原始碼
- 編譯hibernate原始碼編譯原始碼
- Qt 中有兩種方式編譯MinGW和MSVCQT編譯
- mingw下編譯zlib quazip動態庫編譯
- CLion 配置 C C++ 編譯環境(MinGW)C++編譯
- tcc-transation原始碼分析與思考原始碼
- 編譯FFMPEG原始碼的指令碼編寫案例編譯原始碼指令碼
- WebRTC研究 (一) 編譯原始碼Web編譯原始碼
- 原始碼編譯 apache2.4原始碼編譯Apache
- Kubernetes原始碼編譯原始碼編譯
- Swift原始碼專案編譯Swift原始碼編譯
- 龍芯原始碼編譯MySQL原始碼編譯MySql
- Ceph原始碼編譯與打包原始碼編譯
- nvme driver 原始碼修改、編譯原始碼編譯
- 原始碼編譯安裝Redis原始碼編譯Redis
- LAMP原始碼編譯安裝LAMP原始碼編譯
- osg原始碼編譯步驟原始碼編譯
- Android原始碼編譯--整理Android原始碼編譯
- Android原始碼閱讀-編譯8.0原始碼Android原始碼編譯
- Matlab安裝MinGW-w64編譯器Matlab編譯
- Vue3原始碼分析——編譯模組和編譯器Vue原始碼編譯
- MySQL5.5原始碼編譯新增編譯備註資訊~MySql原始碼編譯
- 反編譯APK資原始檔與原始碼編譯APK原始碼
- Dubbo原始碼之動態編譯原始碼編譯
- MacOS X 編譯Android原始碼Mac編譯Android原始碼
- 原始碼編譯安裝的原理原始碼編譯
- openssl原始碼編譯及配置方法原始碼編譯
- Android FrameWork 之原始碼編譯AndroidFramework原始碼編譯
- 原始碼的下載與編譯原始碼編譯