Author Topic: Compiling uchardet  (Read 114 times)

Michael

  • Newbie
  • *
  • Posts: 35
  • Karma: +5/-0
    • View Profile
Compiling uchardet
« on: February 25, 2026, 09:02:32 pm »
I recently attempted to compile the uchardet library (https://www.freedesktop.org/wiki/Software/uchardet/) under OS/2. My naive attempt actually succeeded up to 95%. However, I am now stuck at the linker stage.

Does anyone have any ideas on what I can do here?

Code: [Select]
[ 95%] Linking CXX executable uchardet.exe
weakld: error: Unresolved symbol (UNDEF) '_uchardet_data_end'.
weakld: info: The symbol is referenced by:
    D:\Programs\IBMCPP\TMP\ldconv_uchardet_cpp_o_5a9699f52c51de698.obj
weakld: error: Unresolved symbol (UNDEF) '_uchardet_delete'.
weakld: info: The symbol is referenced by:
    D:\Programs\IBMCPP\TMP\ldconv_uchardet_cpp_o_5a9699f52c51de698.obj
weakld: error: Unresolved symbol (UNDEF) '_uchardet_get_charset'.
weakld: info: The symbol is referenced by:
    D:\Programs\IBMCPP\TMP\ldconv_uchardet_cpp_o_5a9699f52c51de698.obj
weakld: error: Unresolved symbol (UNDEF) '_uchardet_new'.
weakld: info: The symbol is referenced by:
    D:\Programs\IBMCPP\TMP\ldconv_uchardet_cpp_o_5a9699f52c51de698.obj
weakld: error: Unresolved symbol (UNDEF) '_uchardet_handle_data'.
weakld: info: The symbol is referenced by:
    D:\Programs\IBMCPP\TMP\ldconv_uchardet_cpp_o_5a9699f52c51de698.obj
Ignoring unresolved externals reported from weak prelinker.
Error! E2028: _uchardet_new is an undefined reference
Error! E2028: _uchardet_handle_data is an undefined reference
Error! E2028: _uchardet_data_end is an undefined reference
Error! E2028: _uchardet_get_charset is an undefined reference
Error! E2028: _uchardet_delete is an undefined reference
file D:/Programs/IBMCPP/TMP\ldconv_uchardet_cpp_o_5a9699f52c51de698.obj(ldconv_uchardet_cpp_o_5a9699f52c51de698.obj): undefined symbol _uchardet_new
file D:/Programs/IBMCPP/TMP\ldconv_uchardet_cpp_o_5a9699f52c51de698.obj(ldconv_uchardet_cpp_o_5a9699f52c51de698.obj): undefined symbol _uchardet_handle_data
file D:/Programs/IBMCPP/TMP\ldconv_uchardet_cpp_o_5a9699f52c51de698.obj(ldconv_uchardet_cpp_o_5a9699f52c51de698.obj): undefined symbol _uchardet_data_end
file D:/Programs/IBMCPP/TMP\ldconv_uchardet_cpp_o_5a9699f52c51de698.obj(ldconv_uchardet_cpp_o_5a9699f52c51de698.obj): undefined symbol _uchardet_get_charset
file D:/Programs/IBMCPP/TMP\ldconv_uchardet_cpp_o_5a9699f52c51de698.obj(ldconv_uchardet_cpp_o_5a9699f52c51de698.obj): undefined symbol _uchardet_delete
make[2]: *** [src/tools/CMakeFiles/uchardet.dir/build.make:101: src/tools/uchardet.exe] Error 1
make[1]: *** [CMakeFiles/Makefile2:241: src/tools/CMakeFiles/uchardet.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

Thanks for any hints,
Michael

TeLLie

  • Sr. Member
  • ****
  • Posts: 292
  • Karma: +21/-0
    • View Profile
Re: Compiling uchardet
« Reply #1 on: February 25, 2026, 10:48:42 pm »
Hi Michael,
I did it some time ago.
and dint see what you show.
i use this:
#!/bin/sh
echo GCC 9.2.0 and Qt 5.15 and the Cmake 3.3125 build Environment
NCORES=$(nproc)
MAXCORES=$(( NCORES - 5 ))
NJS=$(( MAXCORES > 5 ? MAXCORES : 5 ))
mkdir cmake325-os2
cd cmake325-os2
export LDFLAGS="-Zhigh-mem -Zomf -Zmap -lcx"
export CFLAGS="-O2 -g -march=pentium4"
export CXXFLAGS="-O2 -g -march=pentium4"
export FFLAGS="-O2 -g -march=pentium4"
export FCFLAGS="-O2 -g -march=pentium4"

cmake -L .. -DCMAKE_INSTALL_PREFIX:PATH=c:/test \
      -DCMAKE_BUILD_TYPE=Release \
      -DBUILD_BINARY=ON \
      -DBUILD_SHARED_LIBS=ON \
      -DCHECK_SSE2=ON \
      -DTARGET_ARCHITECTURE=ON \
      -Wno-dev 2>stdout 1>stderr
make -j$NJS 2>&1 |tee make.out

Not sure this will help.
What did you use..
I did v0.8
E:\uchardet-0.0.8\cmake325-os2\src\tools>uchardet.exe --version

uchardet Command Line Tool
Version 0.0.8

Authors: BYVoid, Jehan
Bug Report: https://gitlab.freedesktop.org/uchardet/uchardet/-/issues

I add to ucharded.h line 47 this

#if defined(UCHARDET_SHARED) && (defined(_WIN32) || defined(__OS2__))

Regars, Tellie

Michael

  • Newbie
  • *
  • Posts: 35
  • Karma: +5/-0
    • View Profile
Re: Compiling uchardet
« Reply #2 on: March 01, 2026, 09:42:22 pm »
Hello Tellie,

Thank you for your help. In the meantime, I have downloaded the latest version of CMake from Paul Smedley and I'm no longer receiving the previous messages. However, it seems that the makefiles now require quotation marks for the path specifications. Very strange...

I will take a closer look at this when I have the time. My goal is actually to compile NotepadQQ for OS/2. All prerequisites would be in place once uchardet is built.

Thank you once again,
Michael