part-cw / lambdanative

LambdaNative is a cross-platform development environment written in Scheme, supporting Android, iOS, BlackBerry 10, OS X, Linux, Windows, OpenBSD, NetBSD, FreeBSD and OpenWrt.
http://www.lambdanative.org
Other
1.4k stars 86 forks source link

Build issue on macOS with libiconv #171

Open BusFactor1Inc opened 6 years ago

BusFactor1Inc commented 6 years ago

macOS High Sierra fails to build any apps due to iconv linking issue in pngtool.

I have installed the latest libiconv from macPorts.

bash-3.2$ ./configure DemoHelloWorld
==> configured to build DemoHelloWorld for macosx in normal mode
 == using source in /Users/burton/Desktop/lambdanative/apps/DemoHelloWorld
bash-3.2$ make
=== using profile BusFactor1 Inc. LambdaNative Profile [/Users/burton/Desktop/lambdanative/PROFILE]..
=== configured to build DemoHelloWorld version 1.0 for macosx on macosx in normal mode

==> checking for required tools..
** WARNING: xelatex environment is not complete. Consider installing necessary XeTeX packages.
 ** Using GD to render strings
==> checking for required libraries..
==> checking for lambdanative tools..
 => building lambdanative tool pngtool..
lambdanative: 886173e
==> creating libraries needed for pngtool..
 => liblambdanative..
 => cleaning up..
 => exploding library liblambdanative..
 => compiling scheme payload..
 => done compiling scheme payload
 => generating hook..
 => assembling payload..
 == /Users/burton/Library/Caches/lambdanative/macosx/lib/libpayload.a
==> creating macosx loader needed for pngtool..
 => processing sounds needed for pngtool..
 => compiling application..
gcc  -DMACOSX -m64   -liconv -framework ApplicationServices -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreFoundation -framework CoreServices -framework Foundation -I/Users/burton/Library/Caches/lambdanative/macosx/include -L/Users/burton/Library/Caches/lambdanative/macosx/lib -DUSECONSOLE -o /Users/burton/Library/Caches/lambdanative/macosx/pngtool.app/pngtool -lpayload
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _do_convert in libpayload.a(gdkanji.o)
  "_libiconv_close", referenced from:
      _do_convert in libpayload.a(gdkanji.o)
  "_libiconv_open", referenced from:
      _do_convert in libpayload.a(gdkanji.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: failed on file /Users/burton/Library/Caches/lambdanative/macosx/pngtool.app/pngtool
BUILD FAILED - configure with verbose option for more information
make: *** [all] Error 1
bash-3.2$ 
mgorges commented 6 years ago

Don't know where your MacPorts is installed to, but if I assume it places things into /opt/local, try changing the configure script for pngtools to include --with-libiconv-prefix=/opt/local in either libraries/libgd/make.sh#L20 or in macosx/build-binary#L84. If that works we can see if we can patch this automatically?

BusFactor1Inc commented 6 years ago

Putting --with-libiconv-prefix=/opt/local in make.sh and adding "-L/opt/local/lib -liconv" to the build-binary allowed for a successful compile. Thanks for the pointers.

Funny thing is that i didn't have this problem on another machine using the same OS version. Odd.

mgorges commented 6 years ago

It is something about having (or not having) macports in your path. Will need to look into this more next week to see how to patch, as I currently can't reproduce it.