aboutsummaryrefslogtreecommitdiff
path: root/docs/deprecated_builds.md
blob: ba42966cc23b45578f7b81a7ad1657b09d088a00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# Deprecated Builds

Older documentation on build configs which are no longer supported.

## Pre-requisites

You'll need to have depot tools installed: https://www.chromium.org/developers/how-tos/install-depot-tools
Refer to chromium instructions for each platform for other prerequisites.

## Getting the Code

Create a working directory, enter it, and run:

    gclient config https://chromium.googlesource.com/libyuv/libyuv
    gclient sync


Then you'll get a .gclient file like:

    solutions = [
      { "name"        : "libyuv",
        "url"         : "https://chromium.googlesource.com/libyuv/libyuv",
        "deps_file"   : "DEPS",
        "managed"     : True,
        "custom_deps" : {
        },
        "safesync_url": "",
      },
    ];


For iOS add `;target_os=['ios'];` to your OSX .gclient and run `GYP_DEFINES="OS=ios" gclient sync.`

Browse the Git reprository: https://chromium.googlesource.com/libyuv/libyuv/+/master

### Android
For Android add `;target_os=['android'];` to your Linux .gclient


    solutions = [
      { "name"        : "libyuv",
        "url"         : "https://chromium.googlesource.com/libyuv/libyuv",
        "deps_file"   : "DEPS",
        "managed"     : True,
        "custom_deps" : {
        },
        "safesync_url": "",
      },
    ];
    target_os = ["android", "unix"];

Then run:

    export GYP_DEFINES="OS=android"
    gclient sync

Caveat: Theres an error with Google Play services updates.  If you get the error "Your version of the Google Play services library is not up to date", run the following:

    cd chromium/src
    ./build/android/play_services/update.py download
    cd ../..

For Windows the gclient sync must be done from an Administrator command prompt.

The sync will generate native build files for your environment using gyp (Windows: Visual Studio, OSX: XCode, Linux: make). This generation can also be forced manually: `gclient runhooks`

To get just the source (not buildable):

    git clone https://chromium.googlesource.com/libyuv/libyuv


## Building the Library and Unittests

### Windows

    set GYP_DEFINES=target_arch=ia32
    call python gyp_libyuv -fninja -G msvs_version=2013
    ninja -j7 -C out\Release
    ninja -j7 -C out\Debug

    set GYP_DEFINES=target_arch=x64
    call python gyp_libyuv -fninja -G msvs_version=2013
    ninja -C out\Debug_x64
    ninja -C out\Release_x64

#### Building with clangcl
    set GYP_DEFINES=clang=1 target_arch=ia32
    call python tools\clang\scripts\update.py
    call python gyp_libyuv -fninja libyuv_test.gyp
    ninja -C out\Debug
    ninja -C out\Release

### OSX

Clang 64 bit shown. Remove `clang=1` for GCC and change x64 to ia32 for 32 bit.

    GYP_DEFINES="clang=1 target_arch=x64" ./gyp_libyuv
    ninja -j7 -C out/Debug
    ninja -j7 -C out/Release

    GYP_DEFINES="clang=1 target_arch=ia32" ./gyp_libyuv
    ninja -j7 -C out/Debug
    ninja -j7 -C out/Release

### iOS
http://www.chromium.org/developers/how-tos/build-instructions-ios

Add to .gclient last line: `target_os=['ios'];`

armv7

    GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=arm32" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv
    ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
    ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest

arm64

    GYP_DEFINES="OS=ios target_arch=arm64 target_subarch=arm64" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv
    ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
    ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest

both armv7 and arm64 (fat)

    GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=both" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv
    ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
    ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest

simulator

    GYP_DEFINES="OS=ios target_arch=ia32 target_subarch=arm32" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_sim" ./gyp_libyuv
    ninja -j7 -C out_sim/Debug-iphonesimulator libyuv_unittest
    ninja -j7 -C out_sim/Release-iphonesimulator libyuv_unittest

### Android
https://code.google.com/p/chromium/wiki/AndroidBuildInstructions

Add to .gclient last line: `target_os=['android'];`

armv7

    GYP_DEFINES="OS=android" GYP_CROSSCOMPILE=1 ./gyp_libyuv
    ninja -j7 -C out/Debug yuv_unittest_apk
    ninja -j7 -C out/Release yuv_unittest_apk

