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