# Error "ld: error: undefined symbol: locale_charset" on compiling 'libdatrie' package



## albertguedes (Sep 29, 2022)

Hi. I have tried to install the port devel/libdatrie with portmaster and the compilation cause the error


```
--- trietool ---
/bin/sh ../libtool  --tag=CC    --mode=link cc  -O2 -pipe  -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing   -fstack-protector-strong -L/usr/local/lib -o trietool trietool.o ../datrie/libdatrie.la     
libtool: link: cc -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fstack-protector-strong -o .libs/trietool trietool.o  -L/usr/local/lib ../datrie/.libs/libdatrie.so -Wl,-rpath -Wl,/usr/local/lib
ld: error: undefined symbol: locale_charset
>>> referenced by trietool.c
>>>               trietool.o:(main)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [trietool] Error code 1

make[3]: stopped in /usr/ports/devel/libdatrie/work/libdatrie-0.2.13/tools
1 error

make[3]: stopped in /usr/ports/devel/libdatrie/work/libdatrie-0.2.13/tools

make[2]: stopped in /usr/ports/devel/libdatrie/work/libdatrie-0.2.13

make[1]: stopped in /usr/ports/devel/libdatrie/work/libdatrie-0.2.13
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/libdatrie

===>>> make build failed for devel/libdatrie
===>>> Aborting update


===>>> You can restart from the point of failure with this command line:
       portmaster <flags> devel/libdatrie 

This command has been saved to ~/portmasterfail.txt
```

Anyone know a solution for this? Tks

The versions of packages
- FreeBSD 13.1-release-p2
- portmaster 3.22


----------



## T-Daemon (Sep 30, 2022)

PR devel/libdatrie build fails if converters/libiconv is installed

Alternatively install package, it has the same version number as the port has, or force delete converters/libiconv and after build of devel/libdatrie install again.


----------



## dove (Nov 29, 2022)

See also upstream bug. libdatrie should link with -liconv when its configure script detects locale_charset (and tries to set up the build to use libiconv). There is now a patch for this issue for upstream to consider.

This started happening recently for FreeBSD because libiconv-1.17 (released May 2022 and pulled into FreeBSD ports Jul 2022) now exports the locale_charset symbol whereas libiconv-1.16 did not ("Do export the symbol 'locale_charset' (needed by GNU bash).").


----------

