Software Archive
Read-only legacy content

iconv issue

JJK
New Contributor III
1,365 Views

hi all,

 

I'm trying to build something for the Phi that depends on iconv; the library routines are present , but the following application fails when run on the Phi:

#include <stdlib.h>
#include <iconv.h>

int main () {
  iconv_t cd;
  cd = iconv_open("latin1","UTF-8");
  if(cd == (iconv_t)(-1)) exit(1);
  iconv_close(cd);

  exit(0);
}

if I build this using "icc -o iconv_test iconv_test.c" and run it on the host it return no error (exit code 0).

However, if I build this for the Phi "icc -mmic -o iconv_test iconv_test.c" it always returns exitcode 1. An strace shows the following

open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
brk(0)                                  = 0x714000
brk(0x735000)                           = 0x735000
open("/usr/lib64/gconv/gconv-modules", O_RDONLY) = -1 ENOENT (No such file or directory)
exit_group(1)     

 

and indeed, those module files are missing  - where can I find them?

 

0 Kudos
7 Replies
Kevin_D_Intel
Employee
1,365 Views

Man pages say the available coded character sets can be listed with iconv --list; however, this command does not appear to be present on the coprocessor. It appears these character sets may reside under areas like /usr/share/locale which also does not exist. While the routine appears present, the iconv_open functionality appears not to work in the absence of the coded character sets. Hopefully someone with greater knowledge of this and MPSS can weigh in to offer some further details.

0 Kudos
JJK
New Contributor III
1,365 Views

I had already found and installed the 'iconv' command in the k1om package "glibc-utils-2.14.1+mpss3.4.4-1.k1om" but this command also looks for /usr/lib64/gconv.

I wonder how difficult it will be to do a full rebuild of glib :)

 

On a related topic: how can I compile and link my code against precompiled libs for the Phi, e.g. libreadline ?   Is there a tutorial on how to do that ?

0 Kudos
Kevin_D_Intel
Employee
1,365 Views

I am probably mis-reading your question, but say libreadline.a was pre-built with -mmic, the linking should just be something like:

icc -mmic mycode.c -L<path> -lreadline

0 Kudos
JJK
New Contributor III
1,365 Views

OK, but what is the "approved" way to install this mic-built libreadline.{so.a} on the host system? on the Phi itself I'd use

rpm -ivh libreadline6-6.2-r2.k1om

but that is bound to conflict with existing package on the (EL6) host.

0 Kudos
Kevin_D_Intel
Employee
1,365 Views

Is that rpm distributed with MPSS?  If so I might expect it would install in known Phi specific locations on the host alongside other Phi specific content.

What does  rpm -qlp libreadline6-6.2-r2.k1om   show for paths where the contents are placed?

0 Kudos
JJK
New Contributor III
1,365 Views
$ rpm -qilp libreadline6-6.2-r2.k1om.rpm 
warning: libreadline6-6.2-r2.k1om.rpm: Header V4 DSA/SHA1 Signature, key ID c3c173ff: NOKEY
Name        : libreadline6                 Relocations: (not relocatable)
Version     : 6.2                               Vendor: (none)
Release     : r2                            Build Date: Thu May 14 20:05:17 2015
Install Date: (not installed)               Build Host: yocto-182-71
Group       : libs                          Source RPM: readline-6.2-r2.src.rpm
Size        : 338217                           License: GPLv3+
Signature   : DSA/SHA1, Thu May 14 20:05:19 2015, Key ID 06a5c076c3c173ff
Packager    : Intel Corporation
URL         : http://software.intel.com/xeonphi
Summary     : readline version 6.2-r2
Description :
The GNU Readline library provides a set of functions for use by
applications that allow users to edit command lines as they are typed in.
Both Emacs and vi editing modes are available. The Readline library
includes  additional functions to maintain a list of previously-entered
command lines, to recall and perhaps reedit those   lines, and perform csh-
like history expansion on previous commands.
/usr
/usr/lib64
/usr/lib64/libhistory.so.6
/usr/lib64/libhistory.so.6.2
/usr/lib64/libreadline.so.6
/usr/lib64/libreadline.so.6.2
/usr/share
/usr/share/readline
/usr/share/readline/excallback.c
/usr/share/readline/fileman.c
/usr/share/readline/histexamp.c
/usr/share/readline/manexamp.c
/usr/share/readline/rl-fgets.c
/usr/share/readline/rl.c
/usr/share/readline/rlcat.c
/usr/share/readline/rlevent.c
/usr/share/readline/rlptytest.c
/usr/share/readline/rltest.c
/usr/share/readline/rlversion.c

 

I'd love to get my hands on that signing key (Key ID 06a5c076c3c173ff), BTW.

A "rpm --test -ivh ..." results in a long list of warnings...

0 Kudos
Kevin_D_Intel
Employee
1,365 Views

So it is part of MPSS and I gather perhaps the source distribution. The /lib64 is one location I was aware had Phi specific content. The /usr/share content in the rpm might conflict depending on what is already on the host.

I do not have any experience working with the source distribution and rebuilding MPSS so hopefully someone else who does is following along and they might be able to offer more help to get you further.

0 Kudos
Reply