1<!DOCTYPE html> 2<html> 3<head> 4 <title>compile_trace_streamer</title> 5 <meta charset="utf-8"> 6 <meta content="width=device-width, initial-scale=1.0" name="viewport"> 7 8 <style> 9 code[class*="font-"], 10 pre[class*="font-"] { 11 text-align: left; 12 color: #333333; 13 background: none; 14 word-spacing: normal; 15 white-space: pre; 16 word-break: normal; 17 word-wrap: normal; 18 line-height: 1.5; 19 -moz-hyphens: none; 20 -ms-hyphens: none; 21 -o-tab-size: 8; 22 tab-size: 8; 23 -moz-tab-size: 8; 24 -webkit-hyphens: none; 25 hyphens: none; 26 font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; 27 } 28 29 pre[class*="font-"] { 30 border-radius: 3px; 31 background: #F5F5F5; 32 padding: 0.8em; 33 overflow: auto; 34 } 35 36 :not(pre) > code[class*="font-"] { 37 white-space: normal; 38 background: #F5F5F5; 39 padding: 0.2em; 40 border-radius: 0.3em; 41 } 42 43 44 .temporary.cdata { 45 color: #183690; 46 } 47 48 .temporary.comment, 49 .temporary.blockquote { 50 color: #969897; 51 } 52 53 .temporary.doctype, 54 .temporary.punctuation, 55 .temporary.variable, 56 .temporary.macro.property { 57 color: #333333; 58 } 59 60 61 .temporary.string, 62 .temporary.url, 63 .temporary.regex, 64 .temporary.attr-value { 65 color: #183690; 66 } 67 68 .temporary.operator, 69 .temporary.important, 70 .temporary.keyword, 71 .temporary.rule, 72 .temporary.builtin { 73 color: #a71d5c; 74 } 75 76 .temporary.atrule, 77 .temporary.constant, 78 .temporary.symbol, 79 .temporary.command, 80 .temporary.property, 81 .temporary.number, 82 .temporary.boolean, 83 .temporary.entity, 84 .temporary.code { 85 color: #0086b2; 86 } 87 88 .temporary.tag, 89 .temporary.selector, 90 .temporary.prolog { 91 color: #63a35e; 92 } 93 94 .temporary.entity { 95 cursor: help; 96 } 97 98 .temporary.title, 99 .temporary.title .temporary.punctuation { 100 font-weight: bold; 101 color: #1d3e89; 102 } 103 104 .temporary.list { 105 color: #ed6a48; 106 } 107 108 .temporary.function, 109 .temporary.namespace, 110 .temporary.pseudo-element, 111 .temporary.class, 112 .temporary.class-name, 113 .temporary.pseudo-class, 114 .temporary.id, 115 .temporary.url-reference .temporary.variable, 116 .temporary.attr-name { 117 color: #795da2; 118 } 119 120 .temporary.inserted { 121 color: #55a535; 122 background-color: #eaffee; 123 } 124 125 .temporary.bold { 126 font-weight: bold; 127 } 128 129 .temporary.deleted { 130 color: #bd2c08; 131 background-color: #ffecea; 132 } 133 134 .font-json .temporary.property { 135 color: #183690; 136 } 137 138 .temporary.italic { 139 font-style: italic; 140 } 141 142 .font-markup .temporary.tag .temporary.punctuation { 143 color: #333333; 144 } 145 146 .font-yaml .temporary.atrule { 147 color: #63a35a; 148 } 149 150 code.font-css, 151 .font-css .temporary.function { 152 color: #0086b8; 153 } 154 155 code.font-yaml { 156 color: #183690; 157 } 158 159 .font-ruby .temporary.function { 160 color: #333333; 161 } 162 163 .font-markdown .temporary.url { 164 color: #795da2; 165 } 166 167 .font-makefile .temporary.variable { 168 color: #183690; 169 } 170 171 .font-makefile .temporary.builtin { 172 color: #0086b3; 173 } 174 175 .font-makefile .temporary.symbol { 176 color: #795da2; 177 } 178 179 .font-bash .temporary.keyword { 180 color: #0086b3; 181 } 182 183 pre[data-wire] { 184 padding: 1em 0 1em 2em; 185 position: relative; 186 } 187 188 pre[data-wire] .line-highlight-wrapper { 189 background-color: transparent; 190 top: 2px; 191 left: 2px; 192 display: block; 193 width: 100%; 194 position: absolute; 195 } 196 197 pre[data-wire] .line-highlight { 198 position: absolute; 199 left: 2px; 200 right: 2px; 201 pointer-events: none; 202 margin-top: 3em; 203 background: hsla(25, 10%, 55%,.06); 204 background: linear-gradient(to right, hsla(25, 10%, 40%,.2) 80%, hsla(23, 24%, 52%,0)); 205 line-height: inherit; 206 white-space: pre; 207 } 208 209 pre[data-wire] .line-highlight:before, 210 pre[data-wire] .line-highlight[data-end]:after { 211 content: attr(data-start); 212 position: absolute; 213 background-color: hsla(22, 25%, 54%,.5); 214 min-width: 2em; 215 padding: 0 .6em; 216 top: 0.5em; 217 left: 0.4em; 218 color: hsl(22, 23%, 90%); 219 vertical-align: 0.3em; 220 border-radius: 10px; 221 text-shadow: none; 222 box-shadow: 0 2px white; 223 font: bold 60%/1.6 sans-serif; 224 text-align: center; 225 } 226 227 pre[data-wire] .line-highlight[data-end]:after { 228 bottom: 0.6em; 229 content: attr(data-end); 230 top: auto; 231 } 232 233 body { 234 font-size: 16px; 235 font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; 236 line-height: 1.6; 237 overflow: initial; 238 box-sizing: border-box; 239 word-wrap: break-word; 240 color: #333333; 241 background-color: #FFFFFF; 242 } 243 244 body > :first-child { 245 margin-top: 0; 246 } 247 248 body h1, body h2, body h3{ 249 margin-bottom: 16px; 250 color: #000000; 251 line-height: 1.2; 252 margin-top: 1em; 253 } 254 255 body h1 { 256 font-weight: 300; 257 font-size: 2.25em; 258 padding-bottom: 0.3em; 259 } 260 261 body h2 { 262 font-weight: 400; 263 font-size: 1.75em; 264 padding-bottom: 0.3em; 265 } 266 267 body h3 { 268 font-size: 1.5em; 269 font-weight: 500; 270 } 271 272 body h1, body h2, body h3{ 273 font-weight: 600; 274 } 275 276 body del { 277 color: #5c5c5c; 278 } 279 280 body strong { 281 color: #000000; 282 } 283 284 body a { 285 text-decoration: none; 286 color: #08c; 287 } 288 289 body a:not([href]) { 290 text-decoration: none; 291 color: inherit; 292 } 293 294 body a:hover { 295 color: #00a3f5; 296 text-decoration: none; 297 } 298 299 body img { 300 max-width: 100%; 301 } 302 303 body > ul, body > ol { 304 margin-bottom: 16px; 305 } 306 307 body ul, body ol { 308 padding-left: 2em; 309 } 310 311 body > p { 312 margin-top: 0; 313 word-wrap: break-word; 314 margin-bottom: 16px; 315 } 316 317 body ul.no-list, body ol.no-list { 318 padding: 0; 319 list-style-type: none; 320 } 321 322 body li { 323 margin-bottom: 0; 324 } 325 326 body ul ul, body ul ol, body ol ol, body ol ul { 327 margin-top: 0; 328 margin-bottom: 0; 329 } 330 331 body li.task-list-item { 332 list-style: none; 333 } 334 335 body li > p { 336 margin-top: 0; 337 margin-bottom: 0; 338 } 339 340 body .task-list-item-checkbox { 341 margin: 0 0.2em 0.25em -1.8em; 342 vertical-align: middle; 343 } 344 345 body blockquote { 346 margin: 16px 0; 347 font-size: inherit; 348 padding: 0 15px 0 0; 349 color: #5c5c5c; 350 background-color: #f0f0f0; 351 border-left: 4px solid #d6d6d6; 352 } 353 354 body .task-list-item-checkbox:hover { 355 cursor: pointer; 356 } 357 358 body blockquote > :first-child { 359 margin-top: 0; 360 } 361 362 body blockquote > :last-child { 363 margin-bottom: 0; 364 } 365 366 body hr { 367 background-color: #d6d6d6; 368 height: 6px; 369 border: 0 none; 370 margin: 32px 0 0 0; 371 } 372 373 body table th { 374 font-weight: bold; 375 color: #000000; 376 } 377 378 body table { 379 margin: 10px 0 15px 0; 380 border-collapse: collapse; 381 border-spacing: 0; 382 width: 100%; 383 display: block; 384 overflow: auto; 385 word-break: normal; 386 word-break: keep-all; 387 } 388 389 body table td, body table th { 390 padding: 5px 14px 0 0; 391 border: 1px solid #d6d6d6; 392 } 393 394 body dl { 395 padding: 0; 396 } 397 398 body dl dd { 399 padding: 0 15px; 400 margin-bottom: 15px 401 } 402 403 body dl dt { 404 margin-top: 16px; 405 padding: 0; 406 font-size: 1em; 407 font-weight: bold; 408 font-style: italic; 409 } 410 411 body code { 412 font-size: 0.85em !important; 413 font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; 414 padding: 0.2em 0 0 0; 415 color: #000000; 416 background-color: #f0f0f0; 417 border-radius: 3px; 418 } 419 420 body code::before, body code::after { 421 letter-spacing: -0.2em; 422 content: "\00a0"; 423 } 424 425 body .highlight pre { 426 word-break: normal; 427 margin-bottom: 0; 428 } 429 430 body pre > code { 431 word-break: normal; 432 white-space: pre; 433 background: transparent; 434 border: 0; 435 padding: 0; 436 margin: 0; 437 font-size: 0.85em !important; 438 } 439 440 body .highlight { 441 margin-bottom: 15px; 442 } 443 444 body pre code, body pre tt { 445 display: inline; 446 max-width: initial; 447 word-wrap: normal; 448 overflow: initial; 449 line-height: inherit; 450 background-color: transparent; 451 border: 0; 452 padding: 0; 453 margin: 0; 454 } 455 456 body .highlight pre, body pre { 457 overflow: auto; 458 font-size: .85em !important; 459 line-height: 1.45; 460 border: #d6d6d6; 461 border-radius: 3px; 462 padding: 1em; 463 } 464 465 body pre code:before, body pre tt:before, body pre code:after, body pre tt:after { 466 content: normal; 467 } 468 469 body p, body blockquote, body ul, body ol, body dl, body pre { 470 margin-top: 0; 471 margin-bottom: 15px; 472 } 473 474 body kbd { 475 color: #000000; 476 border: 1px solid #d6d6d6; 477 border-bottom: 2px solid #c7c7c7; 478 padding: 2px 4px 0 0; 479 background-color: #f0f0f0; 480 border-radius: 3px; 481 } 482 483 @media print { 484 body { 485 background-color: #FFFFFF; 486 } 487 488 body pre { 489 page-break-inside: avoid; 490 } 491 492 body table { 493 display: table; 494 } 495 496 body h1, body h2, body h3 { 497 page-break-after: avoid; 498 color: #000000; 499 } 500 501 body blockquote { 502 color: #5c5c5c; 503 } 504 505 body pre, body code { 506 white-space: pre; 507 word-wrap: break-word; 508 } 509 510 body img { 511 display: block; 512 max-width: 100%; 513 max-height: 100%; 514 } 515 } 516 517 .md-preview { 518 box-sizing: border-box; 519 width: 100%; 520 height: 100%; 521 } 522 523 .md-preview pre.line-numbers { 524 position: relative; 525 padding-left: 4em; 526 counter-reset: linenumber; 527 } 528 529 .md-preview .pagebreak, .md-preview .newpage { 530 page-break-before: always; 531 } 532 533 .md-preview pre.line-numbers > code { 534 position: relative 535 } 536 537 .md-preview pre.line-numbers .figure-numbers-rows > span { 538 pointer-events: none; 539 display: block; 540 counter-increment: linenumber 541 } 542 543 .md-preview pre.line-numbers .figure-numbers-rows > span:before { 544 text-align: right; 545 content: counter(linenumber); 546 color: #999999; 547 display: block; 548 padding-right: 0.8em; 549 } 550 551 .md-preview pre.line-numbers .figure-numbers-rows { 552 position: absolute; 553 top: 1em; 554 left: 0; 555 width: 3em; 556 letter-spacing: -1px; 557 border-right: 1px solid #999999; 558 user-select: none; 559 -webkit-user-select: none; 560 -moz-user-select: none; 561 -ms-user-select: none; 562 pointer-events: none; 563 font-size: 100%; 564 } 565 566 .md-preview:not([for="preview"]) .code-chunk .btn-group { 567 display: none; 568 } 569 570 .md-preview:not([for="preview"]) .code-chunk .status { 571 display: none; 572 } 573 574 .md-preview:not([for="preview"]) .code-chunk .output-div { 575 margin-bottom: 16px; 576 } 577 578 .scrollbar-type::-webkit-scrollbar { 579 width: 8px; 580 } 581 582 .scrollbar-type::-webkit-scrollbar-thumb { 583 border-radius: 6px; 584 background-clip: content-box; 585 background-color: rgba(150, 150, 150, 0.66); 586 border: 4px solid rgba(150, 150, 150, 0.66); 587 } 588 589 .scrollbar-type::-webkit-scrollbar-track { 590 border-radius: 10px; 591 background-color: transparent; 592 } 593 594 body[for="native-export"]:not([data-display-mode]) .md-preview { 595 position: relative; 596 top: 0; 597 } 598 599 600 @media screen and (max-width: 450px) { 601 body[for="native-export"]:not([data-display-mode]) .md-preview { 602 font-size: 14px !important; 603 padding: 1em; 604 } 605 } 606 607 @media print { 608 body[for="native-export"]:not([data-display-mode]) #sidebarButton { 609 display: none; 610 } 611 } 612 613 @media screen and (min-width: 914px) { 614 body[for="native-export"]:not([data-display-mode]) .md-preview { 615 padding: 2em calc(50% - 457px + 2em); 616 } 617 } 618 619 @media screen and (max-width: 914px) { 620 body[for="native-export"]:not([data-display-mode]) .md-preview { 621 padding: 2em; 622 } 623 } 624 625 body[for="native-export"]:not([data-display-mode]) #sidebarButton { 626 position: fixed; 627 bottom: 8px; 628 left: 8px; 629 font-size: 28px; 630 cursor: pointer; 631 color: inherit; 632 text-align: center; 633 opacity: 0.4; 634 z-index: 99; 635 width: 32px; 636 } 637 638 body[for="native-export"]:not([data-display-mode])[sidebarToc] #sidebarButton { 639 opacity: 1; 640 } 641 642 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc { 643 position: fixed; 644 top: 0; 645 left: 0; 646 padding: 32px 0 48px 0; 647 width: 300px; 648 height: 100%; 649 font-size: 14px; 650 box-shadow: 0 0 4px rgba(150, 150, 150, 0.33); 651 box-sizing: border-box; 652 overflow: auto; 653 background-color: inherit; 654 } 655 656 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc::-webkit-scrollbar { 657 width: 8px; 658 } 659 660 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc::-webkit-scrollbar-track { 661 background-color: transparent; 662 border-radius: 10px; 663 } 664 665 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc::-webkit-scrollbar-thumb { 666 background-color: rgba(150, 150, 150, 0.66); 667 border-radius: 5px; 668 border: 4px solid rgba(150, 150, 150, 0.66); 669 background-clip: content-box; 670 } 671 672 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc a { 673 text-decoration: none; 674 } 675 676 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc li { 677 margin-bottom: .8em; 678 } 679 680 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc ul { 681 margin-top: 0.8em; 682 padding: 0 1.6em; 683 } 684 685 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc ul { 686 list-style-type: none; 687 } 688 689 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-preview { 690 padding: 2em calc(50% - 457px - 150px); 691 margin: 0; 692 box-sizing: border-box; 693 left: 300px; 694 width: calc(100% - 300px); 695 } 696 697 @media screen and (max-width: 450px) { 698 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-preview { 699 width: 100%; 700 } 701 } 702 703 @media screen and (max-width: 1274px) { 704 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-preview { 705 padding: 2em; 706 } 707 } 708 709 body[for="native-export"]:not([data-display-mode]):not([sidebarToc]) .md-preview { 710 transform: translateX(-50%); 711 left: 50%; 712 } 713 714 body[for="native-export"]:not([data-display-mode]):not([sidebarToc]) .md-sidebar-toc { 715 display: none; 716 } 717 718 </style> 719</head> 720<body for="native-export" id="body"> 721<div class="mume md-preview "> 722 <h1 class="mume-header fontColor">1.如何独立编译Trace_streamer</h1> 723 724 <p class="fontColor">尽管本工具(trace_streamer)是在ohos工具箱中的一员,但你依然可以独立编译此工具。</p> 725 <p class="fontColor">本工具可以编译linux, mac, windows, WebAssembly版本。</p> 726 <p class="fontColor">本工具默认编译方式是使用gn</p> 727 <ul class="fontColor"> 728 <li>编译方式</li> 729 </ul> 730 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor">third_party部分安装方式 731third_party相关控件下载链接:https://gitee.com/organizations/openharmony/projects 732在src路径下创建同级目录third_party。 733一、sqlite: 7341.打开上方链接,搜索sqlite。 7352.点击搜索结果进入下载界面,下载sqlite组件。 7363.把下载的文件解压后,文件夹命名为sqlite,并用代码路径中\prebuilts\buildsqlite\sqlite3build.gn文件替换sqlite目录中的BUILD.gn文件。 7374.把sqlite文件夹放入third_party目录中。 738二、protobuf: 7391.按上述下载方法,下载protobuf组件。 7402.把下载的文件解压后,文件夹命名为protobuf,并用代码路径中\prebuilts\buildprotobuf\protobufbuild.gn文件替换protobuf目录中的BUILD.gn文件。 7413.把protobuf文件夹放入third_party目录中。 742三、googletest: 7431.按上述下载方法,下载googletest相关组件。 7442.把下载的文件解压后,文件夹命名为googletest,并用代码路径中\prebuilts\buildgoogletest\googletestbuild.gn文件替换googletest目录中的BUILD.gn文件。 7453.把googletest文件夹放入third_party目录中。 7464.找到文件\googletest\include\gtest\internal\ gtest-port.h 把286行 #include <sstream> // NOLINT修改为 747#undef private 748#define private private 749#include <sstream> // NOLINT 750#undef private 751#define private public</code></pre> 752 753 <p class="fontColor">编译不同版本:linux, WebAssembly, mac</p> 754 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor">./build.sh linux/wasm/macx 755</code></pre> 756 757 <p class="fontColor">如果需要编译WebAssembly版本,您需要在prebuilts/目录下安装emsdk</p> 758 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor">git clone https://github.com/juj/emsdk.git --depth=1 759cd emsdk 760git pull 761./emsdk update # this may not work, ignore it 762./emsdk install latest 763./emsdk activate latest 764安装之后,您需要将upstream目录复制到prebuilts/emsdk/emsdk,node复制到prebuilts/emsdk/node 765</code></pre> 766 <p class="fontColor">安装之后,目录结构当如:</p> 767 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor">prebuilts/emsdk 768├── prebuilts/emsdk/emsdk 769│ ├── prebuilts/emsdk/emsdk/bin 770│ ├── prebuilts/emsdk/emsdk/emscripten 771│ │ ├── prebuilts/emsdk/emsdk/emscripten/cache 772│ │ ├── prebuilts/emsdk/emsdk/emscripten/cmake 773│ │ ├── prebuilts/emsdk/emsdk/emscripten/docs 774│ │ ├── prebuilts/emsdk/emsdk/emscripten/media 775│ │ ├── prebuilts/emsdk/emsdk/emscripten/node_modules 776│ │ ├── prebuilts/emsdk/emsdk/emscripten/__pycache__ 777│ │ ├── prebuilts/emsdk/emsdk/emscripten/src 778│ │ ├── prebuilts/emsdk/emsdk/emscripten/system 779│ │ ├── prebuilts/emsdk/emsdk/emscripten/tests 780│ │ ├── prebuilts/emsdk/emsdk/emscripten/third_party 781│ │ └── prebuilts/emsdk/emsdk/emscripten/tools 782│ ├── prebuilts/emsdk/emsdk/include 783│ │ └── prebuilts/emsdk/emsdk/include/c++ 784│ └── prebuilts/emsdk/emsdk/lib 785│ └── prebuilts/emsdk/emsdk/lib/clang 786└── prebuilts/emsdk/node 787 └── prebuilts/emsdk/node/14.18.2_64bit 788 ├── prebuilts/emsdk/node/14.18.2_64bit/bin 789 ├── prebuilts/emsdk/node/14.18.2_64bit/include 790 ├── prebuilts/emsdk/node/14.18.2_64bit/lib 791 └── prebuilts/emsdk/node/14.18.2_64bit/share 792</code></pre> 793 <p class="fontColor">之后调用</p> 794 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor">./build.sh wasm进行编译,您需要将sh脚本进行部分修改,因为这个脚本内置了一些库的下载和解析方式 795</code></pre> 796</div> 797<script type="text/javascript"> 798 window.onload = (() => { 799 let isDark = window.location.search; 800 if (isDark.indexOf("?") != -1) { 801 isDark = isDark.substr(1, isDark.length - 1); 802 } 803 if (isDark == 'true') { 804 document.getElementById("body").setAttribute('style', 'background-color:#272C34;') 805 let header = document.getElementsByClassName('fontColor') 806 for (let i = 0; i < header.length; i++) { 807 header[i].style.color = '#fff'; 808 } 809 let lightBackGround = document.getElementsByClassName('light') 810 for (let i = 0; i < lightBackGround.length; i++) { 811 lightBackGround[i].style.backgroundColor = '#32373F' 812 } 813 } 814 }) 815</script> 816</body> 817</html>