Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

[fix] build/ and libbase/mliconv.c: Fix the bui…

…ld on FreeBSD with libiconv.
  • Loading branch information...
1 parent af6c538 commit 62907d89235997e3e04d3aacda80ff805da87bfc @jlmess77 committed
Showing with 9 additions and 4 deletions.
  1. +6 −1 build/
  2. +3 −3 libbase/mliconv.c
7 build/
@@ -549,9 +549,14 @@ let _ = dispatch begin function
flag ["ocaml"; "native"; "link"; tag] (S[A"-ccopt";A("-L"^dir);A"-cclib";A("-l"^name)]);
- (* In the memory.c in FreeBSD part that uses kvm_getprocs() required link with -lkvm. *)
if is_fbsd then
+ (* In the memory.c in FreeBSD part that uses kvm_getprocs() required
+ link with -lkvm. *)
flag ["use_stubs"; "link"] (S[A "-cclib";A "-lkvm"]);
+ (* Build with converters/libiconv port, which it installs in the
+ /usr/local by default *)
+ flag ["iconv"; "compile"] (S[A"-I";A "/usr/local/include"]);
+ flag ["iconv"; "link"] (S[A"-ccopt";A "-L/usr/local/lib";A "-cclib";A "-liconv"]);
(* -- Don't forget that the rest of the "mlstate build stdlib" is in --
-- The rest comes from the build_rules*.ml in each repo -- *)
6 libbase/mliconv.c
@@ -137,9 +137,9 @@ CAMLprim value mliconv_convert(value conv, value source)
CAMLparam2(conv, source);
struct mliconv_t *internal = mliconv_val(conv);
-/* #if !defined(__APPLE__) */
-/* const */
-/* #endif */
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
+ const
char *s = String_val(source);
size_t s_len = caml_string_length(source);
size_t d_len = s_len * 6;

2 comments on commit 62907d8


I am not sure if it's right to have FreeBSD define in the mliconv.c, because it is using libiconv from in our ports tree. I think that they usually use the 'HAVE_LIBICONV' define for that. If I change it from FreeBSD define to HAVE_LIBICONV, is it going to break other platforms?


Or maybe it was '_LIBICONV_H'? Umm, I don't remember. Gotta to google for it.

Please sign in to comment.
Something went wrong with that request. Please try again.