grayed / bsd-upstreaming

Collaboration for upstreaming BSD-specific patches to upstream projects
ISC License
0 stars 0 forks source link

ICU and iconv explained #4

Closed ghost closed 8 years ago

ghost commented 8 years ago

As I tried to get a hold on what is right and what is wrong :) on the iconv checks which sometimes need adaption to make them work, I've looked up the necessary stuff.

Below the configuration where it is used in qtcore, basically it is an either ICU - or - iconv, whereby ICU takes precedence. As long as you use ICU, there is no need for iconv really working. A reason for that though might be on small embedded systems to use the native iconv to avoid having icu installed.

qtbase/src/corelib/codecs/codecs.pri:

contains(QT_CONFIG,icu) { HEADERS += \ codecs/qicucodec_p.h SOURCES += \ codecs/qicucodec.cpp } else { ... unix:!qnx:!mac:!ios:!linux-android-* { contains(QT_CONFIG,iconv) { HEADERS += codecs/qiconvcodec_p.h SOURCES += codecs/qiconvcodec.cpp } else:contains(QT_CONFIG,gnu-libiconv) { HEADERS += codecs/qiconvcodec_p.h SOURCES += codecs/qiconvcodec.cpp DEFINES += GNU_LIBICONV LIBS_PRIVATE *= -liconv } else:contains(QT_CONFIG,sun-libiconv) { HEADERS += codecs/qiconvcodec_p.h SOURCES += codecs/qiconvcodec.cpp DEFINES += GNU_LIBICONV } ,...

ghost commented 8 years ago

Vadim's qtbug report link:

https://bugreports.qt.io/browse/QTBUG-43291

The problem is related to the following (to make this really work at least for detecting, even if it's not used by ports):

The patch uses the gnu libiconv.so though, so the fix is at the wrong place. The fix should be in the gnu iconv test code like FreeBSD, then linking works.

ghost commented 8 years ago

Patch for correct detection and behavior: https://codereview.qt-project.org/#/c/160727/

krytarowski commented 8 years ago

Thank you for taking it.

ghost commented 8 years ago

One problem I couldn't solve yet is that whenever libiconv is installed (mostly on user systems already), configure picks it up instead of the libc version, because /usr/local/include is always included first. Then you end up with linker errors on the posix test as -liconv is missing. However, you want to use the posix version where available.