Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tip for building inspect.js and inspect.wasm #81

Open
ycho opened this issue Jun 1, 2020 · 6 comments
Open

Tip for building inspect.js and inspect.wasm #81

ycho opened this issue Jun 1, 2020 · 6 comments

Comments

@ycho
Copy link

ycho commented Jun 1, 2020

From my triage on Mac OS (10.14.4, Mojave) and Uuntu 18.04, there two tips were required to successfully build inspect.js and inspect.wasm with Emscripton, based on the guides at https://aomedia.googlesource.com/aom/#emscripten-builds.

  1. Configure the build with cmake,
    only av1-normativ branch worked, and the mater branch failed with cmake.
    (To see which parts failed, please checkout Emscripton build fails with both Ubuntu and Mac OS to generate inspect.js #78 and Emscripton build error on Mac OS #79)

(FYI, I've run: "cmake ../aom -DENABLE_CCACHE=1 -DENABLE_DOCS=0 -DENABLE_TESTS=0 -DAOM_TARGET_CPU=generic -DCONFIG_ACCOUNTING=1 -DCONFIG_INSPECTION=1 -DCONFIG_MULTITHREAD=0 -DCONFIG_RUNTIME_CPU_DETECT=0 -DCONFIG_WEBM_IO=0 -DCMAKE_TOOLCHAIN_FILE=/Users/yushin/workspace/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake && make -j12 inspect")

  1. Before doing "make inspect", I needed below change to remove the build error.
    i.e. "-std=c99" --> "-std=gnu99" in [aom directorory]/build/cmake/aom_configure.cmake

$ git diff
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index 2b59c61a9..ec34cf9b0 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -259,7 +259,7 @@ if(MSVC)
add_compiler_flag_if_supported("/WX")
endif()
else()

  • require_c_flag("-std=c99" YES)
  • require_c_flag("-std=gnu99" YES)
    add_compiler_flag_if_supported("-Wall")
    add_compiler_flag_if_supported("-Wdisabled-optimization")
    add_compiler_flag_if_supported("-Wextra")

I hope this helps saving your time building aom analyzer!

@ycho ycho changed the title Note for building inspect.js and inspect.wasm Tip for building inspect.js and inspect.wasm Jun 1, 2020
@Dayof
Copy link

Dayof commented Jun 17, 2020

I had the same issues when I tried to build AOManalyser and generate the inspect.js, but I found an easier way to by pass them:

  1. Clone/Build aom
  2. Download/Build Emscripten
  3. Download AV1 Analyzer
  4. Build AV1 Analyzer
    cmake /path/to/aom \
    -DENABLE_CCACHE=1 \
    -DAOM_TARGET_CPU=generic \
    -DENABLE_DOCS=0 \
    -DENABLE_TESTS=0 \
    -DCONFIG_ACCOUNTING=1 \
    -DCONFIG_INSPECTION=1 \
    -DCONFIG_MULTITHREAD=0 \
    -DCONFIG_RUNTIME_CPU_DETECT=0 \
    -DCONFIG_WEBM_IO=0 \
    -DCMAKE_TOOLCHAIN_FILE=/path/to/Emscripten.cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -G "Unix Makefiles"
  5. Delete the version file from AOMAnalyzer folder (the aom analyzer that you are using to generate inspect.js), my file path was /path/to/AOMAnalyzer-linux-x64/version
  6. Generate the inspect.js
    make -j8 inspect

Extra local info:

@ycho
Copy link
Author

ycho commented Jun 17, 2020

I had the same issues when I tried to build AOManalyser and generate the inspect.js, but I found an easier way to by pass them:

1. Clone/Build [aom](https://aomedia.googlesource.com/aom)

2. Download/Build [Emscripten](https://emscripten.org/docs/getting_started/downloads.html)

3. Download [AV1 Analyzer](https://arewecompressedyet.com/analyzer/release_builds/AOMAnalyzer-linux-x64.tar.gz)

4. Build AV1 Analyzer
   ```shell
   cmake /path/to/aom \
   -DENABLE_CCACHE=1 \
   -DAOM_TARGET_CPU=generic \
   -DENABLE_DOCS=0 \
   -DENABLE_TESTS=0 \
   -DCONFIG_ACCOUNTING=1 \
   -DCONFIG_INSPECTION=1 \
   -DCONFIG_MULTITHREAD=0 \
   -DCONFIG_RUNTIME_CPU_DETECT=0 \
   -DCONFIG_WEBM_IO=0 \
   -DCMAKE_TOOLCHAIN_FILE=/path/to/Emscripten.cmake \
   -DCMAKE_BUILD_TYPE=Release \
   -G "Unix Makefiles"
   ```

5. Delete the version file from AOMAnalyzer folder (the aom analyzer that you are using to generate inspect.js), my file path was /path/to/AOMAnalyzer-linux-x64/version

6. Generate the `inspect.js`
   ```shell
   make -j8 inspect
   ```

Extra local info:

* gcc version : 9.3.0

* cmake version : 3.16.3

* OS : Linux 5.4.0-37-generic #41-Ubuntu x86_64 x86_64 x86_64 GNU/Linux

* aom version : v1.0.0-errata1-avif-885-g18ce7a0a0

* emcc version : 1.39.18

* AOMAnalyzer : v2.0.8

Thanks for sharing your trial, and it seems even more efficient and quicker than mine.
Glad that we have another folk who build bitstream analyzer and hopefully use it helping way!

I didn't know that awcy keeps the pre-built version of aom analyzer, but it seems it has it for linux only. Btw, were you able to "make inspect" w/o doing the step, "-std=c99" --> "-std=gnu99" in [aom directorory]/build/cmake/aom_configure.cmake"? Also, I am curious what is your step 5 for?

@Dayof
Copy link

Dayof commented Jun 17, 2020

AWCY keeps other versions too, I got the links from an older version of the website suggested in AOM (https://web.archive.org/web/20200414193350/https://people.xiph.org/~mbebenita/analyzer/).

Yes I was able to run make inspect with success without the step "-std=c99", the options DCMAKE_BUILD_TYPE and -G already solved all the issues for me. I got this from Emscripten cmake file instruction:

# To use this toolchain file with CMake, invoke CMake with the following command
# line parameters:
# cmake -DCMAKE_TOOLCHAIN_FILE=<EmscriptenRoot>/cmake/Modules/Platform/Emscripten.cmake
#       -DCMAKE_BUILD_TYPE=<Debug|RelWithDebInfo|Release|MinSizeRel>
#       -G "Unix Makefiles" (Linux and OSX)
#       -G "MinGW Makefiles" (Windows)
#       <path/to/CMakeLists.txt> # Note, pass in here ONLY the path to the file, not the filename 'CMakeLists.txt' itself.

The step 5 I did because I was having this issue:

In file included from $HOME/codes/aom/third_party/libyuv/source/cpu_id.cc:23:
In file included from $HOME/apps/emsdk/upstream/emscripten/system/include/libcxx/stdlib.h:100:
In file included from $HOME/apps/emsdk/upstream/emscripten/system/include/libcxx/math.h:312:
In file included from $HOME/apps/emsdk/upstream/emscripten/system/include/libcxx/limits:121:
$HOME/apps/AOMAnalyzer-linux-x64/version:1:1: error: unknown type name 'v2'
v2.0.8
^
$HOME/apps/AOMAnalyzer-linux-x64/version:1:3: error: expected unqualified-id
v2.0.8

I really don't know why this, so I tried deleting the version file and it worked (?)

@rarzumanyan
Copy link

rarzumanyan commented Oct 13, 2020

@Dayof

Thanks for the detailed instructions.
Following those I was able to build the inspect.js decoder but as I run the analyzer

~/AOMAnalyzer-linux-x64/AOMAnalyzer ~/Git/aom/build_analyzer/examples/inspect.js ~/videos/apple_128x128_2.ivf

GUI application stucks at "Decoding Frames" stage:
Screenshot from 2020-10-13 22-36-38

Have you ever come across anything similar?

@xiaocai506
Copy link

@Dayof

Thanks for the detailed instructions. Following those I was able to build the inspect.js decoder but as I run the analyzer

~/AOMAnalyzer-linux-x64/AOMAnalyzer ~/Git/aom/build_analyzer/examples/inspect.js ~/videos/apple_128x128_2.ivf

GUI application stucks at "Decoding Frames" stage: Screenshot from 2020-10-13 22-36-38

Have you ever come across anything similar?

Hi,@rarzumanyan. the issue got resolved now?

@thomaswulz
Copy link

To produce a working build with latest emscripten, two changes must be made to CMakeLists.txt:

  1. Remove the line append_link_flag_to_target("inspect" "--memory-init-file 0") (this flag was removed, but should have had no effect anyway)
  2. Add append_link_flag_to_target("inspect" "-s TOTAL_STACK=5MB") (the default stack size was reduced recently, which made the decoder crash)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants