compiling erlang-iconv on a Mac

32 views
Skip to first unread message

Andreas Stenius

unread,
Dec 28, 2011, 5:03:47 PM12/28/11
to zotonic-developers
Hi,

I've not spent too much time trying to solve this (yet).
But in my attempt to take a sneak peak at zynamo, I stumbled upon
getting erlang-iconv compiled.

I've done a git submodule init and update, resulting in this list:
astekk:zotonic kaos$ git submodule
fbb957b87691e705f58a70201505436431610dab deps/basho_stats (basho_stats-1.0.1)
0292a574f5a7fdba561d11f1f8e0c1bc00b86308 deps/erlang-iconv (heads/master)
816af03ec05ff257214f7e95de77d433565d8504 deps/gen_smtp (heads/master)
b87916fc4419c7d3d899a99c85e49208a42c130d deps/statz (heads/master)
36989b32b2aaed335f0fbb241558e04a0cb8ca31 deps/webzmachine (heads/master)

Trying to make yields some errors....

astekk:zotonic kaos$ make
cd deps/erlang-iconv && ./rebar compile
==> erlang-iconv (compile)
Compiled src/iconv_app.erl
Compiled src/iconv.erl
Compiling c_src/iconv_drv.c
c_src/iconv_drv.c:6:19: error: stdio.h: No such file or directory
c_src/iconv_drv.c:7:20: error: stdlib.h: No such file or directory
c_src/iconv_drv.c:8:20: error: string.h: No such file or directory
c_src/iconv_drv.c:9:19: error: iconv.h: No such file or directory
c_src/iconv_drv.c:10:19: error: errno.h: No such file or directory
In file included from c_src/iconv_drv.c:12:

Obviously, it can't find some standard header files. Which I find
slightly odd... but anyhow, is this a known issue with an easy fix, or
is it just my env that needs fixing?
(I'm not using this machine for compiling c very often....)

I'm on a system as:

astekk:zotonic kaos$ uname -a
Darwin astekk.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9
20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64

astekk:zotonic kaos$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin10.0
astekk:zotonic kaos$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


//Andreas

Arjan Scherpenisse

unread,
Dec 29, 2011, 2:59:50 AM12/29/11
to zotonic-d...@googlegroups.com
Hi Andreas,

I swapped our included iconv library with a submodule from github.
I'll have a look to see what the differences are with the one on master
(in terms of build process).

Maybe Marc can help here, he develops on a mac.

Arjan

Marc Worrell

unread,
Dec 29, 2011, 4:58:58 AM12/29/11
to zotonic-d...@googlegroups.com
Hi Andreas,

I didn't have any problems (yet) with compiling the modules.
But then I use Snow Leopard:

> Darwin Lamma.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64

I assume you are using Lion?

Did you reinstall XCode after upgrading to Lion? I reckon some things are changed there.
Maybe you can try gcc with a small "hello world" C programme?

In a couple of weeks (after the next deadline, and next backup) I will upgrade to Lion as well.

Best, Marc

Dmitrii Dimandt

unread,
Dec 29, 2011, 7:57:09 AM12/29/11
to zotonic-d...@googlegroups.com
For Lion you should try and upgrade to Xcode 4.2.1. If compilation still fails, it may be due to the fact that Xcode no longer ships gcc and some libraries are known to fail to compile with clang or llvm.

Same things was happening for Erlang compilation in brew (see this thread: https://github.com/mxcl/homebrew/issues/7691. It may help you in search for the reasons why something fails).

M-MZ

unread,
Dec 29, 2011, 2:17:23 PM12/29/11
to zotonic-d...@googlegroups.com
Hey Arjan,

A while ago I wrote a nif for iconv. The iconv zotonic is (or was?) using has a 64 kb limit. If you go over it, it will silently fail to decode things and you will get smaller chunks back. We really needed to be able to convert larger binaries, so I wrote eiconv.


Maas

Andreas Stenius

unread,
Dec 29, 2011, 5:58:51 PM12/29/11
to zotonic-d...@googlegroups.com
Thanks for the hints and pointers.

I didn't think of upgrading xcode, since I wasn't touching it (directly)...
I'll have a go with that first...

//Andreas

Arjan Scherpenisse

unread,
Dec 30, 2011, 3:41:39 AM12/30/11
to zotonic-d...@googlegroups.com, Andrew Thompson
Interesting. I think we should modify gen_smtp in that case, since iconv
is only used there within zotonic.

cc'ing Andrew Thompson.

grts Arjan

Andreas Stenius

unread,
Feb 9, 2012, 1:08:12 AM2/9/12
to zotonic-d...@googlegroups.com
It took a while, but now I finally got back to this. And as was suggested, installing the latest version of Xcode (4.2.1) solved it.

Thanks for all input on this.

//Andreas

Reply all
Reply to author
Forward
0 new messages