Kagami / vmsg

:musical_note: Library for creating voice messages
https://kagami.github.io/vmsg/
Creative Commons Zero v1.0 Universal
348 stars 58 forks source link

Developer instructions - clarification please #49

Closed bevand10 closed 4 years ago

bevand10 commented 4 years ago

Hi.

Re developer instructions, and this line:

  1. Install latest LLVM, Clang and LLD with WebAssembly backend, fix LLVM_ROOT variable of Emscripten config.

For a emscripten rookie, what exactly does the above mean / require ?

Currently, I have Ubuntu 18.04, emscripten 1.22.1, a git clone of your repo, and get these errors when running make. I'm unsure if these errors are related to whatever needs to be done to satisfy 2. above?

... lots of success, then

make[4]: Entering directory '/home/bevand10/Documents/djb/git/vmsg/lame-svn/lame/libmp3lame/vector'
/bin/bash ../../libtool  --tag=CC   --mode=compile /usr/share/emscripten/emcc -DHAVE_CONFIG_H  -I. -I../.. -I../../include -I. -I../../libmp3lame -I../../mpglib -I../..    -DNDEBUG -Oz -MT xmm_quantize_sub.lo -MD -MP -MF .deps/xmm_quantize_sub.Tpo -c -o xmm_quantize_sub.lo xmm_quantize_sub.c
libtool: compile:  /usr/share/emscripten/emcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I. -I../../libmp3lame -I../../mpglib -I../.. -DNDEBUG -Oz -MT xmm_quantize_sub.lo -MD -MP -MF .deps/xmm_quantize_sub.Tpo -c xmm_quantize_sub.c  -fPIC -DPIC -o .libs/xmm_quantize_sub.o
xmm_quantize_sub.c:62:1: warning: unknown attribute 'force_align_arg_pointer' ignored [-Wunknown-attributes]
SSE_FUNCTION void
^
xmm_quantize_sub.c:56:37: note: expanded from macro 'SSE_FUNCTION'
#define SSE_FUNCTION __attribute__((force_align_arg_pointer))
                                    ^
xmm_quantize_sub.c:72:34: error: implicit declaration of function '_mm_loadu_ps' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    const __m128 vec_fabs_mask = _mm_loadu_ps(&fabs_mask._float[0]);
                                 ^
xmm_quantize_sub.c:72:34: note: did you mean '_mm_add_ps'?
/usr/share/emscripten/system/include/emscripten/xmmintrin.h:36:1: note: '_mm_add_ps' declared here
_mm_add_ps(__m128 a, __m128 b)
^
xmm_quantize_sub.c:72:18: error: initializing 'const __m128' (aka 'const float32x4') with an expression of incompatible type 'int'
    const __m128 vec_fabs_mask = _mm_loadu_ps(&fabs_mask._float[0]);
                 ^               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xmm_quantize_sub.c:77:5: error: implicit declaration of function '_mm_prefetch' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    _mm_prefetch((char *) cod_info->xr, _MM_HINT_T0);
    ^
xmm_quantize_sub.c:77:41: error: use of undeclared identifier '_MM_HINT_T0'
    _mm_prefetch((char *) cod_info->xr, _MM_HINT_T0);
                                        ^
xmm_quantize_sub.c:78:34: error: use of undeclared identifier '_MM_HINT_T0'
    _mm_prefetch((char *) xrpow, _MM_HINT_T0);
                                 ^
xmm_quantize_sub.c:80:27: error: implicit declaration of function '_mm_set_ps1' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    vec_xrpow_max._m128 = _mm_set_ps1(0);
                          ^
xmm_quantize_sub.c:80:27: note: did you mean '_mm_set_ps'?
/usr/share/emscripten/system/include/emscripten/xmmintrin.h:6:1: note: '_mm_set_ps' declared here
_mm_set_ps(float z, float y, float x, float w)
^
xmm_quantize_sub.c:80:25: error: assigning to '__m128' (aka 'float32x4') from incompatible type 'int'
    vec_xrpow_max._m128 = _mm_set_ps1(0);
                        ^ ~~~~~~~~~~~~~~
xmm_quantize_sub.c:81:19: error: assigning to '__m128' (aka 'float32x4') from incompatible type 'int'
    vec_sum._m128 = _mm_set_ps1(0);
                  ^ ~~~~~~~~~~~~~~
