ddiakopoulos / libnyquist

:microphone: Cross platform C++11 library for decoding audio (mp3, wav, ogg, opus, flac, etc)
BSD 2-Clause "Simplified" License
534 stars 64 forks source link

Compile error on Linux and macOS #49

Closed Ravbug closed 2 years ago

Ravbug commented 3 years ago

When trying to compile on Linux or macOS with the Clang++ compiler, I get assembly errors:

../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1830:9: error: unknown use of instruction mnemonic without a size suffix
        add     edi, eax                    ; add to running sum
        ^
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1830:54: error: unexpected token in argument list
        add     edi, eax                    ; add to running sum
                                                     ^
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1831:9: error: unknown use of instruction mnemonic without a size suffix
L45:    sub     ebx, 1
        ^
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1836:9: error: unknown use of instruction mnemonic without a size suffix
        mov     edi, -1                     ; return -1 to indicate limit hit
        ^
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1836:57: error: unexpected token in argument list
        mov     edi, -1                     ; return -1 to indicate limit hit
                                                        ^
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1838:9: error: unknown use of instruction mnemonic without a size suffix
        mov     eax, edi                    ; move sum accumulator into eax for return
        ^
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1838:56: error: unexpected token in argument list
        mov     eax, edi                    ; move sum accumulator into eax for return
                                                       ^
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1840:9: error: unknown use of instruction mnemonic without a size suffix
        add     rsp, 8                      ; begin epilog by deallocating stack
        ^
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1840:60: error: unexpected token in argument list
        add     rsp, 8                      ; begin epilog by deallocating stack
                                                           ^
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1841:68: error: unexpected token in argument list
        pop     rsi                         ; restore non-volatile registers & return
                                                                   ^
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1847:1: error: invalid instruction mnemonic 'log2buffer_x64win'
log2buffer_x64win endp
^~~~~~~~~~~~~~~~~
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1849:1: error: invalid instruction mnemonic 'asmcode'
asmcode ends
^~~~~~~
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1851:9: error: invalid instruction mnemonic 'end'
        end
        ^~~
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x64.asm:1746:16: error: directional label undefined
        byte   03f, 041, 042, 043, 044, 045, 047, 048, 049, 04a, 04b, 04d, 04e, 04f, 050, 05

Additionally with g++ on linux, I get this error instead:

RavEngine/deps/libnyquist/CMakeFiles/libwavpack.dir/third_party/wavpack/src/pack_x86.S.o 
/usr/bin/cc  -I../RavEngine/deps/libnyquist/third_party/wavpack/include -O2 -DNDEBUG -MD -MT RavEngine/deps/libnyquist/CMakeFiles/libwavpack.dir/third_party/wavpack/src/pack_x86.S.o -MF RavEngine/deps/libnyquist/CMakeFiles/libwavpack.dir/third_party/wavpack/src/pack_x86.S.o.d -o RavEngine/deps/libnyquist/CMakeFiles/libwavpack.dir/third_party/wavpack/src/pack_x86.S.o -c ../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S: Assembler messages:
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:85: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:86: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:87: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:88: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:477: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:478: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:479: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:480: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:536: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:538: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:539: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:540: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:547: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:549: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:550: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:551: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:934: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:935: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:936: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1071: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1072: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1073: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1074: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1076: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1077: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1349: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1350: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1351: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1352: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1353: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1354: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1397: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1399: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1400: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1401: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1410: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1412: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1414: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1561: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1562: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1563: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1564: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1600: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1601: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1602: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1603: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1669: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1670: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1671: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1672: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1724: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1725: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1726: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1727: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1735: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1803: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1804: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1805: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1806: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1815: Error: invalid instruction suffix for `pushf'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1816: Error: invalid instruction suffix for `pushf'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1818: Error: invalid instruction suffix for `popf'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1819: Error: invalid instruction suffix for `pushf'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1820: Error: operand type mismatch for `pop'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1822: Error: invalid instruction suffix for `popf'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1826: Error: operand type mismatch for `push'
../RavEngine/deps/libnyquist/third_party/wavpack/src/pack_x86.S:1833: Error: operand type mismatch for `pop'

This began when trying to integrate the rlottie library alongside this library, though I'm not sure what's causing it in rlottie's CMakeLists.

I am building libnyquist like this:

# libnyquist
SET(BUILD_EXAMPLE OFF CACHE INTERNAL "")
add_subdirectory("${DEPS_DIR}/libnyquist")

target_link_libraries("${PROJECT_NAME}" PRIVATE 
    # .....
    "libnyquist"
    PUBLIC
       # .....
)
# .....

clang++ info

clang version 10.0.1 (Fedora 10.0.1-3.fc32)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

g++ info

gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9)
Ravbug commented 3 years ago

I've found that having enable_languages(ASM) or including ASM in a different project's languages list (project(RmlUi VERSION 4.0 LANGUAGES C CXX ASM)) causes this issue to appear. rlottie has this, which is what was breaking the build.