tux4kids / t4kcommon

GNU General Public License v3.0
4 stars 11 forks source link

Undefined symbols: _libiconv _libiconv_close _libiconv_open #18

Open ryandesign opened 1 year ago

ryandesign commented 1 year ago

t4k_common 0.1.1 fails to link for me on macOS 12 in MacPorts:

/bin/sh ../libtool --tag=CC   --mode=link /usr/bin/clang -Wall -g -DCOMMON_DATA_PREFIX=\"/opt/local/share/t4k_common\" -DDEBUG -DUSE_T4K_PREFIX=1  -pipe -Os -Wno-error=implicit-function-declaration -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64 -D_THREAD_SAFE -I/opt/local/include/SDL  -D_THREAD_SAFE -I/opt/local/include/SDL -I/opt/local/include/pango-1.0 -I/opt/local/include/fribidi -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/harfbuzz -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -D_THREAD_SAFE -I/opt/local/include/SDL -I/opt/local/include/librsvg-2.0 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/cairo -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/cairo -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/libpng16 -I/opt/local/include/libxml2  -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64 -o libt4k_common.la -rpath /opt/local/lib t4k_audio.lo t4k_convert_utf.lo t4k_linewrap.lo t4k_loaders.lo t4k_main.lo t4k_menu.lo t4k_pixels.lo t4k_sdl.lo t4k_throttle.lo t4k_replacements.lo linebreak/liblinebreak.la -lm  -L/opt/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -L/opt/local/lib -lSDL_image -lSDLmain -lSDL -Wl,-framework,Cocoa -L/opt/local/lib -lSDL_mixer -lSDLmain -lSDL -Wl,-framework,Cocoa -L/opt/local/lib -lSDL_Pango -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz -L/opt/local/lib -lSDL_net -lSDLmain -lSDL -Wl,-framework,Cocoa -L/opt/local/lib -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lcairo -L/opt/local/lib -lcairo -L/opt/local/lib -lpng16 -L/opt/local/lib -lxml2
libtool: link: (cd .libs/libt4k_common.lax/liblinebreak.a && ar x "/opt/local/var/macports/build/_Volumes_Shared_macports-ports_devel_t4k_common/t4k_common/work/t4kcommon-0.1.1/src/linebreak/.libs/liblinebreak.a")
libtool: link: /usr/bin/clang -dynamiclib  -o .libs/libt4k_common.0.dylib  .libs/t4k_audio.o .libs/t4k_convert_utf.o .libs/t4k_linewrap.o .libs/t4k_loaders.o .libs/t4k_main.o .libs/t4k_menu.o .libs/t4k_pixels.o .libs/t4k_sdl.o .libs/t4k_throttle.o .libs/t4k_replacements.o   .libs/libt4k_common.lax/liblinebreak.a/width.o .libs/libt4k_common.lax/liblinebreak.a/u8-mbtouc-unsafe.o .libs/libt4k_common.lax/liblinebreak.a/u8-mbtouc.o .libs/libt4k_common.lax/liblinebreak.a/u8-uctomb-aux.o .libs/libt4k_common.lax/liblinebreak.a/u8-mbtouc-aux.o .libs/libt4k_common.lax/liblinebreak.a/u16-mbtouc-unsafe.o .libs/libt4k_common.lax/liblinebreak.a/u8-uctomb.o .libs/libt4k_common.lax/liblinebreak.a/u16-mbtouc-unsafe-aux.o .libs/libt4k_common.lax/liblinebreak.a/u16-mbtouc.o .libs/libt4k_common.lax/liblinebreak.a/u16-mbtouc-aux.o .libs/libt4k_common.lax/liblinebreak.a/u8-mbtouc-unsafe-aux.o .libs/libt4k_common.lax/liblinebreak.a/linebreak.o   -L/opt/local/lib -lSDL_image -lSDL_mixer -lSDL_Pango -lpango-1.0 -lharfbuzz -lSDL_net -lSDLmain -lSDL -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lcairo -lpng16 -lxml2  -arch x86_64 -Wl,-headerpad_max_install_names -Wl,-syslibroot -Wl,/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64 -Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,Cocoa   -install_name  /opt/local/lib/libt4k_common.0.dylib -compatibility_version 1 -current_version 1.0 -Wl,-single_module
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _T4K_ConvertFromUTF8 in t4k_convert_utf.o
      _T4K_ConvertToUTF8 in t4k_convert_utf.o
      _mbs_width_linebreaks in linebreak.o
  "_libiconv_close", referenced from:
      _T4K_ConvertFromUTF8 in t4k_convert_utf.o
      _T4K_ConvertToUTF8 in t4k_convert_utf.o
      _mbs_width_linebreaks in linebreak.o
  "_libiconv_open", referenced from:
      _T4K_ConvertFromUTF8 in t4k_convert_utf.o
      _T4K_ConvertToUTF8 in t4k_convert_utf.o
      _mbs_width_linebreaks in linebreak.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[3]: *** [libt4k_common.la] Error 1

This despite the fact that the configure script has determined how to link with libiconv:

checking for iconv... yes
checking for working iconv... yes
checking how to link with libiconv... -liconv

Yet it has not actually added -liconv to the link flags. If I manually add -liconv to LDFLAGS when configuring then it does link successfully but the build system should do that itself.

abhivoid commented 6 months ago

To address this, I suggest investigating the build scripts to ensure that the libiconv dependency is correctly detected and incorporated into the build process. By doing so, we can streamline the build process and improve compatibility across different platforms.