title: ICU libraries missing in C on Ubuntu 17.10
body: <p>I'm writing a small demo application (in C on Ubuntu 17.10 with the ICU libraries) that is supposed to convert an array of UTF-8 strings to an array of UChar strings and then sort them according to the locale. However, gcc is giving an error message for one line. Here is the line:</p>
  
  <pre><code>u_strFromUTF8(s[l], 512, NULL, line, -1, &amp;err);
  </code></pre>
  
  <p>Here are my variable definitions:</p>
  
  <pre><code>FILE *fp;
  char *line = NULL;
  char lines[512][1000];
  UChar *uline = NULL;
  size_t len = 0;
  ssize_t read;
  int l = 0;
  int count = 0;
  UChar s[512][1000];
  </code></pre>
  
  <p>And here is the error:</p>
  
  <pre><code>/tmp/cckFKMCm.o: In function `main':
  iosort1.c:(.text+0x10c): undefined reference to `u_strFromUTF8_59'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>Here is the <code>icu-config</code> line I'm using to build the application:</p>
  
  <pre><code>#!/bin/bash
  `icu-config --cc --cflags --cppflags --ldflags` -static -o iosort1 iosort1.c
  </code></pre>
  
  <p>From what I can tell, <code>ld</code> is looking for one of the ICU libraries, version 59, and not finding it. Version 57 of the libraries is what comes preinstalled on Ubuntu 17.10.</p>
  
  <p>I've searched the Web and especially Stack Overflow for an answer to this issue. People have asked about many superficially similar problems, but none of the proposed answers has worked for me. Examples: including more libraries in the build script, moving the libraries to the end of the line, adding <code>-static</code>, and more.</p>
  
  <p>The tactics I have thought of myself include downloading and manually installing version 59.1 of the libraries for Fedora from the ICU site into <code>/usr/local</code>, and using the path and the library path to point to various combinations of <code>icu-config</code> versions 57 and 59, and versions 57 and 59 of the ICU libraries. I have also completely deleted version 59 from my disk, and I would have done the same for the preinstalled version 57, except that apparently half of my system depends on it.</p>
  
  <p>Paradoxically, that would seem to be a good sign, because if the preinstalled ICU libraries were broken, half of Ubuntu 17.10 would be too. So it's probable I can get things to work, but how? I don't care which version I end up using, as long as my code will compile.</p>
  
  <p>I'd like to show more of my code, but it's supposed to be one of the "answers in the back of the book" for a class (I'm working with the teacher to produce code samples for the students). I can probably show a little more, though, if you let me know what you want to see.</p>
  
  <p>Thanks for your time and expertise.</p>