xmm_quantize_sub.c:84:23: error: assigning to '__m128' (aka 'float32x4') from incompatible type 'int'
        vec_tmp._m128 = _mm_loadu_ps(&(cod_info->xr[i])); /* load */
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xmm_quantize_sub.c:89:9: error: implicit declaration of function '_mm_storeu_ps' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        _mm_storeu_ps(&(xrpow[i]), vec_tmp._m128); /* store into xrpow[] */
        ^
xmm_quantize_sub.c:89:9: note: did you mean '_mm_store_ps'?
/usr/share/emscripten/system/include/emscripten/xmmintrin.h:24:1: note: '_mm_store_ps' declared here
_mm_store_ps(float *p, __m128 a)
^
xmm_quantize_sub.c:91:19: error: assigning to '__m128' (aka 'float32x4') from incompatible type 'int'
    vec_tmp._m128 = _mm_set_ps1(0);
                  ^ ~~~~~~~~~~~~~~
xmm_quantize_sub.c:123:1: warning: unknown attribute 'force_align_arg_pointer' ignored [-Wunknown-attributes]
SSE_FUNCTION static void
^
xmm_quantize_sub.c:56:37: note: expanded from macro 'SSE_FUNCTION'
#define SSE_FUNCTION __attribute__((force_align_arg_pointer))
                                    ^
xmm_quantize_sub.c:135:1: warning: unknown attribute 'force_align_arg_pointer' ignored [-Wunknown-attributes]
SSE_FUNCTION void
^
xmm_quantize_sub.c:56:37: note: expanded from macro 'SSE_FUNCTION'
#define SSE_FUNCTION __attribute__((force_align_arg_pointer))
                                    ^
xmm_quantize_sub.c:189:20: error: implicit declaration of function '_mm_set_ps1' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            v_c1 = _mm_set_ps1(c1);
                   ^
xmm_quantize_sub.c:189:18: error: assigning to '__m128' (aka 'float32x4') from incompatible type 'int'
            v_c1 = _mm_set_ps1(c1);
                 ^ ~~~~~~~~~~~~~~~
xmm_quantize_sub.c:190:18: error: assigning to '__m128' (aka 'float32x4') from incompatible type 'int'
            v_s1 = _mm_set_ps1(s1);
                 ^ ~~~~~~~~~~~~~~~
xmm_quantize_sub.c:191:18: error: assigning to '__m128' (aka 'float32x4') from incompatible type 'int'
            v_c2 = _mm_set_ps1(c2);
                 ^ ~~~~~~~~~~~~~~~
xmm_quantize_sub.c:192:18: error: assigning to '__m128' (aka 'float32x4') from incompatible type 'int'
            v_s2 = _mm_set_ps1(s2);
                 ^ ~~~~~~~~~~~~~~~
xmm_quantize_sub.c:208:21: error: implicit declaration of function '_mm_setr_ps' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                q = _mm_setr_ps(fi[k1], fi[k3], gi[k1], gi[k3]); /* Q := {fi_k1,fi_k3,gi_k1,gi_k3}*/
                    ^
xmm_quantize_sub.c:208:19: error: assigning to '__m128' (aka 'float32x4') from incompatible type 'int'
                q = _mm_setr_ps(fi[k1], fi[k3], gi[k1], gi[k3]); /* Q := {fi_k1,fi_k3,gi_k1,gi_k3}*/
                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xmm_quantize_sub.c:209:32: error: passing 'int' to parameter of incompatible type '__m128' (aka 'float32x4')
                p = _mm_mul_ps(_mm_set_ps1(s2), q);              /* P := s2 * Q */
                               ^~~~~~~~~~~~~~~
/usr/share/emscripten/system/include/emscripten/xmmintrin.h:48:19: note: passing argument to parameter 'a' here
_mm_mul_ps(__m128 a, __m128 b)
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
ERROR    root: compiler frontend failed to generate LLVM bitcode, halting
Makefile:423: recipe for target 'xmm_quantize_sub.lo' failed
bevand10 commented 4 years ago

Resolved by installing the latest emscripten as described at https://emscripten.org/docs/getting_started/Tutorial.html#tutorial

Needed to uninstall the std Ubuntu emscripten (1.22.1 is apparently a 2014 cut!)