1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 2"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3 4<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> 5 <head> 6 <title>ReadMe for ICU 68.2</title> 7 <meta name="COPYRIGHT" content= 8 "Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html"/> 9 <!-- meta name="COPYRIGHT" content= 10 "Copyright (c) 1997-2016 IBM Corporation and others. All Rights Reserved." / --> 11 <meta name="KEYWORDS" content= 12 "ICU; International Components for Unicode; ICU4C; what's new; readme; read me; introduction; downloads; downloading; building; installation;" /> 13 <meta name="DESCRIPTION" content= 14 "The introduction to the International Components for Unicode with instructions on building, installation, usage and other information about ICU." /> 15 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 16 <link type="text/css" href="./icu4c.css" rel="stylesheet"/> 17 </head> 18 19<!-- 20 classes to use with the "body" - 21 draft - if the release note is itself a draft (May be combined with the other two) 22 rc - if the release note is a release candidate 23 milestone - if the release note is a milestone release 24--> 25 26 <body> 27 <!-- <body class="rc"> --> 28 <p class="only-draft"><b>Note:</b> This is a draft readme.</p> 29 30 <h1> 31 <span class="only-draft">DRAFT</span> 32 International Components for Unicode<br/> 33 <span class="only-rc">Release Candidate</span> 34 <!-- <span class="only-milestone">(Milestone Release)</span> --> 35 <span class="only-milestone">(Preview Release)</span> 36 <abbr title="International Components for Unicode">ICU</abbr> 68.2 ReadMe 37 </h1> 38 39 <!-- Most of the time we shouldn't need to comment/uncomment this paragraph, just change the body class --> 40 <!-- <p class="note only-milestone">This is a development milestone release of ICU 41 This milestone is intended for those wishing to get an early look at new features and API changes. 42 It is not recommended for production use.</p> --> 43 <p class="note only-milestone">This is a preview release of ICU. 44 It is not recommended for production use.</p> 45 46 <!-- Shouldn't need to comment/uncomment this paragraph, just change the body class --> 47 <p class="note only-rc">This is a release candidate version of ICU4C. 48 It is not recommended for production use.</p> 49 50 <p>Last updated: 2020-Dec-02<br/> 51 Copyright © 2016 and later: Unicode, Inc. and others. License & terms of use: 52 <a href="http://www.unicode.org/copyright.html">http://www.unicode.org/copyright.html</a><br/> 53 Copyright © 1997-2016 International Business Machines Corporation and others. 54 All Rights Reserved.</p> 55 <!-- Remember that there is a copyright at the end too --> 56 <hr/> 57 58 <h2 class="TOC">Table of Contents</h2> 59 60 <ul class="TOC"> 61 <li><a href="#Introduction">Introduction</a></li> 62 63 <li><a href="#GettingStarted">Getting Started</a></li> 64 65 <li><a href="#News">What Is New In This Release?</a></li> 66 67 <li><a href="#Download">How To Download the Source Code</a></li> 68 69 <li><a href="#SourceCode">ICU Source Code Organization</a></li> 70 71 <li> 72 <a href="#HowToBuild">How To Build And Install ICU</a> 73 74 <ul > 75 <li><a href="#RecBuild">Recommended Build Options</a></li> 76 77 <li><a href="#UserConfig">User-Configurable Settings</a></li> 78 79 <li><a href="#HowToBuildWindows">Windows</a></li> 80 81 <li><a href="#HowToBuildCygwin">Cygwin</a></li> 82 83 <li><a href="#HowToBuildUNIX">UNIX</a></li> 84 85 <li><a href="#HowToBuildZOS">z/OS (os/390)</a></li> 86 87 <li><a href="#HowToBuildOS400">IBM i family (IBM i, i5/OS, OS/400)</a></li> 88 89 <li><a href="#HowToCrossCompileICU">How to Cross Compile ICU</a></li> 90 </ul> 91 </li> 92 93 94 <li><a href="#HowToPackage">How To Package ICU</a></li> 95 96 <li> 97 <a href="#ImportantNotes">Important Notes About Using ICU</a> 98 99 <ul > 100 <li><a href="#ImportantNotesMultithreaded">Using ICU in a Multithreaded 101 Environment</a></li> 102 103 <li><a href="#ImportantNotesWindows">Windows Platform</a></li> 104 105 <li><a href="#ImportantNotesUNIX">UNIX Type Platforms</a></li> 106 </ul> 107 </li> 108 109 <li> 110 <a href="#PlatformDependencies">Platform Dependencies</a> 111 112 <ul > 113 <li><a href="#PlatformDependenciesNew">Porting To A New 114 Platform</a></li> 115 116 <li><a href="#PlatformDependenciesImpl">Platform Dependent 117 Implementations</a></li> 118 </ul> 119 </li> 120 </ul> 121 <hr /> 122 123 <h2><a name="Introduction" href="#Introduction" id= 124 "Introduction">Introduction</a></h2> 125 126 <p>Today's software market is a global one in which it is desirable to 127 develop and maintain one application (single source/single binary) that 128 supports a wide variety of languages. The International Components for 129 Unicode (ICU) libraries provide robust and full-featured Unicode services on 130 a wide variety of platforms to help this design goal. The ICU libraries 131 provide support for:</p> 132 133 <ul> 134 <li>The latest version of the Unicode standard</li> 135 136 <li>Character set conversions with support for over 220 codepages</li> 137 138 <li>Locale data for more than 300 locales</li> 139 140 <li>Language sensitive text collation (sorting) and searching based on the 141 Unicode Collation Algorithm (=ISO 14651)</li> 142 143 <li>Regular expression matching and Unicode sets</li> 144 145 <li>Transformations for normalization, upper/lowercase, script 146 transliterations (50+ pairs)</li> 147 148 <li>Resource bundles for storing and accessing localized information</li> 149 150 <li>Date/Number/Message formatting and parsing of culture specific 151 input/output formats</li> 152 153 <li>Calendar specific date and time manipulation</li> 154 155 <li>Text boundary analysis for finding characters, word and sentence 156 boundaries</li> 157 </ul> 158 159 <p>ICU has a sister project ICU4J that extends the internationalization 160 capabilities of Java to a level similar to ICU. The ICU C/C++ project is also 161 called ICU4C when a distinction is necessary.</p> 162 163 <h2><a name="GettingStarted" href="#GettingStarted" id= 164 "GettingStarted">Getting started</a></h2> 165 166 <p>This document describes how to build and install ICU on your machine. For 167 other information about ICU please see the following table of links.<br /> 168 The ICU homepage also links to related information about writing 169 internationalized software.</p> 170 171 <table class="docTable" summary="These are some useful links regarding ICU and internationalization in general."> 172 <caption> 173 Here are some useful links regarding ICU and internationalization in 174 general. 175 </caption> 176 177 <tr> 178 <td>ICU, ICU4C & ICU4J Homepage</td> 179 180 <td><a href= 181 "http://icu-project.org/">http://icu-project.org/</a></td> 182 </tr> 183 184 <tr> 185 <td>FAQ - Frequently Asked Questions about ICU</td> 186 187 <td><a href= 188 "https://unicode-org.github.io/icu/userguide/icufaq">https://unicode-org.github.io/icu/userguide/icufaq</a></td> 189 </tr> 190 191 <tr> 192 <td>ICU User's Guide</td> 193 194 <td><a href= 195 "https://unicode-org.github.io/icu/userguide/">https://unicode-org.github.io/icu/userguide/</a></td> 196 </tr> 197 198 <tr> 199 <td>How To Use ICU</td> 200 201 <td><a href= 202 "https://unicode-org.github.io/icu/userguide/howtouseicu">https://unicode-org.github.io/icu/userguide/howtouseicu</a></td> 203 </tr> 204 205 <tr> 206 <td>Download ICU Releases</td> 207 208 <td><a href= 209 "http://site.icu-project.org/download">http://site.icu-project.org/download</a></td> 210 </tr> 211 212 <tr> 213 <td>ICU4C API Documentation Online</td> 214 215 <td><a href= 216 "http://icu-project.org/apiref/icu4c/">http://icu-project.org/apiref/icu4c/</a></td> 217 </tr> 218 219 <tr> 220 <td>Online ICU Demos</td> 221 222 <td><a href= 223 "http://demo.icu-project.org/icu-bin/icudemos">http://demo.icu-project.org/icu-bin/icudemos</a></td> 224 </tr> 225 226 <tr> 227 <td>Contacts and Bug Reports/Feature Requests</td> 228 229 <td><a href= 230 "http://site.icu-project.org/contacts">http://site.icu-project.org/contacts</a></td> 231 </tr> 232 </table> 233 234 <p><strong>Important:</strong> Please make sure you understand the <a href= 235 "http://source.icu-project.org/repos/icu/trunk/icu4c/LICENSE">Copyright and License Information</a>.</p> 236 237 238 <h2><a name="News" href="#News" id="News">What Is New In This Release?</a></h2> 239 240 <p>See the <a href="http://site.icu-project.org/download/68">ICU 68 download page</a> 241 for more information on this release, including any other changes, bug fixes, known issues, 242 changes to supported platforms and build environments, 243 and migration issues for existing applications migrating from previous ICU releases.</p> 244 245 <p>See the <a href="APIChangeReport.html">API Change Report</a> for a complete list of 246 APIs added, removed, or changed in this release.</p> 247 248 <p><a name="RecentPreviousChanges" id="RecentPreviousChanges"></a>For 249 changes in previous releases, see the 250 main <a href="http://site.icu-project.org/download">ICU download page</a> 251 with its version-specific subpages.</p> 252 253 254 <h2><a name="Download" href="#Download" id="Download">How To Download the 255 Source Code</a></h2> 256 257 <p>There are two ways to download ICU releases:</p> 258 259 <ul> 260 <li><strong>Official Release Snapshot:</strong><br /> 261 If you want to use ICU (as opposed to developing it), you should download 262 an official packaged version of the ICU source code. These versions are 263 tested more thoroughly than day-to-day development builds of the system, 264 and they are packaged in zip and tar files for convenient download. These 265 packaged files can be found at <a href= 266 "http://site.icu-project.org/download">http://site.icu-project.org/download</a>.<br /> 267 The packaged snapshots are named <strong>icu-nnnn.zip</strong> or 268 <strong>icu-nnnn.tgz</strong>, where nnnn is the version number. The .zip 269 file is used for Windows platforms, while the .tgz file is preferred on 270 most other platforms.<br /> 271 Please unzip this file. </li> 272 273 <li><strong>GitHub Source Repository:</strong><br /> 274 If you are interested in developing features, patches, or bug fixes for 275 ICU, you should probably be working with the latest version of the ICU 276 source code. You will need to clone and checkout the code from our GitHub repository to 277 ensure that you have the most recent version of all of the files. See our 278 <a href="http://site.icu-project.org/repository">source 279 repository</a> for details.</li> 280 </ul> 281 282 <h2><a name="SourceCode" href="#SourceCode" id="SourceCode">ICU Source Code 283 Organization</a></h2> 284 285 <p>In the descriptions below, <strong><i><ICU></i></strong> is the full 286 path name of the ICU directory (the top level directory from the distribution 287 archives) in your file system. You can also view the <a href= 288 "https://unicode-org.github.io/icu/userguide/design">ICU Architectural 289 Design</a> section of the User's Guide to see which libraries you need for 290 your software product. You need at least the data (<code>[lib]icudt</code>) 291 and the common (<code>[lib]icuuc</code>) libraries in order to use ICU.</p> 292 293 <table class="docTable" summary="The following files describe the code drop."> 294 <caption> 295 The following files describe the code drop. 296 </caption> 297 298 <tr> 299 <th scope="col">File</th> 300 301 <th scope="col">Description</th> 302 </tr> 303 304 <tr> 305 <td>readme.html</td> 306 307 <td>Describes the International Components for Unicode (this file)</td> 308 </tr> 309 310 <tr> 311 <td>LICENSE</td> 312 313 <td>Contains the text of the ICU license</td> 314 </tr> 315 </table> 316 317 <p><br /> 318 </p> 319 320 <table class="docTable" summary= 321 "The following directories contain source code and data files."> 322 <caption> 323 The following directories contain source code and data files. 324 </caption> 325 326 <tr> 327 <th scope="col">Directory</th> 328 329 <th scope="col">Description</th> 330 </tr> 331 332 <tr> 333 <td><i><ICU></i>/source/<b>common</b>/</td> 334 335 <td>The core Unicode and support functionality, such as resource bundles, 336 character properties, locales, codepage conversion, normalization, 337 Unicode properties, Locale, and UnicodeString.</td> 338 </tr> 339 340 <tr> 341 <td><i><ICU></i>/source/<b>i18n</b>/</td> 342 343 <td>Modules in i18n are generally the more data-driven, that is to say 344 resource bundle driven, components. These deal with higher-level 345 internationalization issues such as formatting, collation, text break 346 analysis, and transliteration.</td> 347 </tr> 348 349 <tr> 350 <td><i><ICU></i>/source/<b>layoutex</b>/</td> 351 352 <td>Contains the ICU paragraph layout engine.</td> 353 </tr> 354 355 <tr> 356 <td><i><ICU></i>/source/<b>io</b>/</td> 357 358 <td>Contains the ICU I/O library.</td> 359 </tr> 360 361 <tr> 362 <td><i><ICU></i>/source/<b>data</b>/</td> 363 364 <td> 365 <p>This directory contains the source data in text format, which is 366 compiled into binary form during the ICU build process. It contains 367 several subdirectories, in which the data files are grouped by 368 function. Note that the build process must be run again after any 369 changes are made to this directory.</p> 370 371 <p>If some of the following directories are missing, it's probably 372 because you got an official download. If you need the data source files 373 for customization, then please download the complete ICU source code from <a 374 href="http://site.icu-project.org/repository">the ICU repository</a>.</p> 375 376 <ul> 377 <li><b>in/</b> A directory that contains a pre-built data library for 378 ICU. A standard source code package will contain this file without 379 several of the following directories. This is to simplify the build 380 process for the majority of users and to reduce platform porting 381 issues.</li> 382 383 <li><b>brkitr/</b> Data files for character, word, sentence, title 384 casing and line boundary analysis.</li> 385 386 <li><b>coll/</b> Data for collation tailorings. The makefile 387 <b>colfiles.mk</b> contains the list of resource bundle files.</li> 388 389 <li><b>locales/</b> These .txt files contain ICU language and 390 culture-specific localization data. Two special bundles are 391 <b>root</b>, which is the fallback data and parent of other bundles, 392 and <b>index</b>, which contains a list of installed bundles. The 393 makefile <b>resfiles.mk</b> contains the list of resource bundle 394 files. Some of the locale data is split out into the type-specific 395 directories curr, lang, region, unit, and zone, described below.</li> 396 397 <li><b>curr/</b> Locale data for currency symbols and names (including 398 plural forms), with its own makefile <b>resfiles.mk</b>.</li> 399 400 <li><b>lang/</b> Locale data for names of languages, scripts, and locale 401 key names and values, with its own makefile <b>resfiles.mk</b>.</li> 402 403 <li><b>region/</b> Locale data for names of regions, with its own 404 makefile <b>resfiles.mk</b>.</li> 405 406 <li><b>unit/</b> Locale data for measurement unit patterns and names, 407 with its own makefile <b>resfiles.mk</b>.</li> 408 409 <li><b>zone/</b> Locale data for time zone names, with its own 410 makefile <b>resfiles.mk</b>.</li> 411 412 <li><b>mappings/</b> Here are the code page converter tables. These 413 .ucm files contain mappings to and from Unicode. These are compiled 414 into .cnv files. <b>convrtrs.txt</b> is the alias mapping table from 415 various converter name formats to ICU internal format and vice versa. 416 It produces cnvalias.icu. The makefiles <b>ucmfiles.mk, 417 ucmcore.mk,</b> and <b>ucmebcdic.mk</b> contain the list of 418 converters to be built.</li> 419 420 <li><b>translit/</b> This directory contains transliterator rules as 421 resource bundles, a makefile <b>trnsfiles.mk</b> containing the list 422 of installed system translitaration files, and as well the special 423 bundle <b>translit_index</b> which lists the system transliterator 424 aliases.</li> 425 426 <li><b>unidata/</b> This directory contains the Unicode data files. 427 Please see <a href= 428 "http://www.unicode.org/">http://www.unicode.org/</a> for more 429 information.</li> 430 431 <li><b>misc/</b> The misc directory contains other data files which 432 did not fit into the above categories, including time zone 433 information, region-specific data, and other data derived from CLDR 434 supplemental data.</li> 435 436 <li><b>out/</b> This directory contains the assembled memory mapped 437 files.</li> 438 439 <li><b>out/build/</b> This directory contains intermediate (compiled) 440 files, such as .cnv, .res, etc.</li> 441 </ul> 442 443 <p>If you are creating a special ICU build, you can set the ICU_DATA 444 environment variable to the out/ or the out/build/ directories, but 445 this is generally discouraged because most people set it incorrectly. 446 You can view the <a href= 447 "https://unicode-org.github.io/icu/userguide/icudata">ICU Data 448 Management</a> section of the ICU User's Guide for details.</p> 449 </td> 450 </tr> 451 452 <tr> 453 <td><i><ICU></i>/source/test/<b>intltest</b>/</td> 454 455 <td>A test suite including all C++ APIs. For information about running 456 the test suite, see the build instructions specific to your platform 457 later in this document.</td> 458 </tr> 459 460 <tr> 461 <td><i><ICU></i>/source/test/<b>cintltst</b>/</td> 462 463 <td>A test suite written in C, including all C APIs. For information 464 about running the test suite, see the build instructions specific to your 465 platform later in this document.</td> 466 </tr> 467 468 <tr> 469 <td><i><ICU></i>/source/test/<b>iotest</b>/</td> 470 471 <td>A test suite written in C and C++ to test the icuio library. For 472 information about running the test suite, see the build instructions 473 specific to your platform later in this document.</td> 474 </tr> 475 476 <tr> 477 <td><i><ICU></i>/source/test/<b>testdata</b>/</td> 478 479 <td>Source text files for data, which are read by the tests. It contains 480 the subdirectories <b>out/build/</b> which is used for intermediate 481 files, and <b>out/</b> which contains <b>testdata.dat.</b></td> 482 </tr> 483 484 <tr> 485 <td><i><ICU></i>/source/<b>tools</b>/</td> 486 487 <td>Tools for generating the data files. Data files are generated by 488 invoking <i><ICU></i>/source/data/build/makedata.bat on Win32 or 489 <i><ICU></i>/source/make on UNIX.</td> 490 </tr> 491 492 <tr> 493 <td><i><ICU></i>/source/<b>samples</b>/</td> 494 495 <td>Various sample programs that use ICU</td> 496 </tr> 497 498 <tr> 499 <td><i><ICU></i>/source/<b>extra</b>/</td> 500 501 <td>Non-supported API additions. Currently, it contains the 'uconv' tool 502 to perform codepage conversion on files.</td> 503 </tr> 504 505 <tr> 506 <td><i><ICU></i>/<b>packaging</b>/</td> 507 508 <td>This directory contain scripts and tools for packaging the final 509 ICU build for various release platforms.</td> 510 </tr> 511 512 <tr> 513 <td><i><ICU></i>/source/<b>config</b>/</td> 514 515 <td>Contains helper makefiles for platform specific build commands. Used 516 by 'configure'.</td> 517 </tr> 518 519 <tr> 520 <td><i><ICU></i>/source/<b>allinone</b>/</td> 521 522 <td>Contains top-level ICU workspace and project files, for instance to 523 build all of ICU under one MSVC project.</td> 524 </tr> 525 526 <tr> 527 <td><i><ICU></i>/<b>include</b>/</td> 528 529 <td>Contains the headers needed for developing software that uses ICU on 530 Windows.</td> 531 </tr> 532 533 <tr> 534 <td><i><ICU></i>/<b>lib</b>/</td> 535 536 <td>Contains the import libraries for linking ICU into your Windows 537 application.</td> 538 </tr> 539 540 <tr> 541 <td><i><ICU></i>/<b>bin</b>/</td> 542 543 <td>Contains the libraries and executables for using ICU on Windows.</td> 544 </tr> 545 </table> 546 <!-- end of ICU structure ==================================== --> 547 548 <h2><a name="HowToBuild" href="#HowToBuild" id="HowToBuild">How To Build And 549 Install ICU</a></h2> 550 551 <h3><a name="RecBuild" href="#RecBuild" id= 552 "RecBuild">Recommended Build Options</a></h3> 553 554 <p>Depending on the platform and the type of installation, 555 we recommend a small number of modifications and build options. 556 Note that C99 compatibility is now required.</p> 557 <ul> 558 <li><b>Namespace (ICU 61 and later):</b> 559 Since ICU 61, call sites need to qualify ICU types explicitly, 560 for example <code>icu::UnicodeString</code>, 561 or do <code>using icu::UnicodeString;</code> where appropriate. 562 If your code relies on the "using namespace icu;" that used to be in unicode/uversion.h, 563 then you need to update your code.<br /> 564 You could temporarily (until you have more time to update your code) 565 revert to the default "using" 566 via <code>-DU_USING_ICU_NAMESPACE=1</code> 567 or by modifying unicode/uversion.h: 568<pre>Index: icu4c/source/common/unicode/uversion.h 569=================================================================== 570--- icu4c/source/common/unicode/uversion.h (revision 40704) 571+++ icu4c/source/common/unicode/uversion.h (working copy) 572@@ -127,7 +127,7 @@ 573 defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION) 574 # define U_USING_ICU_NAMESPACE 0 575 # else 576-# define U_USING_ICU_NAMESPACE 0 577+# define U_USING_ICU_NAMESPACE 1 578 # endif 579 # endif 580 # if U_USING_ICU_NAMESPACE 581</pre> 582 </li> 583 <li><b>Namespace (ICU 60 and earlier):</b> By default, unicode/uversion.h has 584 "using namespace icu;" which defeats much of the purpose of the namespace. 585 (This is for historical reasons: Originally, ICU4C did not use namespaces, 586 and some compilers did not support them. The default "using" statement 587 preserves source code compatibility.)<br /> 588 You should turn this off 589 via <code>-DU_USING_ICU_NAMESPACE=0</code> 590 or by modifying unicode/uversion.h: 591<pre>Index: source/common/unicode/uversion.h 592=================================================================== 593--- source/common/unicode/uversion.h (revision 26606) 594+++ source/common/unicode/uversion.h (working copy) 595@@ -180,7 +180,8 @@ 596 # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: 597 598 # ifndef U_USING_ICU_NAMESPACE 599-# define U_USING_ICU_NAMESPACE 1 600+ // Set to 0 to force namespace declarations in ICU usage. 601+# define U_USING_ICU_NAMESPACE 0 602 # endif 603 # if U_USING_ICU_NAMESPACE 604 U_NAMESPACE_USE 605</pre> 606 ICU call sites then either qualify ICU types explicitly, 607 for example <code>icu::UnicodeString</code>, 608 or do <code>using icu::UnicodeString;</code> where appropriate.</li> 609 <li><b>Hardcode the default charset to UTF-8:</b> On platforms where 610 the default charset is always UTF-8, 611 like MacOS X and some Linux distributions, 612 we recommend hardcoding ICU's default charset to UTF-8. 613 This means that some implementation code becomes simpler and faster, 614 and statically linked ICU libraries become smaller. 615 (See the <a href="http://icu-project.org/apiref/icu4c/platform_8h.html#a0a33e1edf3cd23d9e9c972b63c9f7943">U_CHARSET_IS_UTF8</a> 616 API documentation for more details.)<br /> 617 You can <code>-DU_CHARSET_IS_UTF8=1</code> or 618 modify unicode/utypes.h (in ICU 4.8 and below) 619 or modify unicode/platform.h (in ICU 49 and higher): 620<pre>Index: source/common/unicode/utypes.h 621=================================================================== 622--- source/common/unicode/utypes.h (revision 26606) 623+++ source/common/unicode/utypes.h (working copy) 624@@ -160,7 +160,7 @@ 625 * @see UCONFIG_NO_CONVERSION 626 */ 627 #ifndef U_CHARSET_IS_UTF8 628-# define U_CHARSET_IS_UTF8 0 629+# define U_CHARSET_IS_UTF8 1 630 #endif 631 632 /*===========================================================================*/ 633</pre></li> 634 <li><b>UnicodeString constructors:</b> The UnicodeString class has 635 several single-argument constructors that are not marked "explicit" 636 for historical reasons. 637 This can lead to inadvertent construction of a <code>UnicodeString</code> 638 with a single character by using an integer, 639 and it can lead to inadvertent dependency on the conversion framework 640 by using a C string literal.<br /> 641 Beginning with ICU 49, you should do the following: 642 <ul> 643 <li>Consider marking the from-<code>UChar</code> 644 and from-<code>UChar32</code> constructors explicit via 645 <code>-DUNISTR_FROM_CHAR_EXPLICIT=explicit</code> or similar.</li> 646 <li>Consider marking the from-<code>const char*</code> and 647 from-<code>const UChar*</code> constructors explicit via 648 <code>-DUNISTR_FROM_STRING_EXPLICIT=explicit</code> or similar.</li> 649 </ul> 650 Note: The ICU test suites cannot be compiled with these settings. 651 </li> 652 <li><b>utf.h, utf8.h, utf16.h, utf_old.h:</b> 653 By default, utypes.h (and thus almost every public ICU header) 654 includes all of these header files. 655 Often, none of them are needed, or only one or two of them. 656 All of utf_old.h is deprecated or obsolete.<br /> 657 Beginning with ICU 49, 658 you should define <code>U_NO_DEFAULT_INCLUDE_UTF_HEADERS</code> to 1 659 (via -D or uconfig.h, as above) 660 and include those header files explicitly that you actually need.<br /> 661 Note: The ICU test suites cannot be compiled with this setting.</li> 662 <li><b>utf_old.h:</b> 663 All of utf_old.h is deprecated or obsolete.<br /> 664 Beginning with ICU 60, 665 you should define <code>U_HIDE_OBSOLETE_UTF_OLD_H</code> to 1 666 (via -D or uconfig.h, as above). 667 Use of any of these macros should be replaced as noted 668 in the comments for the obsolete macro.<br /> 669 Note: The ICU test suites <i>can</i> be compiled with this setting.</li> 670 <li><b>.dat file:</b> By default, the ICU data is built into 671 a shared library (DLL). This is convenient because it requires no 672 install-time or runtime configuration, 673 but the library is platform-specific and cannot be modified. 674 A .dat package file makes the opposite trade-off: 675 Platform-portable (except for endianness and charset family, which 676 can be changed with the icupkg tool) 677 and modifiable (also with the icupkg tool). 678 If a path is set, then single data files (e.g., .res files) 679 can be copied to that location to provide new locale data 680 or conversion tables etc.<br /> 681 The only drawback with a .dat package file is that the application 682 needs to provide ICU with the file system path to the package file 683 (e.g., by calling <code>u_setDataDirectory()</code>) 684 or with a pointer to the data (<code>udata_setCommonData()</code>) 685 before other ICU API calls. 686 This is usually easy if ICU is used from an application where 687 <code>main()</code> takes care of such initialization. 688 It may be hard if ICU is shipped with 689 another shared library (such as the Xerces-C++ XML parser) 690 which does not control <code>main()</code>.<br /> 691 See the <a href="https://unicode-org.github.io/icu/userguide/icudata">User Guide ICU Data</a> 692 chapter for more details.<br /> 693 If possible, we recommend building the .dat package. 694 Specify <code>--with-data-packaging=archive</code> 695 on the configure command line, as in<br /> 696 <code>runConfigureICU Linux --with-data-packaging=archive</code><br /> 697 (Read the configure script's output for further instructions. 698 On Windows, the Visual Studio build generates both the .dat package 699 and the data DLL.)<br /> 700 Be sure to install and use the tiny stubdata library 701 rather than the large data DLL.</li> 702 <li><b>Static libraries:</b> It may make sense to build the ICU code 703 into static libraries (.a) rather than shared libraries (.so/.dll). 704 Static linking reduces the overall size of the binary by removing 705 code that is never called.<br /> 706 Example configure command line:<br /> 707 <code>runConfigureICU Linux --enable-static --disable-shared</code></li> 708 <li><b>Out-of-source build:</b> It is usually desirable to keep the ICU 709 source file tree clean and have build output files written to 710 a different location. This is called an "out-of-source build". 711 Simply invoke the configure script from the target location: 712<pre>~/icu$ git clone export https://github.com/unicode-org/icu.git 713~/icu$ mkdir icu4c-build 714~/icu$ cd icu4c-build 715~/icu/icu4c-build$ ../icu/icu4c/source/runConfigureICU Linux 716~/icu/icu4c-build$ make check</pre><br/> 717 (Note: this example shows a relative path to 718 <code>runConfigureICU</code>. If you experience difficulty, 719 try using an absolute path to <code>runConfigureICU</code> 720 instead.) 721 </li> 722 </ul> 723 <h4>ICU as a System-Level Library</h4> 724 <p>If ICU is installed as a system-level library, there are further 725 opportunities and restrictions to consider. 726 For details, see the <em>Using ICU as an Operating System Level Library</em> 727 section of the <a href="https://unicode-org.github.io/icu/userguide/design">User Guide ICU Architectural Design</a> chapter.</p> 728 <ul> 729 <li><b>Data path:</b> For a system-level library, it is best to load 730 ICU data from the .dat package file because the file system path 731 to the .dat package file can be hardcoded. ICU will automatically set 732 the path to the final install location using U_ICU_DATA_DEFAULT_DIR. 733 Alternatively, you can set <code>-DICU_DATA_DIR=/path/to/icu/data</code> 734 when building the ICU code. (Used by source/common/putil.c.)<br/> 735 Consider also setting <code>-DICU_NO_USER_DATA_OVERRIDE</code> 736 if you do not want the "ICU_DATA" environment variable to be used. 737 (An application can still override the data path via 738 <code>u_setDataDirectory()</code> or 739 <code>udata_setCommonData()</code>.</li> 740 <li><b>Hide draft API:</b> API marked with <code>@draft</code> 741 is new and not yet stable. Applications must not rely on unstable 742 APIs from a system-level library. 743 Define <code>U_HIDE_DRAFT_API</code>, <code>U_HIDE_INTERNAL_API</code> 744 and <code>U_HIDE_SYSTEM_API</code> 745 by modifying unicode/utypes.h before installing it.</li> 746 <li><b>Only C APIs:</b> Applications must not rely on C++ APIs from a 747 system-level library because binary C++ compatibility 748 across library and compiler versions is very hard to achieve. 749 Most ICU C++ APIs are in header files that contain a comment with 750 <code>\brief C++ API</code>. 751 Consider not installing these header files, or define <code>U_SHOW_CPLUSPLUS_API</code> 752 to be <code>0</code> by modifying unicode/utypes.h before installing it.</li> 753 <li><b>Disable renaming:</b> By default, ICU library entry point names 754 have an ICU version suffix. Turn this off for a system-level installation, 755 to enable upgrading ICU without breaking applications. For example:<br /> 756 <code>runConfigureICU Linux --disable-renaming</code><br /> 757 The public header files from this configuration must be installed 758 for applications to include and get the correct entry point names.</li> 759 </ul> 760 761 <h3><a name="UserConfig" href="#UserConfig" id="UserConfig">User-Configurable Settings</a></h3> 762 <p>ICU4C can be customized via a number of user-configurable settings. 763 Many of them are controlled by preprocessor macros which are 764 defined in the <code>source/common/unicode/uconfig.h</code> header file. 765 Some turn off parts of ICU, for example conversion or collation, 766 trading off a smaller library for reduced functionality. 767 Other settings are recommended (see previous section) 768 but their default values are set for better source code compatibility.</p> 769 770 <p>In order to change such user-configurable settings, you can 771 either modify the <code>uconfig.h</code> header file by adding 772 a specific <code>#define ...</code> for one or more of the macros 773 before they are first tested, 774 or set the compiler's preprocessor flags (<code>CPPFLAGS</code>) to include 775 an equivalent <code>-D</code> macro definition.</p> 776 777 <h3><a name="HowToBuildWindows" href="#HowToBuildWindows" id= 778 "HowToBuildWindows">How To Build And Install On Windows</a></h3> 779 780 <p>Building International Components for Unicode requires:</p> 781 782 <ul> 783 <li>Microsoft Windows</li> 784 785 <li>Microsoft Visual C++ (part of <a href="https://www.visualstudio.com/">Visual Studio</a>) (from either Visual Studio 2015 or Visual Studio 2017)</li> 786 787 <li><i><b>Optional:</b></i> A version of the <a href="https://developer.microsoft.com/windows/downloads">Windows 10 SDK</a> (if you want to build the UWP projects)</li> 788 </ul> 789 <p class="note"><a href="#HowToBuildCygwin">Cygwin</a> is required if using a version of MSVC other than the one 790 compatible with the supplied project files or if other compilers are used to build ICU. (e.g. GCC)</p> 791 792 <p>The steps are:</p> 793 794 <ol> 795 <li>Unzip the <tt>icu-XXXX.zip</tt> file into any convenient location.<br/> 796 <ul class="no-left-margin"> 797 <li>You can use the built-in zip functionality of Windows Explorer to do this. 798 Right-click on the .zip file and choose the "Extract All" option from the context menu. 799 This will open a new window where you can choose the output location to put the files.</li> 800 <li>Alternatively, you can use a 3<sup>rd</sup> party GUI tool like 7-Zip or WinZip to do this as well.</li> 801 </ul> 802 </li> 803 804 <li>Be sure that the ICU binary directory, (ex: <i><ICU></i><tt>\bin\</tt>), is 805 included in the <strong>PATH</strong> environment variable. The tests will 806 not work without the location of the ICU DLL files in the path. 807 Note that the binary directory name can depend on what architecture you select when you compile ICU. 808 For x86 or 32-bit builds, the binary directory is "<tt>bin</tt>". Whereas for x64 or 64-bit builds 809 the binary directory is "<tt>bin64</tt>". 810 </li> 811 812 <li>Open the "<i><ICU></i><tt>\source\allinone\allinone.sln</tt>" solution 813 file in 'Visual Studio 2017'. (This solution includes all the 814 International Components for Unicode libraries, necessary ICU building 815 tools, and the test suite projects). Please see the 816 <a href="#HowToBuildWindowsCommandLine">command line note below</a> if you want to 817 build from the command line instead.</li> 818 819 <li>If you are building using 'Visual Studio 2015' instead, or if you are building the UWP projects and you have a different 820 version of the Windows 10 SDK installed you will first need to modify the two "<tt>Build.Windows.*.props</tt>" files 821 in the "<tt>allinone</tt>" directory before you can open the "allinone" solution file. 822 Please see the notes below about <a href="#HowToUseOtherVSVersions">building with other versions of Visual Studio</a> and the 823 notes on <a href="#HowToRetargetTheWin10SDK">re-targeting the Windows 10 SDK for the UWP projects</a> for details. Alternatively, 824 you can <a href="#HowToSkipBuildingUWP">skip building the UWP projects</a> entirely as well. 825 </li> 826 827 <li>Set the active platform to "Win32" or "x64" (See <a href="#HowToBuildWindowsPlatform">Windows platform note</a> below) 828 and configuration to "Debug" or "Release" (See <a href="#HowToBuildWindowsConfig">Windows configuration note</a> below).</li> 829 830 <li>Choose the "Build" menu and select "Rebuild Solution". If you want to 831 build the Debug and Release at the same time, see the <a href= 832 "#HowToBuildWindowsBatch">batch configuration note</a> below.</li> 833 834 <li>Run the tests. They can be run from the command line or from within Visual Studio. 835 836 <h4>Running the Tests from the Windows Command Line (cmd)</h4> 837 <ul> 838 <li>The general syntax is:<br /> 839 <div class="indent"> 840 <tt><i><ICU></i>\source\allinone\icucheck.bat <i>Platform</i> <i>Configuration</i></tt> 841 </div> 842 </li> 843 <li>So, for example for x86 (32-bit) and Debug, use the following:<br /> 844 <samp><i><ICU></i>\source\allinone\icucheck.bat <b>x86</b> <b>Debug</b></samp> 845 For x86 (32-bit) and Release: 846 <samp><i><ICU></i>\source\allinone\icucheck.bat <b>x86</b> <b>Release</b></samp> 847 For x64 (64-bit) and Debug: 848 <samp><i><ICU></i>\source\allinone\icucheck.bat <b>x64</b> <b>Debug</b></samp> 849 For x64 (64-bit) and Release: 850 <samp><i><ICU></i>\source\allinone\icucheck.bat <b>x64</b> <b>Release</b></samp> 851 </li> 852 </ul> 853 854 <h4>Running the Tests from within Visual Studio</h4> 855 856 <ol> 857 <li>Run the C++ test suite, "<tt>intltest</tt>". To do this: set the active startup 858 project to "intltest", and press Ctrl+F5 to run it. Make sure that it 859 passes without any errors.</li> 860 861 <li>Run the C test suite, "<tt>cintltst</tt>". To do this: set the active startup 862 project to "cintltst", and press Ctrl+F5 to run it. Make sure that it 863 passes without any errors.</li> 864 865 <li>Run the I/O test suite, "<tt>iotest</tt>". To do this: set the active startup 866 project to "iotest", and press Ctrl+F5 to run it. Make sure that it passes 867 without any errors.</li> 868 </ol> 869 </li> 870 871 <li>You are now able to develop applications with ICU by using the 872 libraries and tools in <tt><i><ICU></i>\bin\</tt>. The headers are in 873 <tt><i><ICU></i>\include\</tt> and the link libraries are in 874 <tt><i><ICU></i>\lib\</tt>. To install the ICU runtime on a machine, or ship 875 it with your application, copy the needed components from 876 <tt><i><ICU></i>\bin\</tt> to a location on the system PATH or to your 877 application directory.</li> 878 </ol> 879 880 <p><a name="HowToUseOtherVSVersions" id="HowToUseOtherVSVersions"> 881 <strong>Building with other versions of Visual Studio Note:</strong></a> 882 The particular version of the MSVC compiler tool-set (and thus the corresponding version of Visual Studio) that 883 is used to compile ICU is determined by the "<tt>PlatformToolset</tt>" property. This property is stored in two 884 different shared files that are used to set common configuration settings amongst the various ICU "<tt>*.vcxproj</tt>" project files. 885 886 For the non-UWP projects, this setting is in the shared file called "<tt>Build.Windows.ProjectConfiguration.props</tt>" located 887 in the "allinone" directory. 888 889 For the UWP projects, this setting is in the shared file called "<tt>Build.Windows.UWP.ProjectConfiguration.props</tt>", also 890 located in the "allinone" directory. 891 <br/> 892 The value of <tt>v140</tt> corresponds to the Visual Studio 2015 compiler tool set, whereas the value of 893 <tt>v141</tt> corresponds to the Visual Studio 2017 compiler tool set. 894 895 <br/>In order to build the non-UWP projects with Visual Studio 2015 you will need to modify the file 896 called "<tt>Build.Windows.ProjectConfiguration.props</tt>" to change the value of the <tt>PlatformToolset</tt> property. 897 898 Note however that Visual Studio 2017 is required for building the UWP projects. 899 </p> 900 901 <p>Please consider: Using older versions of the MSVC compiler is generally not recommended due to the improved support for the C++11 standard 902 in newer versions of the compiler.</p> 903 904 <p><a name="HowToRetargetTheWin10SDK" id="HowToRetargetTheWin10SDK"> 905 <strong>Re-targeting the Windows 10 SDK for the UWP projects Note:</strong></a> 906 907 If the version of the Windows 10 SDK that you have installed does not match the version used by the UWP projects, then you 908 will need to "retarget" them to use the version of the SDK that you have installed instead. 909 910 There are two ways to do this: 911 <ul> 912 <li>In Visual Studio you can right-click on the UWP projects in the 'Solution Explorer' and select the 913 option 'Retarget Projects' from the context menu. This will open up a window where you can select the 914 SDK version to target from a drop-down list of the various SDKs that are installed on the machine.</li> 915 916 <li>Alternatively, you can manually edit the shared file called "<tt>Build.Windows.UWP.ProjectConfiguration.props</tt>" 917 which is located in the "allinone" directory. You will need to change the of the 918 "<tt>WindowsTargetPlatformVersion</tt>" property to the version of the SDK that you would like to use instead.</li> 919 </ul> 920 </p> 921 922 <p><a name="HowToBuildWindowsCommandLine" id= 923 "HowToBuildWindowsCommandLine"><strong>Using MSBUILD At The Command Line Note:</strong></a> 924 You can build ICU from the command line instead of using the Visual Studio GUI. 925 926 Assuming that you have properly installed Visual Studio to support command line building, you 927 should have a shortcut for the "Developer Command Prompt" listed in the Start Menu. 928 (For Visual Studio 2017 you will need to install the "Desktop development with C++" option).</p> 929 930 <ul> 931 <li>Open the "Developer Command Prompt" shortcut from the Start Menu. (This will open up a new command line window).</li> 932 <li>From within the "Developer Command Prompt" change directory (<tt>cd</tt>) to the ICU source directory.</li> 933 <li>You can then use either '<tt>msbuild</tt>' directly, or you can use the '<tt>devenv.com</tt>' command to build ICU.</li> 934 <li>Using <tt>MSBUILD</tt>:</li> 935 <ul class="no-left-margin"> 936 <li>To build the 32-bit Debug version, use the following command line:<br/> 937 <code>'msbuild source\allinone\allinone.sln /p:Configuration=Debug /p:Platform=Win32'</code>.</li> 938 <li>To build the 64-bit Release version, use the following command line:<br/> 939 <code>'msbuild source\allinone\allinone.sln /p:Configuration=Release /p:Platform=x64'</code>.</li> 940 </ul> 941 <li>Using <tt>devenv.com</tt>:</li> 942 <ul class="no-left-margin"> 943 <li>To build the 32-bit Debug version, use the following command line:<br/> 944 <code>'devenv.com source\allinone\allinone.sln /build "Debug|Win32"'</code>.</li> 945 <li>To build the 64-bit Release version, use the following command line:<br/> 946 <code>'devenv.com source\allinone\allinone.sln /build "Release|x64"'</code>.</li> 947 </ul> 948 </ul> 949 950 <p><a name="HowToSkipBuildingUWP" id= 951 "HowToSkipBuildingUWP"><strong>Skipping the UWP Projects on the Command Line Note:</strong></a> 952 You can skip (or omit) building the UWP projects on the command line by passing the argument 953 '<code>SkipUWP=true</code>' to either MSBUILD or devenv.</p> 954 955 <ul> 956 <li>For example, using <tt>MSBUILD</tt>:</li> 957 <ul class="no-left-margin"> 958 <li>To skip building the UWP projects with a 32-bit Debug build, use the following command line:<br/> 959 <code>'msbuild source\allinone\allinone.sln /p:Configuration=Debug /p:Platform=Win32 /p:SkipUWP=true'</code>.</li> 960 <li>To skip building the UWP projects with a 64-bit Release version, use the following command line:<br/> 961 <code>'msbuild source\allinone\allinone.sln /p:Configuration=Release /p:Platform=x64 /p:SkipUWP=true'</code>.</li> 962 </ul> 963 </ul> 964 965 <p>You can also use Cygwin with the MSVC compiler to build ICU, and you can refer to the <a href= 966 "#HowToBuildCygwin">How To Build And Install On Windows with Cygwin</a> 967 section for more details.</p> 968 969 <p><a name="HowToBuildWindowsPlatform" id= 970 "HowToBuildWindowsPlatform"><strong>Setting Active Platform 971 Note:</strong></a> Even though you are able to select "x64" as the active platform, if your operating system is 972 not a 64 bit version of Windows, the build will fail. To set the active platform, two different possibilities are:</p> 973 974 <ul> 975 <li>Choose "Build" menu, select "Configuration Manager...", and select 976 "Win32" or "x64" for the Active Platform Solution.</li> 977 978 <li>Another way is to select the desired build configuration from "Solution 979 Platforms" dropdown menu from the standard toolbar. It will say 980 "Win32" or "x64" in the dropdown list.</li> 981 </ul> 982 983 <p><a name="HowToBuildWindowsConfig" id= 984 "HowToBuildWindowsConfig"><strong>Setting Active Configuration 985 Note:</strong></a> To set the active configuration, two different 986 possibilities are:</p> 987 988 <ul> 989 <li>Choose "Build" menu, select "Configuration Manager...", and select 990 "Release" or "Debug" for the Active Configuration Solution.</li> 991 992 <li>Another way is to select the desired build configuration from "Solution 993 Configurations" dropdown menu from the standard toolbar. It will say 994 "Release" or "Debug" in the dropdown list.</li> 995 </ul> 996 997 <p><a name="HowToBuildWindowsBatch" id="HowToBuildWindowsBatch"><strong>Batch 998 Configuration Note:</strong></a> If you want to build the Win32 and x64 platforms and 999 Debug and Release configurations at the same time, choose "Build" menu, and select "Batch 1000 Build...". Click the "Select All" button, and then click the "Rebuild" 1001 button.</p> 1002 1003 <h3><a name="HowToBuildCygwin" href="#HowToBuildCygwin" id= 1004 "HowToBuildCygwin">How To Build And Install On Windows with Cygwin</a></h3> 1005 1006 <p>Building International Components for Unicode with this configuration 1007 requires:</p> 1008 1009 <ul> 1010 <li>Microsoft Windows</li> 1011 1012 <li>Microsoft Visual C++ (from Visual Studio 2015 or newer, when gcc isn't used).</li> 1013 1014 <li> 1015 Cygwin with the following installed: 1016 1017 <ul> 1018 <li>bash</li> 1019 1020 <li>GNU make</li> 1021 1022 <li>ar</li> 1023 1024 <li>ranlib</li> 1025 1026 <li>man (if you plan to look at the man pages)</li> 1027 </ul> 1028 </li> 1029 </ul> 1030 1031 <p>There are two ways you can build ICU with Cygwin. You can build with gcc 1032 or Microsoft Visual C++. If you use gcc, the resulting libraries and tools 1033 will depend on the Cygwin environment. If you use Microsoft Visual C++, the 1034 resulting libraries and tools do not depend on Cygwin and can be more easily 1035 distributed to other Windows computers (the generated man pages and shell 1036 scripts still need Cygwin). To build with gcc, please follow the "<a href= 1037 "#HowToBuildUNIX">How To Build And Install On UNIX</a>" instructions, while 1038 you are inside a Cygwin bash shell. To build with Microsoft Visual C++, 1039 please use the following instructions:</p> 1040 1041 <ol> 1042 <li>Start the Windows "Command Prompt" window. This is different from the 1043 gcc build, which requires the Cygwin Bash command prompt. The Microsoft 1044 Visual C++ compiler will not work with a bash command prompt.</li> 1045 1046 <li>If the computer isn't set up to use Visual C++ from the command line, 1047 you need to run vcvars32.bat.<br />For example:<br /> 1048 "<tt>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat</tt>" 1049 can be used for 32-bit builds <strong>or</strong> <br /> 1050 "<tt>C:\Program Files (x86)\Microsoft Visual Studio 14\VC\bin\x86_amd64\vcvarsx86_amd64.bat</tt>" 1051 can be used for 64-bit builds on Windows x64.</li> 1052 1053 <li>Unzip the icu-XXXX.zip file into any convenient location. Using command 1054 line zip, type "unzip -a icu-XXXX.zip -d drive:\directory", or just use 1055 WinZip.</li> 1056 1057 <li>Change directory to "icu/source", which is where you unzipped ICU.</li> 1058 1059 <li>Run "<tt>bash <a href="source/runConfigureICU">./runConfigureICU</a> 1060 Cygwin/MSVC</tt>" (See <a href="#HowToWindowsConfigureICU">Windows 1061 configuration note</a> and non-functional configure options below).</li> 1062 1063 <li>Type <tt>"make"</tt> to compile the libraries and all the data files. 1064 This make command should be GNU make.</li> 1065 1066 <li>Optionally, type <tt>"make check"</tt> to run the test suite, which 1067 checks for ICU's functionality integrity (See <a href= 1068 "#HowToTestWithoutGmake">testing note</a> below).</li> 1069 1070 <li>Type <tt>"make install"</tt> to install ICU. If you used the --prefix= 1071 option on configure or runConfigureICU, ICU will be installed to the 1072 directory you specified. (See <a href="#HowToInstallICU">installation 1073 note</a> below).</li> 1074 </ol> 1075 1076 <p><a name="HowToWindowsConfigureICU" id= 1077 "HowToWindowsConfigureICU"><strong>Configuring ICU on Windows 1078 NOTE:</strong></a> </p> 1079 <p> 1080 Ensure that the order of the PATH is MSVC, Cygwin, and then other PATHs. The configure 1081 script needs certain tools in Cygwin (e.g. grep). 1082 </p> 1083 <p> 1084 Also, you may need to run <tt>"dos2unix.exe"</tt> on all of the scripts (e.g. configure) 1085 in the top source directory of ICU. To avoid this issue, you can download 1086 the ICU source for Unix platforms (icu-xxx.tgz). 1087 </p> 1088 <p>In addition to the Unix <a href= 1089 "#HowToConfigureICU">configuration note</a> the following configure options 1090 currently do not work on Windows with Microsoft's compiler. Some options can 1091 work by manually editing <tt>icu/source/common/unicode/pwin32.h</tt>, but 1092 manually editing the files is not recommended.</p> 1093 1094 <ul> 1095 <li><tt>--disable-renaming</tt></li> 1096 1097 <li><tt>--enable-tracing</tt></li> 1098 1099 <li><tt>--enable-rpath</tt></li> 1100 1101 <li><tt>--enable-static</tt> (Requires that U_STATIC_IMPLEMENTATION be 1102 defined in user code that links against ICU's static libraries.)</li> 1103 1104 <li><tt>--with-data-packaging=files</tt> (The pkgdata tool currently does 1105 not work in this mode. Manual packaging is required to use this mode.)</li> 1106 </ul> 1107 1108 <h3><a name="HowToBuildUNIX" href="#HowToBuildUNIX" id="HowToBuildUNIX">How 1109 To Build And Install On UNIX</a></h3> 1110 1111 <p>Building International Components for Unicode on UNIX requires:</p> 1112 1113 <ul> 1114 <li>A C++ compiler installed on the target machine (for example: gcc, CC, 1115 xlC_r, aCC, cxx, etc...).</li> 1116 1117 <li>An ANSI C compiler installed on the target machine (for example: 1118 cc).</li> 1119 1120 <li>A recent version of GNU make (3.80+).</li> 1121 1122 <li>For a list of z/OS tools please view the <a href="#HowToBuildZOS">z/OS 1123 build section</a> of this document for further details.</li> 1124 </ul> 1125 1126 <p>Here are the steps to build ICU:</p> 1127 1128 <ol> 1129 <li>Decompress the icu-<i>X</i>.<i>Y</i>.tgz (or 1130 icu-<i>X</i>.<i>Y</i>.tar.gz) file. For example, <samp>gunzip -d < icu-<i>X</i>.<i>Y</i>.tgz | tar xvf -</samp></li> 1131 1132 <li>Change directory to <code>icu/source</code>. 1133 <samp>cd icu/source</samp> 1134 </li> 1135 1136 <li>Some files may have the wrong permissions.<samp>chmod +x runConfigureICU configure install-sh</samp></li> 1137 1138 <li>Run the <span style='font-family: monospace;'><a href="source/runConfigureICU">runConfigureICU</a></span> 1139 script for your platform. (See <a href="#HowToConfigureICU">configuration 1140 note</a> below).</li> 1141 1142 <li>Now build: <samp>gmake</samp> (or just <code>make</code> if GNU make is the default make on 1143 your platform) to compile the libraries and all the data files. The proper 1144 name of the GNU make command is printed at the end of the configuration 1145 run, as in <tt>"You must use gmake to compile ICU"</tt>. 1146 <br/> 1147 Note that the compilation command output may be simplified on your platform. If this is the case, you will see just: 1148 <tt>gcc ... stubdata.c</tt> 1149 rather than 1150 <tt>gcc -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -D_REENTRANT -I../common -DU_ATTRIBUTE_DEPRECATED= -O2 -Wall -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -c -DPIC -fPIC -o stubdata.o stubdata.c</tt> 1151 <br/> 1152 If you need to see the whole compilation line, use <span style='font-family: monospace;'>"gmake VERBOSE=1"</span>. The full compilation line will print if an error occurs. 1153 </li> 1154 1155 <li>Optionally,<samp>gmake check</samp> will run the test suite, which 1156 checks for ICU's functionality integrity (See <a href= 1157 "#HowToTestWithoutGmake">testing note</a> below).</li> 1158 1159 <li>To install, <samp>gmake install</samp> to install ICU. If you used the --prefix= 1160 option on configure or runConfigureICU, ICU will be installed to the 1161 directory you specified. (See <a href="#HowToInstallICU">installation 1162 note</a> below).</li> 1163 </ol> 1164 1165 <p><a name="HowToConfigureICU" id="HowToConfigureICU"><strong>Configuring ICU 1166 NOTE:</strong></a> Type <tt>"./runConfigureICU --help"</tt> for help on how 1167 to run it and a list of supported platforms. You may also want to type 1168 <tt>"./configure --help"</tt> to print the available configure options that 1169 you may want to give runConfigureICU. If you are not using the 1170 runConfigureICU script, or your platform is not supported by the script, you 1171 may need to set your CC, CXX, CFLAGS and CXXFLAGS environment variables, and 1172 type <tt>"./configure"</tt>. 1173 HP-UX users, please see this <a href="#ImportantNotesHPUX">note regarding 1174 HP-UX multithreaded build issues</a> with newer compilers. Solaris users, 1175 please see this <a href="#ImportantNotesSolaris">note regarding Solaris 1176 multithreaded build issues</a>.</p> 1177 1178 <p>ICU is built with strict compiler warnings enabled by default. If this 1179 causes excessive numbers of warnings on your platform, use the --disable-strict 1180 option to configure to reduce the warning level.</p> 1181 1182 <p><a name="HowToTestWithoutGmake" id="HowToTestWithoutGmake"><strong>Running 1183 The Tests From The Command Line NOTE:</strong></a> You may have to set 1184 certain variables if you with to run test programs individually, that is 1185 apart from "gmake check". The environment variable <strong>ICU_DATA</strong> 1186 can be set to the full pathname of the data directory to indicate where the 1187 locale data files and conversion mapping tables are when you are not using 1188 the shared library (e.g. by using the .dat archive or the individual data 1189 files). The trailing "/" is required after the directory name (e.g. 1190 "$Root/source/data/out/" will work, but the value "$Root/source/data/out" is 1191 not acceptable). You do not need to set <strong>ICU_DATA</strong> if the 1192 complete shared data library is in your library path.</p> 1193 1194 <p><a name="HowToInstallICU" id="HowToInstallICU"><strong>Installing ICU 1195 NOTE:</strong></a> Some platforms use package management tools to control the 1196 installation and uninstallation of files on the system, as well as the 1197 integrity of the system configuration. You may want to check if ICU can be 1198 packaged for your package management tools by looking into the "packaging" 1199 directory. (Please note that if you are using a snapshot of ICU from Git, it 1200 is probable that the packaging scripts or related files are not up to date 1201 with the contents of ICU at this time, so use them with caution).</p> 1202 1203 <h3><a name="HowToBuildZOS" href="#HowToBuildZOS" id="HowToBuildZOS">How To 1204 Build And Install On z/OS (OS/390)</a></h3> 1205 1206 <p>You can install ICU on z/OS or OS/390 (the previous name of z/OS), but IBM 1207 tests only the z/OS installation. You install ICU in a z/OS UNIX system 1208 services file system such as HFS or zFS. On this platform, it is important 1209 that you understand a few details:</p> 1210 1211 <ul> 1212 <li>The makedep and GNU make tools are required for building ICU. If it 1213 is not already installed on your system, it is available at the <a href= 1214 "http://www-03.ibm.com/servers/eserver/zseries/zos/unix/bpxa1toy.html">z/OS UNIX - 1215 Tools and Toys</a> site. The PATH environment variable should be updated to 1216 contain the location of this executable prior to build. Failure to add these 1217 tools to your PATH will cause ICU build failures or cause pkgdata to fail 1218 to run.</li> 1219 1220 <li>Since USS does not support using the mmap() function over NFS, it is 1221 recommended that you build ICU on a local filesystem. Once ICU has been 1222 built, you should not have this problem while using ICU when the data 1223 library has been built as a shared library, which is this is the default 1224 setting.</li> 1225 1226 <li>Encoding considerations: The source code assumes that it is compiled 1227 with codepage ibm-1047 (to be exact, the UNIX System Services variant of 1228 it). The pax command converts all of the source code files from ASCII to 1229 codepage ibm-1047 (USS) EBCDIC. However, some files are binary files and 1230 must not be converted, or must be converted back to their original state. 1231 You can use the <a href="as_is/os390/unpax-icu.sh">unpax-icu.sh</a> script 1232 to do this for you automatically. It will unpackage the tar file and 1233 convert all the necessary files for you automatically.</li> 1234 1235 <li>z/OS supports both native S/390 hexadecimal floating point and (with 1236 OS/390 2.6 and later) IEEE 754 binary floating point. This is a compile 1237 time option. Applications built with IEEE should use ICU DLLs that are 1238 built with IEEE (and vice versa). The environment variable IEEE390=0 will 1239 cause the z/OS version of ICU to be built without IEEE floating point 1240 support and use the native hexadecimal floating point. By default ICU is 1241 built with IEEE 754 support. Native floating point support is sufficient 1242 for codepage conversion, resource bundle and UnicodeString operations, but 1243 the Format APIs require IEEE binary floating point.</li> 1244 1245 <li>z/OS introduced the concept of Extra Performance Linkage (XPLINK) to 1246 bring performance improvement opportunities to call-intensive C and C++ 1247 applications such as ICU. XPLINK is enabled on a DLL-by-DLL basis, so if 1248 you are considering using XPLINK in your application that uses ICU, you 1249 should consider building the XPLINK-enabled version of ICU. You need to 1250 set ICU's environment variable <code>OS390_XPLINK=1</code> prior to 1251 invoking the make process to produce binaries that are enabled for 1252 XPLINK. The XPLINK option, which is available for z/OS 1.2 and later, 1253 requires the PTF PQ69418 to build XPLINK enabled binaries.</li> 1254 1255 <li>ICU requires XPLINK for the icuio library. If you want to use the 1256 rest of ICU without XPLINK, then you must use the --disable-icuio 1257 configure option.</li> 1258 1259 <li>The latest versions of z/OS use <a 1260 href="https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.cbcux01/oebind6.htm">XPLINK 1261 version (C128) of the C++ standard library</a> by default. You may see <a 1262 href="https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.cbcux01/oebind5.htm">an 1263 error</a> when running with XPLINK disabled. To avoid this error, 1264 set the following environment variable or similar: 1265 1266<pre><samp>export _CXX_PSYSIX="CEE.SCEELIB(C128N)":"CBC.SCLBSID(IOSTREAM,COMPLEX)"</samp></pre> 1267 </li> 1268 1269 <li>When building ICU data, the heap size may need to be increased with the following 1270 environment variable: 1271 1272<pre><samp>export _CEE_RUNOPTS="HEAPPOOLS(ON),HEAP(4M,1M,ANY,FREE,0K,4080)"</samp></pre> 1273 </li> 1274 1275 1276 <li>The rest of the instructions for building and testing ICU on z/OS with 1277 UNIX System Services are the same as the <a href="#HowToBuildUNIX">How To 1278 Build And Install On UNIX</a> section.</li> 1279 </ul> 1280 1281 <h4>z/OS (Batch/PDS) support outside the UNIX system services 1282 environment</h4> 1283 1284 <p>By default, ICU builds its libraries into the UNIX file system (HFS). In 1285 addition, there is a z/OS specific environment variable (OS390BATCH) to build 1286 some libraries into the z/OS native file system. This is useful, for example, 1287 when your application is externalized via Job Control Language (JCL).</p> 1288 1289 <p>The OS390BATCH environment variable enables non-UNIX support including the 1290 batch environment. When OS390BATCH is set, the libicui18n<i>XX</i>.dll, 1291 libicuuc<i>XX</i>.dll, and libicudt<i>XX</i>e.dll binaries are built into 1292 data sets (the native file system). Turning on OS390BATCH does not turn off 1293 the normal z/OS UNIX build. This means that the z/OS UNIX (HFS) DLLs will 1294 always be created.</p> 1295 1296 <p>Two additional environment variables indicate the names of the z/OS data 1297 sets to use. The LOADMOD environment variable identifies the name of the data 1298 set that contains the dynamic link libraries (DLLs) and the LOADEXP 1299 environment variable identifies the name of the data set that contains the 1300 side decks, which are normally the files with the .x suffix in the UNIX file 1301 system.</p> 1302 1303 <p>A data set is roughly equivalent to a UNIX or Windows file. For most kinds 1304 of data sets the operating system maintains record boundaries. UNIX and 1305 Windows files are byte streams. Two kinds of data sets are PDS and PDSE. Each 1306 data set of these two types contains a directory. It is like a UNIX 1307 directory. Each "file" is called a "member". Each member name is limited to 1308 eight bytes, normally EBCDIC.</p> 1309 1310 <p>Here is an example of some environment variables that you can set prior to 1311 building ICU:</p> 1312<pre> 1313<samp>OS390BATCH=1 1314LOADMOD=<i>USER</i>.ICU.LOAD 1315LOADEXP=<i>USER</i>.ICU.EXP</samp> 1316</pre> 1317 1318 <p>The PDS member names for the DLL file names are as follows:</p> 1319<pre> 1320<samp>IXMI<i>XX</i>IN --> libicui18n<i>XX</i>.dll 1321IXMI<i>XX</i>UC --> libicuuc<i>XX</i>.dll 1322IXMI<i>XX</i>DA --> libicudt<i>XX</i>e.dll</samp> 1323</pre> 1324 1325 <p>You should point the LOADMOD environment variable at a partitioned data 1326 set extended (PDSE) and point the LOADEXP environment variable at a 1327 partitioned data set (PDS). The PDSE can be allocated with the following 1328 attributes:</p> 1329<pre> 1330<samp>Data Set Name . . . : <i>USER</i>.ICU.LOAD 1331Management class. . : <i>**None**</i> 1332Storage class . . . : <i>BASE</i> 1333Volume serial . . . : <i>TSO007</i> 1334Device type . . . . : <i>3390</i> 1335Data class. . . . . : <i>LOAD</i> 1336Organization . . . : PO 1337Record format . . . : U 1338Record length . . . : 0 1339Block size . . . . : <i>32760</i> 13401st extent cylinders: 1 1341Secondary cylinders : 5 1342Data set name type : LIBRARY</samp> 1343</pre> 1344 1345 <p>The PDS can be allocated with the following attributes:</p> 1346<pre> 1347<samp>Data Set Name . . . : <i>USER</i>.ICU.EXP 1348Management class. . : <i>**None**</i> 1349Storage class . . . : <i>BASE</i> 1350Volume serial . . . : <i>TSO007</i> 1351Device type . . . . : <i>3390</i> 1352Data class. . . . . : <i>**None**</i> 1353Organization . . . : PO 1354Record format . . . : FB 1355Record length . . . : 80 1356Block size . . . . : <i>3200</i> 13571st extent cylinders: 3 1358Secondary cylinders : 3 1359Data set name type : PDS</samp> 1360</pre> 1361 1362 <h3><a name="HowToBuildOS400" href="#HowToBuildOS400" id= 1363 "HowToBuildOS400">How To Build And Install On The IBM i Family (IBM i, i5/OS OS/400)</a></h3> 1364 1365 <p>Before you start building ICU, ICU requires the following:</p> 1366 1367 <ul> 1368 <li>QSHELL interpreter installed (install base option 30, operating system) 1369 <!--li>QShell Utilities, PRPQ 5799-XEH (not required for V4R5)</li--></li> 1370 1371 <li>ILE C/C++ Compiler installed on the system</li> 1372 1373 <li>The latest IBM tools for Developers for IBM i — 1374 <a href='https://www-356.ibm.com/partnerworld/wps/servlet/ContentHandler/pw_com_porting_tools_index'>https://www-356.ibm.com/partnerworld/wps/servlet/ContentHandler/pw_com_porting_tools_index</a> 1375 <!-- formerly http://www.ibm.com/servers/enable/site/porting/tools/'>http://www.ibm.com/servers/enable/site/porting/tools/</a> --> 1376 <!-- formerly: http://www.ibm.com/servers/enable/site/porting/iseries/overview/gnu_utilities.html --> 1377 </li> 1378 </ul> 1379 1380 <p>The following describes how to setup and build ICU. For background 1381 information, you should look at the <a href="#HowToBuildUNIX">UNIX build 1382 instructions</a>.</p> 1383 1384 <ol> 1385 <li> 1386 Copy the ICU source .tgz to the IBM i environment, as binary. 1387 Also, copy the <a href='as_is/os400/unpax-icu.sh'>unpax-icu.sh</a> script into the same directory, as a text file. 1388 </li> 1389 1390 <li> 1391 Create target library. This library will be the target for the 1392 resulting modules, programs and service programs. You will specify this 1393 library on the OUTPUTDIR environment variable. 1394<pre> 1395<samp>CRTLIB LIB(<i>libraryname</i>) 1396ADDENVVAR ENVVAR(OUTPUTDIR) VALUE('<i>libraryname</i>') REPLACE(*YES) </samp></pre> 1397 </li> 1398 1399 <li> 1400 Set up the following environment variables and job characteristics in your build process 1401<pre> 1402<samp>ADDENVVAR ENVVAR(MAKE) VALUE('gmake') REPLACE(*YES) 1403CHGJOB CCSID(37)</samp></pre></li> 1404 1405 <li>Fire up the QSH <i>(all subsequent commands are run inside the qsh session.)</i> 1406 <pre><samp>qsh</samp></pre> 1407 </li> 1408 1409 <li>Set up the PATH: <pre><samp>export PATH=/QIBM/ProdData/DeveloperTools/qsh/bin:$PATH:/QOpenSys/usr/bin</samp></pre> 1410 </li> 1411 1412 <li>Unpack the ICU source code archive: 1413 <pre><samp>gzip -d icu-<i>X</i>.<i>Y</i>.tgz</samp></pre> 1414 </li> 1415 1416 <li>Run unpax-icu.sh on the tar file generated from the previous step. 1417 <pre><samp>unpax-icu.sh icu.tar</samp></pre></li> 1418 1419 <li>Build the program ICULD which ICU will use for linkage. 1420 <pre><samp>cd icu/as_is/os400 1421qsh bldiculd.sh 1422cd ../../..</samp></pre> 1423 </li> 1424 1425 <li>Change into the 'source' directory, and configure ICU. (See <a href="#HowToConfigureICU">configuration 1426 note</a> for details). Note that --with-data-packaging=archive and setting the --prefix are recommended, building in default (dll) mode is currently not supported. 1427 <pre><samp>cd icu/source 1428./runConfigureICU IBMi --prefix=<i>/path/to/somewhere</i> --with-data-packaging=archive</samp></pre> 1429</li> 1430 1431 <li>Build ICU. <i>(Note: Do not use the -j option)</i> <pre><samp>gmake</samp></pre></li> 1432 1433 <li>Test ICU. <pre><samp>gmake check</samp></pre> 1434 (The <tt> QIBM_MULTI_THREADED=Y</tt> flag will be automatically applied to intltest - 1435 you can look at the <a href= 1436 "https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzahw/rzahwceeco.htm"> 1437 iSeries Information Center</a> for more details regarding the running of multiple threads 1438 on IBM i.)</li> 1439 </ol> 1440 1441 <!-- cross --> 1442 <h3><a name="HowToCrossCompileICU" href="#HowToCrossCompileICU" id="HowToCrossCompileICU">How To Cross Compile ICU</a></h3> 1443 <p>This section will explain how to build ICU on one platform, but to produce binaries intended to run on another. This is commonly known as a cross compile.</p> 1444 <p>Normally, in the course of a build, ICU needs to run the tools that it builds in order to generate and package data and test-data.In a cross compilation setting, ICU is built on a different system from that which it eventually runs on. An example might be, if you are building for a small/headless system (such as an embedded device), or a system where you can't easily run the ICU command line tools (any non-UNIX-like system).</p> 1445 <p>To reduce confusion, we will here refer to the "A" and the "B" system.System "A" is the actual system we will be running on- the only requirements on it is are it is able to build ICU from the command line targetting itself (with configure or runConfigureICU), and secondly, that it also contain the correct toolchain for compiling and linking for the resultant platform, referred to as the "B" system.</p> 1446 <p>The autoconf docs use the term "build" for A, and "host" for B. More details at: <a href="http://www.gnu.org/software/autoconf/manual/html_node/Specifying-Names.html#Specifying-Names">http://www.gnu.org/software/autoconf/manual/html_node/Specifying-Names.html</a></p> 1447 <p>Three initially-empty directories will be used in this example:</p> 1448 <table summary="Three directories used in this example" class="docTable"> 1449 <tr> 1450 <th align="left">/icu</th><td>a copy of the ICU source</td> 1451 </tr> 1452 <tr> 1453 <th align="left">/buildA</th><td>an empty directory, it will contain ICU built for A<br />(MacOSX in this case)</td> 1454 </tr> 1455 <tr> 1456 <th align="left">/buildB</th><td>an empty directory, it will contain ICU built for B<br />(HaikuOS in this case)</td> 1457 </tr> 1458 </table> 1459 1460 <ol> 1461 <li>Check out or unpack the ICU source code into the /icu directory.You will have the directories /icu/source, etc.</li> 1462 <li>Build ICU in /buildA normally (using runConfigureICU or configure): 1463<pre class="samp">cd /buildA 1464sh /icu/source/runConfigureICU <strong>MacOSX</strong> 1465gnumake 1466</pre> 1467 </li> 1468 <li>Set PATH or other variables as needed, such as CPPFLAGS.</li> 1469 <li>Build ICU in /buildB<br /> 1470 <p class="note">"<code>--with-cross-build</code>" takes an absolute path.</p> 1471<pre class="samp">cd /buildB 1472sh /icu/source/configure --host=<strong>i586-pc-haiku</strong> --with-cross-build=<strong>/buildA</strong> 1473gnumake</pre> 1474 </li> 1475 <li>Tests and testdata can be built with "gnumake tests".</li> 1476 </ol> 1477 <!-- end cross --> 1478 1479 <!-- end build environment --> 1480 1481 <h2><a name="HowToPackage" href="#HowToPackage" id="HowToPackage">How To 1482 Package ICU</a></h2> 1483 1484 <p>There are many ways that a person can package ICU with their software 1485 products. Usually only the libraries need to be considered for packaging.</p> 1486 1487 <p>On UNIX, you should use "<tt>gmake install</tt>" to make it easier to 1488 develop and package ICU. The bin, lib and include directories are needed to 1489 develop applications that use ICU. These directories will be created relative 1490 to the "<tt>--prefix=</tt><i>dir</i>" configure option (See the <a href= 1491 "#HowToBuildUNIX">UNIX build instructions</a>). When ICU is built on Windows, 1492 a similar directory structure is built.</p> 1493 1494 <p>When changes have been made to the standard ICU distribution, it is 1495 recommended that at least one of the following guidelines be followed for 1496 special packaging.</p> 1497 1498 <ol> 1499 <li>Add a suffix name to the library names. This can be done with the 1500 --with-library-suffix configure option.</li> 1501 1502 <li>The installation script should install the ICU libraries into the 1503 application's directory.</li> 1504 </ol> 1505 1506 <p>Following these guidelines prevents other applications that use a standard 1507 ICU distribution from conflicting with any libraries that you need. On 1508 operating systems that do not have a standard C++ ABI (name mangling) for 1509 compilers, it is recommended to do this special packaging anyway. More 1510 details on customizing ICU are available in the <a href= 1511 "https://unicode-org.github.io/icu/userguide/">User's Guide</a>. The <a href= 1512 "#SourceCode">ICU Source Code Organization</a> section of this readme.html 1513 gives a more complete description of the libraries.</p> 1514 1515 <table class="docTable" summary= 1516 "ICU has several libraries for you to use."> 1517 <caption> 1518 Here is an example of libraries that are frequently packaged. 1519 </caption> 1520 1521 <tr> 1522 <th scope="col">Library Name</th> 1523 1524 <th scope="col">Windows Filename</th> 1525 1526 <th scope="col">Linux Filename</th> 1527 1528 <th scope="col">Comment</th> 1529 </tr> 1530 1531 <tr> 1532 <td>Data Library</td> 1533 1534 <td>icudt<i>XY</i>l.dll</td> 1535 1536 <td>libicudata.so.<i>XY</i>.<i>Z</i></td> 1537 1538 <td>Data required by the Common and I18n libraries. There are many ways 1539 to package and <a href= 1540 "https://unicode-org.github.io/icu/userguide/icudata">customize this 1541 data</a>, but by default this is all you need.</td> 1542 </tr> 1543 1544 <tr> 1545 <td>Common Library</td> 1546 1547 <td>icuuc<i>XY</i>.dll</td> 1548 1549 <td>libicuuc.so.<i>XY</i>.<i>Z</i></td> 1550 1551 <td>Base library required by all other ICU libraries.</td> 1552 </tr> 1553 1554 <tr> 1555 <td>Internationalization (i18n) Library</td> 1556 1557 <td>icuin<i>XY</i>.dll</td> 1558 1559 <td>libicui18n.so.<i>XY</i>.<i>Z</i></td> 1560 1561 <td>A library that contains many locale based internationalization (i18n) 1562 functions.</td> 1563 </tr> 1564 1565 <tr> 1566 <td>Layout Extensions Engine</td> 1567 1568 <td>iculx<i>XY</i>.dll</td> 1569 1570 <td>libiculx.so.<i>XY</i>.<i>Z</i></td> 1571 1572 <td>An optional engine for doing paragraph layout that uses 1573 parts of ICU. 1574 HarfBuzz is required.</td> 1575 </tr> 1576 1577 <tr> 1578 <td>ICU I/O (Unicode stdio) Library</td> 1579 1580 <td>icuio<i>XY</i>.dll</td> 1581 1582 <td>libicuio.so.<i>XY</i>.<i>Z</i></td> 1583 1584 <td>An optional library that provides a stdio like API with Unicode 1585 support.</td> 1586 </tr> 1587 1588 <tr> 1589 <td>Tool Utility Library</td> 1590 1591 <td>icutu<i>XY</i>.dll</td> 1592 1593 <td>libicutu.so.<i>XY</i>.<i>Z</i></td> 1594 1595 <td>An internal library that contains internal APIs that are only used by 1596 ICU's tools. If you do not use ICU's tools, you do not need this 1597 library.</td> 1598 </tr> 1599 </table> 1600 1601 <p>Normally only the above ICU libraries need to be considered for packaging. 1602 The versionless symbolic links to these libraries are only needed for easier 1603 development. The <i>X</i>, <i>Y</i> and <i>Z</i> parts of the name are the 1604 version numbers of ICU. For example, ICU 2.0.2 would have the name 1605 libicuuc.so.20.2 for the common library. The exact format of the library 1606 names can vary between platforms due to how each platform can handles library 1607 versioning.</p> 1608 1609 <h2><a name="ImportantNotes" href="#ImportantNotes" id= 1610 "ImportantNotes">Important Notes About Using ICU</a></h2> 1611 1612 <h3><a name="ImportantNotesMultithreaded" href="#ImportantNotesMultithreaded" 1613 id="ImportantNotesMultithreaded">Using ICU in a Multithreaded 1614 Environment</a></h3> 1615 1616 <p>Some versions of ICU require calling the <code>u_init()</code> function 1617 from <code>uclean.h</code> to ensure that ICU is initialized properly. In 1618 those ICU versions, <code>u_init()</code> must be called before ICU is used 1619 from multiple threads. There is no harm in calling <code>u_init()</code> in a 1620 single-threaded application, on a single-CPU machine, or in other cases where 1621 <code>u_init()</code> is not required.</p> 1622 1623 <p>In addition to ensuring thread safety, <code>u_init()</code> also attempts 1624 to load at least one ICU data file. Assuming that all data files are packaged 1625 together (or are in the same folder in files mode), a failure code from 1626 <code>u_init()</code> usually means that the data cannot be found. In this 1627 case, the data may not be installed properly, or the application may have 1628 failed to call <code>udata_setCommonData()</code> or 1629 <code>u_setDataDirectory()</code> which specify to ICU where it can find its 1630 data.</p> 1631 1632 <p>Since <code>u_init()</code> will load only one or two data files, it 1633 cannot guarantee that all of the data that an application needs is available. 1634 It cannot check for all data files because the set of files is customizable, 1635 and some ICU services work without loading any data at all. An application 1636 should always check for error codes when opening ICU service objects (using 1637 <code>ucnv_open()</code>, <code>ucol_open()</code>, C++ constructors, 1638 etc.).</p> 1639 1640 <h4>ICU 3.4 and later</h4> 1641 1642 <p>ICU 3.4 self-initializes properly for multi-threaded use. It achieves this 1643 without performance penalty by hardcoding the core Unicode properties data, 1644 at the cost of some flexibility. (For details see Jitterbug 4497.)</p> 1645 1646 <p><code>u_init()</code> can be used to check for data loading. It tries to 1647 load the converter alias table (<code>cnvalias.icu</code>).</p> 1648 1649 <h4>ICU 2.6..3.2</h4> 1650 1651 <p>These ICU versions require a call to <code>u_init()</code> before 1652 multi-threaded use. The services that are directly affected are those that 1653 don't have a service object and need to be fast: normalization and character 1654 properties.</p> 1655 1656 <p><code>u_init()</code> loads and initializes the data files for 1657 normalization and character properties (<code>unorm.icu</code> and 1658 <code>uprops.icu</code>) and can therefore also be used to check for data 1659 loading.</p> 1660 1661 <h4>ICU 2.4 and earlier</h4> 1662 1663 <p>ICU 2.4 and earlier versions were not prepared for multithreaded use on 1664 multi-CPU platforms where the CPUs implement weak memory coherency. These 1665 CPUs include: Power4, Power5, Alpha, Itanium. <code>u_init()</code> was not 1666 defined yet.</p> 1667 1668 <h4><a name="ImportantNotesHPUX" href="#ImportantNotesHPUX" id= 1669 "ImportantNotesHPUX">Using ICU in a Multithreaded Environment on 1670 HP-UX</a></h4> 1671 1672 <p>When ICU is built with aCC on HP-UX, the <a 1673 href="http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=eb08b3f1eee02110b3f1eee02110275d6e10RCRD">-AA</a> 1674 compiler flag is used. It is required in order to use the latest 1675 <iostream> API in a thread safe manner. This compiler flag affects the 1676 version of the C++ library being used. Your applications will also need to 1677 be compiled with -AA in order to use ICU.</p> 1678 1679 <h4><a name="ImportantNotesSolaris" href="#ImportantNotesSolaris" id= 1680 "ImportantNotesSolaris">Using ICU in a Multithreaded Environment on 1681 Solaris</a></h4> 1682 1683 <h5>Linking on Solaris</h5> 1684 1685 <p>In order to avoid synchronization and threading issues, developers are 1686 <strong>suggested</strong> to strictly follow the compiling and linking 1687 guidelines for multithreaded applications, specified in the following 1688 SUn Solaris document available from Oracle. Most notably, pay strict attention to the 1689 following statements from Sun:</p> 1690 1691 <blockquote> 1692 <p>To use libthread, specify -lthread before -lc on the ld command line, or 1693 last on the cc command line.</p> 1694 1695 <p>To use libpthread, specify -lpthread before -lc on the ld command line, 1696 or last on the cc command line.</p> 1697 </blockquote> 1698 1699 <p>Failure to do this may cause spurious lock conflicts, recursive mutex 1700 failure, and deadlock.</p> 1701 1702 <p>Source: "<i>Multithreaded Programming Guide, Compiling and 1703 Debugging</i>", Sun Microsystems, 2002 <br /> 1704 <a href= 1705 "https://docs.oracle.com/cd/E19683-01/806-6867/compile-74765/index.html">https://docs.oracle.com/cd/E19683-01/806-6867/compile-74765/index.html</a></p> 1706 1707 <p>Note, a version of that chapter from a 2008 document update covering both Solaris 9 1708 and Solaris 10 is available here:<br /> 1709 <a href= 1710 "http://docs.oracle.com/cd/E19253-01/816-5137/compile-94179/index.html">http://docs.oracle.com/cd/E19253-01/816-5137/compile-94179/index.html</a></p> 1711 1712 <h3><a name="ImportantNotesWindows" href="#ImportantNotesWindows" id= 1713 "ImportantNotesWindows">Windows Platform</a></h3> 1714 1715 <p>If you are building on the Windows platform, it is important that you 1716 understand a few of the following build details.</p> 1717 1718 <h4>DLL directories and the PATH setting</h4> 1719 1720 <p>As delivered, the International Components for Unicode build as several 1721 DLLs, which are placed in the "<i><ICU></i>\bin64" directory. You must 1722 add this directory to the PATH environment variable in your system, or any 1723 executables you build will not be able to access International Components for 1724 Unicode libraries. Alternatively, you can copy the DLL files into a directory 1725 already in your PATH, but we do not recommend this. You can wind up with 1726 multiple copies of the DLL and wind up using the wrong one.</p> 1727 1728 <h4><a name="ImportantNotesWindowsPath" id= 1729 "ImportantNotesWindowsPath">Changing your PATH</a></h4> 1730 1731 <p><strong>Windows 2000/XP and above</strong>: Use the System Icon in the Control 1732 Panel. Pick the "Advanced" tab. Select the "Environment Variables..." 1733 button. Select the variable PATH in the lower box, and select the lower 1734 "Edit..." button. In the "Variable Value" box, append the string 1735 ";<i><ICU></i>\bin64" to the end of the path string. If there is 1736 nothing there, just type in "<i><ICU></i>\bin64". Click the Set button, 1737 then the OK button.</p> 1738 1739 <p>Note: When packaging a Windows application for distribution and 1740 installation on user systems, copies of the ICU DLLs should be included with 1741 the application, and installed for exclusive use by the application. This is 1742 the only way to insure that your application is running with the same version 1743 of ICU, built with exactly the same options, that you developed and tested 1744 with. Refer to Microsoft's guidelines on the usage of DLLs, or search for the 1745 phrase "DLL hell" on <a href= 1746 "http://msdn.microsoft.com/">msdn.microsoft.com</a>.</p> 1747 1748 <h3><a name="ImportantNotesUNIX" href="#ImportantNotesUNIX" id= 1749 "ImportantNotesUNIX">UNIX Type Platform</a></h3> 1750 1751 <p>If you are building on a UNIX platform, and if you are installing ICU in a 1752 non-standard location, you may need to add the location of your ICU libraries 1753 to your <strong>LD_LIBRARY_PATH</strong> or <strong>LIBPATH</strong> 1754 environment variable (or the equivalent runtime library path environment 1755 variable for your system). The ICU libraries may not link or load properly 1756 without doing this.</p> 1757 1758 <p>Note that if you do not want to have to set this variable, you may instead 1759 use the --enable-rpath option at configuration time. This option will 1760 instruct the linker to always look for the libraries where they are 1761 installed. You will need to use the appropriate linker options when linking 1762 your own applications and libraries against ICU, too. Please refer to your 1763 system's linker manual for information about runtime paths. The use of rpath 1764 also means that when building a new version of ICU you should not have an 1765 older version installed in the same place as the new version's installation 1766 directory, as the older libraries will used during the build, instead of the 1767 new ones, likely leading to an incorrectly build ICU. This is the proper 1768 behavior of rpath.</p> 1769 1770 <h2><a name="PlatformDependencies" href="#PlatformDependencies" id= 1771 "PlatformDependencies">Platform Dependencies</a></h2> 1772 1773 <h3><a name="PlatformDependenciesNew" href="#PlatformDependenciesNew" id= 1774 "PlatformDependenciesNew">Porting To A New Platform</a></h3> 1775 1776 <p>If you are using ICU's Makefiles to build ICU on a new platform, there are 1777 a few places where you will need to add or modify some files. If you need 1778 more help, you can always ask the <a href= 1779 "http://site.icu-project.org/contacts">icu-support mailing list</a>. Once 1780 you have finished porting ICU to a new platform, it is recommended that you 1781 contribute your changes back to ICU via the icu-support mailing list. This 1782 will make it easier for everyone to benefit from your work.</p> 1783 1784 <h4>Data For a New Platform</h4> 1785 1786 <p>For some people, it may not be necessary for completely build ICU. Most of 1787 the makefiles and build targets are for tools that are used for building 1788 ICU's data, and an application's data (when an application uses ICU resource 1789 bundles for its data).</p> 1790 1791 <p>Data files can be built on a different platform when both platforms share 1792 the same endianness and the same charset family. This assertion does not 1793 include platform dependent DLLs/shared/static libraries. For details see the 1794 User Guide <a href="https://unicode-org.github.io/icu/userguide/icudata">ICU 1795 Data</a> chapter.</p> 1796 1797 <p>ICU 3.6 removes the requirement that ICU be completely built in the native 1798 operating environment. It adds the icupkg tool which can be run on any 1799 platform to turn binary ICU data files from any one of the three formats into 1800 any one of the other data formats. This allows a application to use ICU data 1801 built anywhere to be used for any other target platform.</p> 1802 1803 <p><strong>WARNING!</strong> Building ICU without running the tests is not 1804 recommended. The tests verify that ICU is safe to use. It is recommended that 1805 you try to completely port and test ICU before using the libraries for your 1806 own application.</p> 1807 1808 <h4>Adapting Makefiles For a New Platform</h4> 1809 1810 <p>Try to follow the build steps from the <a href="#HowToBuildUNIX">UNIX</a> 1811 build instructions. If the configure script fails, then you will need to 1812 modify some files. Here are the usual steps for porting to a new 1813 platform:<br /> 1814 </p> 1815 1816 <ol> 1817 <li>Create an mh file in icu/source/config/. You can use mh-linux or a 1818 similar mh file as your base configuration.</li> 1819 1820 <li>Modify icu/source/aclocal.m4 to recognize your platform's mh file.</li> 1821 1822 <li>Modify icu/source/configure.in to properly set your <b>platform</b> C 1823 Macro define.</li> 1824 1825 <li>Run <a href="http://www.gnu.org/software/autoconf/">autoconf</a> in 1826 icu/source/ without any options. The autoconf tool is standard on most 1827 Linux systems.</li> 1828 1829 <li>If you have any optimization options that you want to normally use, you 1830 can modify icu/source/runConfigureICU to specify those options for your 1831 platform.</li> 1832 1833 <li>Build and test ICU on your platform. It is very important that you run 1834 the tests. If you don't run the tests, there is no guarentee that you have 1835 properly ported ICU.</li> 1836 </ol> 1837 1838 <h3><a name="PlatformDependenciesImpl" href="#PlatformDependenciesImpl" id= 1839 "PlatformDependenciesImpl">Platform Dependent Implementations</a></h3> 1840 1841 <p>The platform dependencies have been mostly isolated into the following 1842 files in the common library. This information can be useful if you are 1843 porting ICU to a new platform.</p> 1844 1845 <ul> 1846 <li> 1847 <strong>unicode/platform.h.in</strong> (autoconf'ed platforms)<br /> 1848 <strong>unicode/p<i>XXXX</i>.h</strong> (others: pwin32.h, ppalmos.h, 1849 ..): Platform-dependent typedefs and defines:<br /> 1850 <br /> 1851 1852 1853 <ul> 1854 <li>Generic types like UBool, int8_t, int16_t, int32_t, int64_t, 1855 uint64_t etc.</li> 1856 1857 <li>U_EXPORT and U_IMPORT for specifying dynamic library import and 1858 export</li> 1859 1860 <li>String handling support for the char16_t and wchar_t types.</li> 1861 </ul> 1862 <br /> 1863 </li> 1864 1865 <li> 1866 <strong>unicode/putil.h, putil.c</strong>: platform-dependent 1867 implementations of various functions that are platform dependent:<br /> 1868 <br /> 1869 1870 1871 <ul> 1872 <li>uprv_isNaN, uprv_isInfinite, uprv_getNaN and uprv_getInfinity for 1873 handling special floating point values.</li> 1874 1875 <li>uprv_tzset, uprv_timezone, uprv_tzname and time for getting 1876 platform specific time and time zone information.</li> 1877 1878 <li>u_getDataDirectory for getting the default data directory.</li> 1879 1880 <li>uprv_getDefaultLocaleID for getting the default locale 1881 setting.</li> 1882 1883 <li>uprv_getDefaultCodepage for getting the default codepage 1884 encoding.</li> 1885 </ul> 1886 <br /> 1887 </li> 1888 1889 <li> 1890 <strong>umutex.h, umutex.c</strong>: Code for doing synchronization in 1891 multithreaded applications. If you wish to use International Components 1892 for Unicode in a multithreaded application, you must provide a 1893 synchronization primitive that the classes can use to protect their 1894 global data against simultaneous modifications. We already supply working 1895 implementations for many platforms that ICU builds on.<br /> 1896 <br /> 1897 </li> 1898 1899 <li><strong>umapfile.h, umapfile.c</strong>: functions for mapping or 1900 otherwise reading or loading files into memory. All access by ICU to data 1901 from files makes use of these functions.<br /> 1902 <br /> 1903 </li> 1904 1905 <li>Using platform specific #ifdef macros are highly discouraged outside of 1906 the scope of these files. When the source code gets updated in the future, 1907 these #ifdef's can cause testing problems for your platform.</li> 1908 </ul> 1909 <hr /> 1910 <p> Copyright © 2016 and later: Unicode, Inc. and others. License & terms of use: 1911 <a href="http://www.unicode.org/copyright.html">http://www.unicode.org/copyright.html</a><br/> 1912 Copyright © 1997-2016 International Business Machines Corporation and others. 1913 All Rights Reserved.</p> 1914 </body> 1915</html> 1916