Windows编译开源代码方法之关于lame.exe文件的测试及过程
Windows编译开源代码方法之关于lame.exe文件的测试及过程
- 最终结果(PS:使用markdown不熟悉,记得在井号后面加个空格才能触发)
- 起因:foobar2000在格式转换中需要lame.exe。然而我只能找到[源代码。人家是这么说的:](https://sourceforge.net/projects/lame/)
- 没办法了就这样吧。
- 想法:一:在Linux上试试编译可执行文件exe
- [这种办法叫做交叉编译, 要用到交叉编译器](https://weepingdogel.github.io/posts/%E5%B0%9D%E8%AF%95%E5%9C%A8linux%E4%B8%8B%E7%BC%96%E8%AF%91exe%E5%8F%AF%E6%89%A7%E8%A1%8C%E6%96%87%E4%BB%B6/)
- 想法二:使用项目管理工具(也可以是IDE)来编译运行。
- 类比Linux原理
- 想法三:使用Cygwin。(这个有好多类似的。就是模仿Linux不在赘述)
- 想法四:使用wsl,与Linux异曲同工。依旧需要交叉编译。
- 在INSTALL后面还有许多说明。Building the software on Windows with free compilers.比较类似。就不说了。
- 总结就是严格按照说明文档。理解Linux与Windows的不同。而且知道编译的共通之处。
- 我还想知道例如python代码编译为可执行文件。这个好像要使用pyinstaller,[有篇文章有说明。](https://zhuanlan.zhihu.com/p/162237978)
- one more thing
最终结果(PS:使用markdown不熟悉,记得在井号后面加个空格才能触发)
PS C:\Users\zjc20\source> cd .\lame-3.100\
PS C:\Users\zjc20\source\lame-3.100> nmake.exe .\Makefile.MSVCMicrosoft (R) Program Maintenance Utility Version 14.34.31937.0
Copyright (C) Microsoft Corporation. All rights reserved.----------------------------------------------------------------------
building LAME featuring RH
+ ASM
+ MMX
using MS COMPILER
+ optimizing for Pentium II/III
+ using Single precision
----------------------------------------------------------------------
Pass GTK=YES to build the frame analyzer. (requires installed GTK)libmp3lame\i386\cpu_feat.nas
'nasmw' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'nasmw' : return code '0x1'
Stop.
PS C:\Users\zjc20\source\lame-3.100> copy .\configMS.h config.h
PS C:\Users\zjc20\source\lame-3.100> nmake -f .\Makefile.MSVC comp=msvc asm=noMicrosoft (R) Program Maintenance Utility Version 14.34.31937.0
Copyright (C) Microsoft Corporation. All rights reserved.----------------------------------------------------------------------
building LAME featuring RH
using MS COMPILER
+ optimizing for Pentium II/III
+ using Single precision
----------------------------------------------------------------------
Pass GTK=YES to build the frame analyzer. (requires installed GTK)
Pass ASM=YES to build the assembler optimizationsbitstream.c
encoder.c
fft.c
gain_analysis.c
id3tag.c
lame.c
newmdct.c
psymodel.c
quantize.c
quantize_pvt.c
xmm_quantize_sub.c
set_get.c
vbrquantize.c
reservoir.c
tables.c
takehiro.c
util.c
mpglib_interface.c
VbrTag.c
presets.c
version.c--- LAME MP3 ENCODING LIBRARY UPTODATE ---common.c
dct64_i386.c
decode_i386.c
layer1.c
layer2.c
layer3.c
tabinit.c
interface.c--- HIP DECODING LIBRARY UPTODATE -----=* .\output\libmp3lame-static.lib ready *=--main.c
get_audio.c
parse.c
timestatus.c
lametime.c
console.c
brhist.c--- COMMON FRONTEND STUFF UPTODATE ---lame_main.c
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.--=* .\output\lame.exe ready *=----=* lame.exe uptodate *=--PS C:\Users\zjc20\source\lame-3.100>
可以看到成功编译了源代码为exe也就是可执行文件
在这个例子中,lame的源文件中的INSTALL文件中的说明很全。所以配置好环境之后就可以编译了。主要是学到了不少东西。
之前我一直是在Linux上操作的,Linux对源码的支持度比较好,我也查了原因后面我会放链接。而到了window系统之后就比较的头疼。
原因有:
一是:我在window上使用的比较多的是解释型语言:python,而且语言比较单一所以只要配置好python环境就好。可是像实现比较大的项目的源码使用,如果单独使用python的就直接照着readme的使用方法干就好了。有融合的,只要环境配置的对也还是没多大的问题,因为一般都是只需要在Linux上干就行了,但是到了这种要输出为一个Windows可执行文件的我还没尝试过,之前搞C++和C时使用的还是devC++这种直接编写然后来个编译并运行就行了。
二是对window的系统并不了解。Windows系统比较复杂,对我这样的小白是这样的。所以在Linux中编写,编译,运行都比较简单。像make,cofigure,就比较简单。现在看看Linux与window的区别:
与Linux系列操作系统不同,Windows原生环境不提供类似gcc,Clang的C/C++语言源程序编译运行工具链。运行在Windows上的IDE(集成开发环境),比如CodeBlocks之类,一般都使用MinGW(Minimalist GNU for Windows)配置模拟Linux下的开发环境来进行Windows下的开发。
但是在Windows下,与开发环境以及code编辑器协同更好的还是MSVC(Microsoft Visual C/C++)编译器。对于灵活程度更高的code编辑器,我们可以将Microsoft的Visual C/C++编译器下载并集成到code中。
其三:我习惯性使用VScode,而VScode只是一个类似于记事本一样的东西,并没有什么实际功能,所以只能不断地配置。也就是说我更习惯在命令行去干活。“月才越爱玩”,像gcc,一些比较简单的编译还是会的,一旦到了makefile,或是,点sh文件就没有试过了,虽然对这些文件的理解是:他们就像脚本和命令行一样,是自动化的一种形式。但是实在是搞不明白,总感觉这种跟计算机底层的相关性很强。而且这个项目的config和makefile东西是真的多:要不是看INSTALL文件,真的不知道什么意思。
C:.
│ acinclude.m4
│ aclocal.m4
│ API
│ ChangeLog
│ compile
│ config.guess
│ config.h.in
│ config.log
│ config.rpath
│ config.sub
│ configMS.h
│ configure
│ configure.in
│ COPYING
│ DEFINES
│ depcomp
│ HACKING
│ INSTALL
│ install-sh
│ INSTALL.configure
│ lame.bat
│ lame.spec
│ lame.spec.in
│ LICENSE
│ ltmain.sh
│ Makefile.am
│ Makefile.am.global
│ Makefile.in
│ Makefile.MSVC
│ Makefile.unix
│ missing
│ README
│ README.WINGTK
│ STYLEGUIDE
│ testcase.mp3
│ testcase.wav
│ TODO
│ USAGE
│
├───.vs
│ │ slnx.sqlite
│ │ VSWorkspaceState.json
│ │
│ └───lame-3.100
│ ├───FileContentIndex
│ │ │ b4658905-267a-40dc-a6ab-7ec6f8b836c3.vsidx
│ │ │ read.lock
│ │ │
│ │ └───merges
│ └───v17
├───ACM
│ │ ACM.cpp
│ │ ACM.h
│ │ acm.rc
│ │ ACMStream.cpp
│ │ ACMStream.h
│ │ adebug.h
│ │ AEncodeProperties.cpp
│ │ AEncodeProperties.h
│ │ DecodeStream.cpp
│ │ DecodeStream.h
│ │ lame.ico
│ │ lameACM.def
│ │ LameACM.inf
│ │ lame_acm.xml
│ │ main.cpp
│ │ Makefile.am
│ │ Makefile.in
│ │ readme.txt
│ │ resource.h
│ │ TODO
│ │
│ ├───ADbg
│ │ ADbg.cpp
│ │ ADbg.h
│ │ Makefile.am
│ │ Makefile.in
│ │
│ ├───ddk
│ │ Makefile.am
│ │ Makefile.in
│ │ msacmdrv.h
│ │
│ └───tinyxml
│ changes.txt
│ dox
│ makedistlinux
│ makedistwin.bat
│ Makefile.am
│ Makefile.in
│ Makefile.tinyxml
│ readme.txt
│ tinyxml.cpp
│ tinyxml.h
│ tinyxmlerror.cpp
│ tinyxmlparser.cpp
│ xmltest.cpp
│
├───debian
│ │ .cvsignore
│ │ changelog
│ │ compat
│ │ control
│ │ copyright
│ │ lame.doc-base
│ │ lame.docs
│ │ lame.install
│ │ lame.manpages
│ │ libmp3lame-dev.install
│ │ libmp3lame0.install
│ │ Makefile.am
│ │ Makefile.in
│ │ rules
│ │ watch
│ │
│ ├───CVS
│ │ Entries
│ │ Repository
│ │ Root
│ │
│ └───source
│ │ format
│ │
│ └───CVS
│ Entries
│ Repository
│ Root
│
├───Dll
│ BladeMP3EncDLL.c
│ BladeMP3EncDLL.def
│ BladeMP3EncDLL.h
│ Example.cpp
│ LameDLLInterface.htm
│ Makefile.am
│ Makefile.in
│ Makefile.mingw32
│ MP3export.pas
│ README
│
├───doc
│ │ Makefile.am
│ │ Makefile.in
│ │
│ ├───html
│ │ about.html
│ │ abr.html
│ │ cbr.html
│ │ contact.html
│ │ contributors.html
│ │ detailed.html
│ │ history.html
│ │ index.html
│ │ introduction.html
│ │ links.html
│ │ list.html
│ │ Makefile.am
│ │ Makefile.in
│ │ ms_stereo.html
│ │ usage.html
│ │ vbr.html
│ │
│ └───man
│ lame.1
│ Makefile.am
│ Makefile.in
│
├───dshow
│ aboutprp.cpp
│ aboutprp.h
│ elogo.ico
│ Encoder.cpp
│ Encoder.h
│ iaudioprops.h
│ Makefile.am
│ Makefile.in
│ Mpegac.cpp
│ Mpegac.def
│ Mpegac.h
│ Property.rc
│ PropPage.cpp
│ PropPage.h
│ PropPage_adv.cpp
│ PropPage_adv.h
│ README
│ REG.CPP
│ REG.H
│ resource.h
│ UIDS.H
│
├───frontend
│ amiga_mpega.c
│ brhist.c
│ brhist.h
│ console.c
│ console.h
│ depcomp
│ get_audio.c
│ get_audio.h
│ gpkplotting.c
│ gpkplotting.h
│ gtkanal.c
│ gtkanal.h
│ lametime.c
│ lametime.h
│ lame_main.c
│ main.c
│ main.h
│ Makefile.am
│ Makefile.in
│ mp3rtp.c
│ mp3x.c
│ parse.c
│ parse.h
│ rtp.c
│ rtp.h
│ timestatus.c
│ timestatus.h
│
├───include
│ lame.def
│ lame.h
│ libmp3lame.sym
│ Makefile.am
│ Makefile.in
│
├───libmp3lame
│ │ bitstream.c
│ │ bitstream.h
│ │ depcomp
│ │ encoder.c
│ │ encoder.h
│ │ fft.c
│ │ fft.h
│ │ gain_analysis.c
│ │ gain_analysis.h
│ │ id3tag.c
│ │ id3tag.h
│ │ l3side.h
│ │ lame-analysis.h
│ │ lame.c
│ │ lame.rc
│ │ lameerror.h
│ │ lame_global_flags.h
│ │ logoe.ico
│ │ machine.h
│ │ Makefile.am
│ │ Makefile.in
│ │ mpglib_interface.c
│ │ newmdct.c
│ │ newmdct.h
│ │ presets.c
│ │ psymodel.c
│ │ psymodel.h
│ │ quantize.c
│ │ quantize.h
│ │ quantize_pvt.c
│ │ quantize_pvt.h
│ │ reservoir.c
│ │ reservoir.h
│ │ set_get.c
│ │ set_get.h
│ │ tables.c
│ │ tables.h
│ │ takehiro.c
│ │ util.c
│ │ util.h
│ │ vbrquantize.c
│ │ vbrquantize.h
│ │ VbrTag.c
│ │ VbrTag.h
│ │ version.c
│ │ version.h
│ │
│ ├───i386
│ │ choose_table.nas
│ │ cpu_feat.nas
│ │ fft.nas
│ │ fft3dn.nas
│ │ fftfpu.nas
│ │ fftsse.nas
│ │ ffttbl.nas
│ │ Makefile.am
│ │ Makefile.in
│ │ nasm.h
│ │ scalar.nas
│ │
│ └───vector
│ lame_intrin.h
│ Makefile.am
│ Makefile.in
│ xmm_quantize_sub.c
│
├───mac
│ .DS_Store
│ LAME.mcp
│ LAME_Carbon_Debug.pch
│ LAME_Carbon_Final.pch
│ LAME_Classic_Debug.pch
│ LAME_Classic_Final.pch
│ MacDLLMain.c
│ Makefile.am
│ Makefile.in
│ Precompile_Common.h
│
├───macosx
│ │ Info.plist
│ │ LAME_Prefix.pch
│ │ Makefile.am
│ │ Makefile.in
│ │
│ ├───English.lproj
│ │ InfoPlist.strings
│ │ Makefile.am
│ │ Makefile.in
│ │
│ └───LAME.xcodeproj
│ Makefile.am
│ Makefile.in
│ project.pbxproj
│
├───misc
│ abx.c
│ ath.c
│ auenc
│ depcomp
│ Lame.vbs
│ lame4dos.bat
│ lameGUI.html
│ lameid3.pl
│ Makefile.am
│ Makefile.in
│ mk_mp3.sh
│ mlame
│ mlame_corr.c
│ mugeco.sh
│ scalartest.c
│
├───mpglib
│ AUTHORS
│ common.c
│ common.h
│ dct64_i386.c
│ dct64_i386.h
│ decode_i386.c
│ decode_i386.h
│ depcomp
│ huffman.h
│ interface.c
│ interface.h
│ l2tables.h
│ layer1.c
│ layer1.h
│ layer2.c
│ layer2.h
│ layer3.c
│ layer3.h
│ Makefile.am
│ Makefile.in
│ mpg123.h
│ mpglib.h
│ README
│ tabinit.c
│ tabinit.h
│
└───vc_solutionarch_nasm.vspropsarch_sse2.vspropsarch_x87.vspropsMakefile.amMakefile.invc9_lame.slnvc9_lame_acm.vcprojvc9_lame_acm_adbg.vcprojvc9_lame_acm_tinyxml.vcprojvc9_lame_clients.slnvc9_lame_config.vspropsvc9_lame_dll.vcprojvc9_lame_dll_example.vcprojvc9_lame_dshow.vcprojvc9_lame_lame.vcprojvc9_lame_mp3rtp.vcprojvc9_lame_mp3x.vcprojvc9_lame_test.vcprojvc9_libmp3lame.vcprojvc9_libmp3lame_dll.vcprojvc9_mpglib.vcprojvc9_nasm.rules
=======================================================================
Building the software on *NIX platforms using configure:
=======================================================================
Run the following commands:% ./configure
% make
% make installFor a complete list of options, try "./configure --help"
Some of the more usefull options:
=======================================================================
Building the software on Windows with MSVC:
(or MSVC + 3rd party C compiler such as ICL)
=======================================================================
There are MSVC project files, and a Makefile.MSVC included with the
project. For production use, be sure to compile a "Release" target,
with the "maximum speed" compile option, and #define NDEBUG. It is possible to compile the GTK frame analyzer under windows, see
README.WINGTKVarious build options can be set in configMS.hNote: project files for building lame.exe seem to be broken or not
quite compatable with MSVC6. The most reliable way to build lame and
lame_enc.dll is to run the .bat script (comes with MSVC6) which sets
up your VC environment to work from the command line, and then:copy configMS.h config.h
nmake -f Makefile.MSVC comp=msvc asm=noProject files for the dll, ACM codec and directshow filter
seem to be in better sahpe.
起因:foobar2000在格式转换中需要lame.exe。然而我只能找到源代码。人家是这么说的:
LAME is an educational tool to be used for learning about MP3 encoding. The goal of the LAME project is to improve the psycho acoustics, quality and speed of MP3 encoding. Note: we provide source code only!Features
Source code only !!!
没办法了就这样吧。
想法:一:在Linux上试试编译可执行文件exe
linux上对环境的要求好像没有这么绕人。
这种办法叫做交叉编译, 要用到交叉编译器
想法二:使用项目管理工具(也可以是IDE)来编译运行。
类比Linux原理
在 Angband 目录中,首先,运行随源码一起提供的配置脚本:
这一步将扫描你的系统,找到 Angband 正确构建所需的依赖性。有些依赖是非常基本的,没有它们你的电脑就无法运行,而有些则是专门的。在这一过程结束时,该脚本会给你一份关于它所发现的东西的报告。
一旦一切配置完毕,运行make
命令:
$ make
这通常需要一段时间,但它提供了很多视觉反馈,所以你会知道代码正在被编译。
想法三:使用Cygwin。(这个有好多类似的。就是模仿Linux不在赘述)
想法四:使用wsl,与Linux异曲同工。依旧需要交叉编译。
在INSTALL后面还有许多说明。Building the software on Windows with free compilers.比较类似。就不说了。
总结就是严格按照说明文档。理解Linux与Windows的不同。而且知道编译的共通之处。
在写的过程中实验了很多Markdown的格式。也算是有所收获。
我还想知道例如python代码编译为可执行文件。这个好像要使用pyinstaller,有篇文章有说明。
one more thing
没有代码的纵向进度条是真的烦。厌倦了。
https://linux.cn/article-14033-1.html#:~:text=%E5%85%B7%E4%BD%93%E6%9D%A5%E8%AF%B4%EF%BC%8C%E4%BD%A0%E9%9C%80%E8%A6%81%E4%B8%80%E4%B8%AA%E7%BC%96%E8%AF%91%E5%99%A8%E3%80%82%20%E7%BC%96%E8%AF%91%E5%99%A8%EF%BC%88%E6%AF%94%E5%A6%82%20GCC%20%E6%88%96%20LLVM%EF%BC%89%E5%8F%AF%E4%BB%A5%E5%B0%86%E5%83%8F%E8%BF%99%E6%A0%B7%E7%9A%84%E6%BA%90%E4%BB%A3%E7%A0%81%EF%BC%9A%20%23include%20%3Ciostream%3E%20using,%22hello%20world%22%3B%20%7D%20%E5%8F%98%E6%88%90%20%E6%9C%BA%E5%99%A8%E8%AF%AD%E8%A8%80%20%EF%BC%8C%E5%8D%B3%20CPU%20%E7%94%A8%E6%9D%A5%E5%A4%84%E7%90%86%E4%BF%A1%E6%81%AF%E7%9A%84%E6%8C%87%E4%BB%A4%E3%80%82 ↩︎
Windows编译开源代码方法之关于lame.exe文件的测试及过程相关推荐
- 重新编译开源代码绕过杀毒软件(无导入表编译)
重新编译开源代码绕过杀毒软件 由于大多数加壳软件并不会修改被修改文件的导入表,所以杀毒软件除了计算整个可执行文件的hash值外还会计算pe文件的导入表(import address tables)的h ...
- Python代码封装的可执行exe文件反编译为Py脚本
起因是笔者有个课,教图形图像学,作业的代码调不出老师的效果,于是就又有了hack的想法,把老师给的用来演示的exe文件反编译.主要是根据这篇文章的方法来的.将 exe 文件反编译成 Python 脚本 ...
- matlAB gui 变成c,matlab改变GUI和figure左上角图标的方法,并生成exe文件
1. GUI左上角图标的更改,假设GUI的Tag为figure1,在其OpeningFcn里添加 h = handles.figure1; %返回其句柄 newIcon = javax.swing.I ...
- postman生成python代码_python代码直接生成可执行exe文件
前言: python中有一个很厉害的库可以直接将写好的python代码打包成可执行的.exe文件,生成好的文件不需要python运行环境和pycharm等IDE就可以直接双击运行,是不是很厉害呢!这样 ...
- php程序打包exe文件下载,手把手教你把前端代码打包成msi和exe文件
本文主要介绍Electron应用如何打包成msi和exe文件. 由于介绍Electron打包成msi和exe的文章很少,官方的文档也一笔带过,在研究的过程中踩了很多坑,所以写下此文,给其他人一个参考. ...
- Flutter桌面开发 — Windows App打包以及使用Inno Setup生成.exe文件安装包
文章目录 1 打包 Flutter Windows App 1.1 开发环境准备 1.2 支持Windows 1.3 构建Windows App 2 使用Inno Setup生成.exe文件安装包 2 ...
- mac 安装exe文件的方法 mac怎么安装exe文件
朋友新入MacBook Pro,选购和适应过程中遇到一些困扰,回想我刚开始接触苹果电脑时候也各种懵逼,所以就把能想到的tips都总结下好啦,希望可以帮助到你就最好了.总之呢,大家都有第一次,都是从不熟 ...
- 基于python图书馆管理系统和读者系统(附完整代码以及打包好的exe文件)
摘要: 本文基于python的图书馆管理系统和读者系统,实现了登录.注册.忘记密码.书籍查询.借阅.归还.修改等功能,通过csv文件将数据存储在本地.注册时采用了邮箱验证码,模拟了现实场景.(全部源代 ...
- android studio 打开github开源代码
1.最近下载的开源代码全是github来的,一直用eclipse开发,对于android studio来说是全新的 2.在eclipse导入一个工程那是so easy, import选择一下就可以. ...
最新文章
- python画心形图像
- 用python写一个简单的爬虫_Python实现简易Web爬虫详解
- JRebel for IntelliJ 热部署方法
- 杭电1232 畅通工程
- 前端之旅,正式启航~【前端学习路线图+配套学习视频+师长指点】
- Eclipse添加Spket插件实现ExtJs智能提示
- [BUUCTF-pwn]——picoctf_2018_rop chain
- swing 聊天气泡背景_Java Swing中的聊天气泡
- 关于登录 token 的设计
- django 用户认证
- oracle listener启动问题
- C#_基础_结构Struct(八)
- css表格做日历,CSS 制作有弹性的日历表
- obs点开始推流显示无法连接服务器,前沿科技资讯:OBS Studio推流连接失败如何办 OBS推流失败的正确解决方法...
- 通俗易懂spring之singleton和prototype
- Python Scrapy 爬取 前程无忧招聘网
- 深度揭秘聚合支付的盈利模式
- 结对编程 王坤彬 201421123108
- 如何写出无法维护的代码
- 计算机不能上网怎么检查,电脑不能上网如何通过Ping命令检查网络