4

According to the answer to this question, the first method says that you can build it from the source code (provided in the ports folder) which is more flexible than the second option (which can only generate a dynamic library, not a static one).

Me, knowing that I want to compile Mpg123 statically for SDL2 have to go through this so-called painful method to get a static library (only a .lib and not a .dll) out of it.

I installed YASM and set it up in the environment variables as it said and tried to build the source code. Unfortunately, for me, it turned out a fail (obviously).

The error is in the form of a single error (a command-line error to be specific) and it is tremendously huge to understand, so can you please help me to understand this error given below (seems that there is absolutely no article on how to build mpg123 from source code, which is the reason for me to turn here for help in the end).

Here comes the "only" error (It is a single error but way too complicated to put inside quoted blocks so it is inside a code snippet...):

Severity    Code    Description Project File    Line    Suppression State
Error   MSB3073 The command "cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\dct36_3dnow.S" /nologo     "Win32\Debug_x86\dct36_3dnow.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o  "Win32\Debug_x86\dct36_3dnow.o" "Win32\Debug_x86\dct36_3dnow.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\dct36_3dnowext.S" /nologo     "Win32\Debug_x86\dct36_3dnowext.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o  "Win32\Debug_x86\dct36_3dnowext.o" "Win32\Debug_x86\dct36_3dnowext.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\dct36_sse.S" /nologo     "Win32\Debug_x86\dct36_sse.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o  "Win32\Debug_x86\dct36_sse.o" "Win32\Debug_x86\dct36_sse.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\dct64_3dnow.S" /nologo     "Win32\Debug_x86\dct64_3dnow.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o  "Win32\Debug_x86\dct64_3dnow.o" "Win32\Debug_x86\dct64_3dnow.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\dct64_3dnowext.S" /nologo     "Win32\Debug_x86\dct64_3dnowext.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o  "Win32\Debug_x86\dct64_3dnowext.o" "Win32\Debug_x86\dct64_3dnowext.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\dct64_mmx.S" /nologo     "Win32\Debug_x86\dct64_mmx.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o  "Win32\Debug_x86\dct64_mmx.o" "Win32\Debug_x86\dct64_mmx.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\dct64_sse.S" /nologo     "Win32\Debug_x86\dct64_sse.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o  "Win32\Debug_x86\dct64_sse.o" "Win32\Debug_x86\dct64_sse.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\dct64_sse_float.S" /nologo     "Win32\Debug_x86\dct64_sse_float.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\dct64_sse_float.o" "Win32\Debug_x86\dct64_sse_float.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\equalizer_3dnow.S" /nologo     "Win32\Debug_x86\equalizer_3dnow.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\equalizer_3dnow.o" "Win32\Debug_x86\equalizer_3dnow.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\getcpuflags.S" /nologo     "Win32\Debug_x86\getcpuflags.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\getcpuflags.o" "Win32\Debug_x86\getcpuflags.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_3dnow.S" /nologo     "Win32\Debug_x86\synth_3dnow.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_3dnow.o" "Win32\Debug_x86\synth_3dnow.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_3dnowext.S" /nologo     "Win32\Debug_x86\synth_3dnowext.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_3dnowext.o" "Win32\Debug_x86\synth_3dnowext.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_i586.S" /nologo     "Win32\Debug_x86\synth_i586.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_i586.o" "Win32\Debug_x86\synth_i586.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_mmx.S" /nologo     "Win32\Debug_x86\synth_mmx.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_mmx.o" "Win32\Debug_x86\synth_mmx.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_sse.S" /nologo     "Win32\Debug_x86\synth_sse.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_sse.o" "Win32\Debug_x86\synth_sse.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_sse_float.S" /nologo     "Win32\Debug_x86\synth_sse_float.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_sse_float.o" "Win32\Debug_x86\synth_sse_float.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_stereo_sse_float.S" /nologo     "Win32\Debug_x86\synth_stereo_sse_float.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_stereo_sse_float.o" "Win32\Debug_x86\synth_stereo_sse_float.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\tabinit_mmx.S" /nologo     "Win32\Debug_x86\tabinit_mmx.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\tabinit_mmx.o" "Win32\Debug_x86\tabinit_mmx.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_sse_accurate.S" /nologo     "Win32\Debug_x86\synth_sse_accurate.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_sse_accurate.o" "Win32\Debug_x86\synth_sse_accurate.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_sse_s32.S" /nologo     "Win32\Debug_x86\synth_sse_s32.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_sse_s32.o" "Win32\Debug_x86\synth_sse_s32.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_stereo_sse_accurate.S" /nologo     "Win32\Debug_x86\synth_stereo_sse_accurate.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_stereo_sse_accurate.o" "Win32\Debug_x86\synth_stereo_sse_accurate.asm"

cl /I "..\..\.." /I "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src"  /EP /TC "D:\SDL2\Dependencies\mpg123-1.25.10\mpg123-1.25.10\ports\MSVC++\2015\win32\libmpg123\..\..\..\..\..\src\libmpg123\synth_stereo_sse_s32.S" /nologo     "Win32\Debug_x86\synth_stereo_sse_s32.asm"
yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "Win32\Debug_x86\synth_stereo_sse_s32.o" "Win32\Debug_x86\synth_stereo_sse_s32.asm"

:VCEnd" exited with code 1. libmpg123   C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets 128 

It can easily be seen that the error is related to YASM in some way but I don't know how?

I have downloaded YASM from here by the way.

EDIT: When I actually tried to compile all the assembly source files using YASM in the Command Prompt, most of them usually said:-

error: instruction not recognized: 'PREPARE_GOT'
error: instruction not recognized: 'GET_GOT'
error: instruction not recognized: 'RESTORE_GOT'

Thank you.

Ruks
  • 3,886
  • 1
  • 10
  • 22
  • You could run each of the individual commands to see which one actually failed. – msbit Aug 25 '18 at 15:10
  • @msbit Okay, I followed what you said and added what errors I got (for most of them that is) when I compiled all of them individually using YASM in CMD. – Ruks Aug 25 '18 at 15:23
  • Hmm, apparently a reported bug (https://sourceforge.net/p/mpg123/bugs/259/). It looks like this hasn't been fixed upstream but the `vcpkg` folks have a patch they apply at build time: https://github.com/Microsoft/vcpkg/blob/master/ports/mpg123/0002-fix-x86-build.patch – msbit Aug 25 '18 at 15:31
  • Actually, I'm not very familiar with `vcpkg`, but it looks like you may be able to configure the linking type through the `VCPKG_LIBRARY_LINKAGE` variable, and so may be able to use it to install your library with much less fuss :) – msbit Aug 25 '18 at 15:35
  • @msbit Thank you, I never knew that **vcpkg** was this helpful! It can install many different packages which require great effort to build just inside visual studio without having to do *anything* at all. This is something new for me to learn and also for those people who saw this question along with this comment. – Ruks Aug 25 '18 at 16:56
  • Yep it looks pretty nifty. In terms of getting `mpg123` built as a static library, I think it'd be better (and easier!) to specify `--triplet x86-windows-static` on the command line than to set the linkage variable. Bon chance! – msbit Aug 26 '18 at 00:09
  • 2
    @msbit You can try going [here](https://github.com/Microsoft/vcpkg/blob/master/docs/examples/using-sqlite.md) for more information based on installing packages. You can do `.\vcpkg install :x86-windows-static` and similar for x64 bit architecture. – Ruks Aug 26 '18 at 03:40

0 Answers0