pi5b
Posts: 87
Joined: Thu Jan 06, 2022 2:53 am

ucnv.h missing

Thu May 25, 2023 2:48 pm

I'm trying to build some software but I'm getting an error about ucnv.h :

/usr/include/libxml2/libxml/encoding.h:31:10: fatal error: 'unicode/ucnv.h' file not found

My 64-bit Raspbian is fully up to date with Bullseye.

If I understand correctly how Debian (Raspbian) is supposed to work, if one package X depends on another Y, the dependency Y is supposed to be loaded automatically when I install X. However this was not the case regarding libxml, because ucnv.h is required by it but is missing.

I saw in a forum posting that these days ucnv.h is provided by libiconv-hook-dev, because libiconv-dev has gone away, however libiconv-hook-dev does not provide ucnv.h either.

Can someone let me know which package really has ucnv.h, or do none of them and I need to compile iconv from the source code?

At a certain point, this worldwide search for the correct package, looking under every rock and in every crevice, becomes a burden and it is just way easier to compile the thing myself. Debian's package dependency feature looks good on paper, but in practice it seems broken sometimes. However, I just now compiled libiconv myself, which took all of 30 seconds, and I don't see ucnv.h in it anywhere, so perhaps Debian aarch64's libxml is what is out of date.

User avatar
DougieLawson
Posts: 42477
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: ucnv.h missing

Thu May 25, 2023 3:55 pm

You need libicu-dev installed.

sudo apt update;sudo apt install libicu-dev
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
rpdom
Posts: 21819
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: ucnv.h missing

Thu May 25, 2023 4:49 pm

pi5b wrote:
Thu May 25, 2023 2:48 pm
I'm trying to build some software but I'm getting an error about ucnv.h :

/usr/include/libxml2/libxml/encoding.h:31:10: fatal error: 'unicode/ucnv.h' file not found

My 64-bit Raspbian is fully up to date with Bullseye.

If I understand correctly how Debian (Raspbian) is supposed to work, if one package X depends on another Y, the dependency Y is supposed to be loaded automatically when I install X. However this was not the case regarding libxml, because ucnv.h is required by it but is missing.
For 64-bit Raspberry Pi OS it is just Debian, not Raspbian.

There is a way to install build dependencies for source code, it works for building Debian packages, but not so much for other source.

The way I find out what to install to get a file like ucnv.h is to go to the Debian Packages site and "Search the contents of packages", in this case I search for paths that end in ucnv.h and get the results

Code: Select all

/usr/include/mozjs-52/unicode/ucnv.h 	libmozjs-52-dev [mips]
/usr/include/unicode/ucnv.h 	libicu-dev
From that you can see that you need libicu-dev.

This is a useful look up service, even if you're running the Raspbian-based 32-bit Raspberry Pi OS - just make sure you use apt to install - don't download directly from the Debian site.
Unreadable squiggle

pi5b
Posts: 87
Joined: Thu Jan 06, 2022 2:53 am

Re: ucnv.h missing

Thu May 25, 2023 4:52 pm

DougieLawson wrote:
Thu May 25, 2023 3:55 pm
You need libicu-dev installed.

sudo apt update;sudo apt install libicu-dev
That didn't install it:

$ find /usr -name ucnv.h
$ find /usr -name unicode
/usr/include/boost/spirit/home/support/char_encoding/unicode
/usr/include/unicode
/usr/src/linux-headers-6.1.21-v8+/fs/unicode
/usr/share/doc/unicode
/usr/share/unicode
/usr/bin/unicode
$ ls /usr/include/unicode
ustdio.h ustream.h

User avatar
rpdom
Posts: 21819
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: ucnv.h missing

Thu May 25, 2023 5:05 pm

pi5b wrote:
Thu May 25, 2023 4:52 pm
That didn't install it:
Your install didn't work properly then, or there is a problem with your system...

Code: Select all

notpi@raspi10:~ $ ls /usr/include/unicode
ls: cannot access '/usr/include/unicode': No such file or directory

notpi@raspi10:~ $ sudo apt update;sudo apt install libicu-dev
Hit:1 http://deb.debian.org/debian bullseye InRelease
(blah blah blah)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  icu-devtools
Suggested packages:
  icu-doc
The following NEW packages will be installed:
  icu-devtools libicu-dev
0 upgraded, 2 newly installed, 0 to remove and 8 not upgraded.
Need to get 9,657 kB of archives.
After this operation, 45.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://deb.debian.org/debian bullseye/main arm64 icu-devtools arm64 67.1-7 [189 kB]
Get:2 http://deb.debian.org/debian bullseye/main arm64 libicu-dev arm64 67.1-7 [9,468 kB]
Fetched 9,657 kB in 3s (3,172 kB/s)     
Selecting previously unselected package icu-devtools.
(Reading database ... 46292 files and directories currently installed.)
Preparing to unpack .../icu-devtools_67.1-7_arm64.deb ...
Unpacking icu-devtools (67.1-7) ...
Selecting previously unselected package libicu-dev:arm64.
Preparing to unpack .../libicu-dev_67.1-7_arm64.deb ...
Unpacking libicu-dev:arm64 (67.1-7) ...
Setting up icu-devtools (67.1-7) ...
Setting up libicu-dev:arm64 (67.1-7) ...
Processing triggers for man-db (2.9.4-2) ...

notpi@raspi10:~ $ ls /usr/include/unicode
alphaindex.h            localpointer.h               tmunit.h               umisc.h
(lots of files)
dcfmtsym.h              putil.h                      ucnv.h      <------ Oh look!!!
(lots more files)
Unreadable squiggle

pi5b
Posts: 87
Joined: Thu Jan 06, 2022 2:53 am

Re: ucnv.h missing

Thu May 25, 2023 10:19 pm

rpdom wrote:
Thu May 25, 2023 5:05 pm
...
That's strange. I ended up installing libicu from sources and now I'm OK.

Return to “General programming discussion”