OSX Undefined symbols for libiconv

Bug #1782666 reported by John Talbot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Triaged
Undecided
Unassigned

Bug Description

I found this issue on OSX 10.13.5 compiling inkscape-0.92.3.

[ 88%] Linking CXX shared library ../lib/libinkscape_base.dylib
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _U_Utf32leToUtf16le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf16leToUtf32le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Latin1ToUtf32le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf8ToUtf32le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf32leToUtf8 in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf8ToUtf16le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf16leToUtf8 in libuemf_LIB.a(uemf_utf.c.o)
      ...
  "_libiconv_close", referenced from:
      _U_Utf32leToUtf16le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf16leToUtf32le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Latin1ToUtf32le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf8ToUtf32le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf32leToUtf8 in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf8ToUtf16le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf16leToUtf8 in libuemf_LIB.a(uemf_utf.c.o)
      ...
  "_libiconv_open", referenced from:
      _U_Utf32leToUtf16le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf16leToUtf32le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Latin1ToUtf32le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf8ToUtf32le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf32leToUtf8 in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf8ToUtf16le in libuemf_LIB.a(uemf_utf.c.o)
      _U_Utf16leToUtf8 in libuemf_LIB.a(uemf_utf.c.o)
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libinkscape_base.dylib] Error 1
make[1]: *** [src/CMakeFiles/inkscape_base.dir/all] Error 2
make: *** [all] Error 2

There is no /usr/local/include/iconv.h

There is a /usr/include/iconv.h
It does not have the define iconv_t but has instead
typedef void* iconv_t

There is a MacPorts file /opt/local/include/iconv.h which does have the line:
#define iconv_t libiconv_t
MacPorts libconv cannot be removed as it is used by many other packages to compile Inkscape.

port info libiconv returns the latest being->
libiconv @1.15 (textproc)
Variants: cp932fix, universal

Description: A character-set conversion library which implements the iconv() API for dealing
                      with unicode and other types of conversion.
Homepage: https://www.gnu.org/software/libiconv/

Build Dependencies: gperf
Platforms: darwin, freebsd, linux
License: (LGPL-2+ or GPL-3+)
Maintainers: Email: <email address hidden>

Configuration was done for Inkscape using the documented process of:
mkdir build
cd build
cmake ..
make

cmake displays
-- Performing Test ICONV_SECOND_ARGUMENT_IS_CONST
-- Performing Test ICONV_SECOND_ARGUMENT_IS_CONST - Failed
-- Found Iconv: /usr/lib/libiconv.dylib

printenv of my environment returns:
TERM_PROGRAM=Apple_Terminal
TERM=xterm-256color
SHELL=/bin/bash
TMPDIR=/var/folders/pn/_6h1_7g13v7c3tgr7q8qqw5m0000gn/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.aMHZg9YphM/Render
TERM_PROGRAM_VERSION=404
OLDPWD=/Users/me/Downloads/inkscape-0.92.3/src
TERM_SESSION_ID=E5822A4E-4DFD-41CC-BE6B-76135933D46A
USER=me
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.2qSrDHNG6w/Listeners
PATH=/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
PWD=/Users/me/Downloads/inkscape-0.92.3
LANG=en_CA.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
HOME=/Users/me
SHLVL=1
LOGNAME=me
_=/usr/bin/printenv

I did a git clone of https://gitlab.com/inkscape/inkscape.git
cmake reports the same for iconv, but I cannot get past make as the port for gdl fails to compile and is required for the latest Inkscape.

For what I understand so far, those undefined symbols are defined in /opt/local/lib/libiconv.dylib
but cmake picks up /usr/lib/libiconv.dylib and then the compile uses /opt/local/include/iconv.h and all the associated symbols that /usr/lib/libiconv.dylib does not have.

I resolved the issue temporarily by from the bash prompt first setting
CMAKE_PREFIX_PATH="/opt/local/lib/"
This could be the solution for those compiling from OSX with MacPorts installed. The documentation would then just have to be changed to reflect this.

Cheers,
John Talbot

Changed in inkscape:
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.