arm64

    GYP_DEFINES="OS=android target_arch=arm64 target_subarch=arm64" GYP_CROSSCOMPILE=1 ./gyp_libyuv
    ninja -j7 -C out/Debug yuv_unittest_apk
    ninja -j7 -C out/Release yuv_unittest_apk

ia32

    GYP_DEFINES="OS=android target_arch=ia32" GYP_CROSSCOMPILE=1 ./gyp_libyuv
    ninja -j7 -C out/Debug yuv_unittest_apk
    ninja -j7 -C out/Release yuv_unittest_apk

    GYP_DEFINES="OS=android target_arch=ia32 android_full_debug=1" GYP_CROSSCOMPILE=1 ./gyp_libyuv
    ninja -j7 -C out/Debug yuv_unittest_apk

mipsel

    GYP_DEFINES="OS=android target_arch=mipsel" GYP_CROSSCOMPILE=1 ./gyp_libyuv
    ninja -j7 -C out/Debug yuv_unittest_apk
    ninja -j7 -C out/Release yuv_unittest_apk

arm32 disassembly:

    third_party/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-objdump -d out/Release/obj/source/libyuv.row_neon.o

arm64 disassembly:

    third_party/android_ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-objdump -d out/Release/obj/source/libyuv.row_neon64.o

Running tests:

    build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=*

Running test as benchmark:

    build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=-1"

Running test with C code:

    build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=1 --libyuv_cpu_info=1"

#### Building with GN

    gn gen out/Release "--args=is_debug=false target_cpu=\"x86\""
    gn gen out/Debug "--args=is_debug=true target_cpu=\"x86\""
    ninja -C out/Release
    ninja -C out/Debug

### Building Offical with GN

    gn gen out/Official "--args=is_debug=false is_official_build=true is_chrome_branded=true"
    ninja -C out/Official

#### Building mips with GN

mipsel
    gn gen out/Default "--args=is_debug=false target_cpu=\"mipsel\" target_os = \"android\" mips_arch_variant = \"r6\" mips_use_msa = true is_component_build = true is_clang = false"
    ninja -C out/Default

mips64el
    gn gen out/Default "--args=is_debug=false target_cpu=\"mips64el\" target_os = \"android\" mips_arch_variant = \"r6\" mips_use_msa = true is_component_build = true is_clang = false"
    ninja -C out/Default

### Linux

    GYP_DEFINES="target_arch=x64" ./gyp_libyuv
    ninja -j7 -C out/Debug
    ninja -j7 -C out/Release

    GYP_DEFINES="target_arch=ia32" ./gyp_libyuv
    ninja -j7 -C out/Debug
    ninja -j7 -C out/Release

#### CentOS

On CentOS 32 bit the following work around allows a sync:

    export GYP_DEFINES="host_arch=ia32"
    gclient sync

### Windows Shared Library

Modify libyuv.gyp from 'static_library' to 'shared_library', and add 'LIBYUV_BUILDING_SHARED_LIBRARY' to 'defines'.

    gclient runhooks

After this command follow the building the library instructions above.

If you get a compile error for atlthunk.lib on Windows, read http://www.chromium.org/developers/how-tos/build-instructions-windows


### Build targets

    ninja -C out/Debug libyuv
    ninja -C out/Debug libyuv_unittest
    ninja -C out/Debug compare
    ninja -C out/Debug yuvconvert
    ninja -C out/Debug yuvconstants
    ninja -C out/Debug psnr
    ninja -C out/Debug cpuid


## Building the Library with make

### Linux

    make -j7 V=1 -f linux.mk
    make -j7 V=1 -f linux.mk clean
    make -j7 V=1 -f linux.mk CXX=clang++

## Building the Library with cmake

Install cmake: http://www.cmake.org/

Default debug build:

    mkdir out
    cd out
    cmake ..
    cmake --build .

Release build/install

    mkdir out
    cd out
    cmake -DCMAKE_INSTALL_PREFIX="/usr/lib" -DCMAKE_BUILD_TYPE="Release" ..
    cmake --build . --config Release
    sudo cmake --build . --target install --config Release

### Windows 8 Phone

Pre-requisite:

* Install Visual Studio 2012 and Arm to your environment.<br>

Then:

    call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm\vcvarsx86_arm.bat"

or with Visual Studio 2013:

    call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_arm\vcvarsx86_arm.bat"
    nmake /f winarm.mk clean
    nmake /f winarm.mk

### Windows Shared Library

Modify libyuv.gyp from 'static_library' to 'shared_library', and add 'LIBYUV_BUILDING_SHARED_LIBRARY' to 'defines'. Then run this.

    gclient runhooks

