Bug 160492 - [patch] lang/ocaml: respect CC
[patch] lang/ocaml: respect CC
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Any Any
: Normal Affects Only Me
Assigned To: Brendan Fabeny
Depends on:
  Show dependency treegraph
Reported: 2011-09-05 21:10 UTC by aakuusta
Modified: 2012-02-23 01:27 UTC (History)
0 users

See Also:

a.diff (603 bytes, patch)
2011-09-05 21:10 UTC, aakuusta
no flags Details | Diff
patch-Makefile (1.23 KB, text/plain)
2012-02-06 22:43 UTC, michael.grunewald
no flags Details
ocaml.diff (3.98 KB, patch)
2012-02-22 02:34 UTC, bf1783
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description aakuusta 2011-09-05 21:10:01 UTC
The port tries to use `gcc' unless `-cc' option is specified.
When `gcc' is not in PATH it unconditionally falls back to `cc',
without even testing whether the latter command is also in PATH.

How-To-Repeat: http://pointyhat.freebsd.org/errorlogs/amd64-errorlogs/e.9-exp.20110723205754/ocaml-3.12.0_1.log
Comment 1 Edwin Groothuis freebsd_committer 2011-09-05 21:11:48 UTC
Responsible Changed
From-To: freebsd-ports-bugs->stas

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Thomas Abthorpe freebsd_committer 2011-11-05 03:41:12 UTC
Responsible Changed
From-To: stas->tabthorpe

- back to the heap
Comment 3 Thomas Abthorpe freebsd_committer 2011-11-09 18:59:28 UTC
Responsible Changed
From-To: tabthorpe->freebsd-ports-bugs

Really give back to the heap
Comment 4 michael.grunewald 2011-12-09 08:08:01 UTC
Being the new maintainer of lang/ocaml, I recently received notification 
of this PR.

Did you compile OCaml with something different that gcc?  While OCaml 
should be compiled by any ANSI C compiler, examination of the 
./configure script in source displays many gcc-specific behaviors.  I 
would appreciate details you can supply there.

BTW I think this fix belongs the upstream ./configure script, so I will 
submit a bug report or a patch on the OCaml bug tracking system.
Comment 5 Brendan Fabeny freebsd_committer 2011-12-09 14:48:14 UTC
Responsible Changed
From-To: freebsd-ports-bugs->bf

I'll take it. 


Date: Sat, 17 Dec 2011 08:55:22 -0500
Comment 6 michael.grunewald 2012-02-06 22:43:06 UTC
Dear Jan,

Thank you for your patch.

I tested your patch at home on amd64, it works fine and the ocaml 
compiler prepared with gcc=46 (your suggested test) succesfully does its 
job (until now!).

I think we can have your patch in FreeBSD, I prepared an updated version 
that also bumps PORTREVISION.

I also raised the issue upstream:

Comment 7 bf1783 2012-02-22 02:34:21 UTC
When looking over this patch, I found a number of other problems that
need to be fixed:

-- There is no need to set USE_LDCONFIG=yes, because we don't expose
versioned shared libraries in ${PREFIX}/lib to rtld for general use.

-- After revision 1.54 of the port Makefile, it was intended that
ocaml should use a threaded tcl/tk, and to this end, DEPENDS_ARGS sets
WITH_THREADS.  But this is risky, and it is not having the desired
effect, partly because the ocaml configure script looks for the wrong
libraries in the right directories.  Remove it, and set USE_TK_THREADS
instead when needed, while explicitly including the desired library
names in CONFIGURE_ARGS.  While here, remove the obsolete
"-with-pthread" from CONFIGURE_ARGS, which is ignored by the ocaml
configure script.  Also, explicitly disallow tcl/tk 8.6, which causes
the configure script to fail; and adjust the wish shebang line in an
example script (we can't use PATCH_TK_SCRIPTS from bsd.tcl.mk for this
because its replacements are not sufficiently general, and it
interferes with post-patch).

-- Through a logic error in the port Makefile, packages built
WITHOUT_X11 were being conflated with those built merely WITHOUT_TK.
Fix this by not overwriting SFX and CONFLICTS for the WITHOUT_X11

-- Respect LDFLAGS when linking -- we may need to do this for LTO,
stack protection, rpath arguments (like those in bsd.gcc.mk) that help
the resulting binaries find the compiler shared libraries at runtime,
etc.  Adjust the flags so that they can used indirectly, with the
compiler, and directly, with the linker. (The adjustment in the latter
case is not foolproof, but should work for most reasonable choices of
flags, and that is all we need.)

-- remove the hard-coded libdl that causes failures when searching for
libbfd from the configure script (our dlopen is in libc, as the
computation of dllib should have already established -- this will
enable compilers using devel/binutils, like lang/gcc4*, to use this

-- use the proper toolchain elements in the configure script, instead
of hard-coding "ar", "ld", and "ranlib".

--expose the testsuite, so we can more easily determine if ocaml has
problems -- do this in a way so that a single test failure won't cause
"make -k check" to grind to a halt, or issue partial logs.

--use dirrmtry for lib/ocaml in pkg-plist, instead of explicitly
defining it in the Makefile

If you agree, I will commit these changes.

Comment 8 dfilter freebsd_committer 2012-02-23 00:21:28 UTC
bf          2012-02-23 00:21:15 UTC

  FreeBSD ports repository

  Modified files:
    lang/ocaml           Makefile pkg-plist 
  respect CC [1]; fix Tcl/Tk dependencies; don't conflate -nox11 and
  -notk; add a test target; clean up
  PR:             160492 [1]
  Submitted by:   J. Beich (partial patch; under various pseudonyms?) [1]
  Approved by:    maintainer
  Revision  Changes    Path
  1.76      +35 -7     ports/lang/ocaml/Makefile
  1.38      +1 -0      ports/lang/ocaml/pkg-plist
cvs-all@freebsd.org mailing list
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 9 Brendan Fabeny freebsd_committer 2012-02-23 01:27:10 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!