After this command follow the building the library instructions above.

If you get a compile error for atlthunk.lib on Windows, read http://www.chromium.org/developers/how-tos/build-instructions-windows

### 64 bit Windows

    set GYP_DEFINES=target_arch=x64
    gclient runhooks V=1

### ARM Linux

    export GYP_DEFINES="target_arch=arm"
    export CROSSTOOL=`<path>`/arm-none-linux-gnueabi
    export CXX=$CROSSTOOL-g++
    export CC=$CROSSTOOL-gcc
    export AR=$CROSSTOOL-ar
    export AS=$CROSSTOOL-as
    export RANLIB=$CROSSTOOL-ranlib
    gclient runhooks

## Running Unittests

### Windows

    out\Release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter="*"

### OSX

    out/Release/libyuv_unittest --gtest_filter="*"

### Linux

    out/Release/libyuv_unittest --gtest_filter="*"

Replace --gtest_filter="*" with specific unittest to run.  May include wildcards. e.g.

    out/Release/libyuv_unittest --gtest_filter=libyuvTest.I420ToARGB_Opt

## CPU Emulator tools

### Intel SDE (Software Development Emulator)

Pre-requisite: Install IntelSDE for Windows: http://software.intel.com/en-us/articles/intel-software-development-emulator

Then run:

    c:\intelsde\sde -hsw -- out\release\libyuv_unittest.exe --gtest_filter=*


## Memory tools

### Running Dr Memory memcheck for Windows

Pre-requisite: Install Dr Memory for Windows and add it to your path: http://www.drmemory.org/docs/page_install_windows.html

    set GYP_DEFINES=build_for_tool=drmemory target_arch=ia32
    call python gyp_libyuv -fninja -G msvs_version=2013
    ninja -C out\Debug
    drmemory out\Debug\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*

### Running UBSan

See Chromium instructions for sanitizers: https://www.chromium.org/developers/testing/undefinedbehaviorsanitizer

Sanitizers available: TSan, MSan, ASan, UBSan, LSan

    GYP_DEFINES='ubsan=1' gclient runhooks
    ninja -C out/Release

### Running Valgrind memcheck

Memory errors and race conditions can be found by running tests under special memory tools. [Valgrind] [1] is an instrumentation framework for building dynamic analysis tools. Various tests and profilers are built upon it to find memory handling errors and memory leaks, for instance.

[1]: http://valgrind.org

    solutions = [
      { "name"        : "libyuv",
        "url"         : "https://chromium.googlesource.com/libyuv/libyuv",
        "deps_file"   : "DEPS",
        "managed"     : True,
        "custom_deps" : {
           "libyuv/chromium/src/third_party/valgrind": "https://chromium.googlesource.com/chromium/deps/valgrind/binaries",
        },
        "safesync_url": "",
      },
    ]

Then run:

    GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=memcheck" python gyp_libyuv
    ninja -C out/Debug
    valgrind out/Debug/libyuv_unittest


For more information, see http://www.chromium.org/developers/how-tos/using-valgrind

### Running Thread Sanitizer (TSan)

    GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=tsan" python gyp_libyuv
    ninja -C out/Debug
    valgrind out/Debug/libyuv_unittest

For more info, see http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer

### Running Address Sanitizer (ASan)

    GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=asan" python gyp_libyuv
    ninja -C out/Debug
    valgrind out/Debug/libyuv_unittest

For more info, see http://dev.chromium.org/developers/testing/addresssanitizer

## Benchmarking

The unittests can be used to benchmark.

### Windows

    set LIBYUV_WIDTH=1280
    set LIBYUV_HEIGHT=720
    set LIBYUV_REPEAT=999
    set LIBYUV_FLAGS=-1
    out\Release\libyuv_unittest.exe --gtest_filter=*I420ToARGB_Opt


### Linux and Mac

    LIBYUV_WIDTH=1280 LIBYUV_HEIGHT=720 LIBYUV_REPEAT=1000 out/Release/libyuv_unittest --gtest_filter=*I420ToARGB_Opt

    libyuvTest.I420ToARGB_Opt (547 ms)

Indicates 0.547 ms/frame for 1280 x 720.

## Making a change

    gclient sync
    git checkout -b mycl -t origin/master
    git pull
    <edit files>
    git add -u
    git commit -m "my change"
    git cl lint
    git cl try
    git cl upload -r a-reviewer@chomium.org -s
    <once approved..>
    git cl land