Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005418OCamlOCaml generalpublic2011-12-09 09:192014-09-22 22:12
Reportermichi 
Assigned To 
PrioritylowSeveritytrivialReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformAllOSAllOS VersionAll
Product Version3.12.1 
Target Versionafter-4.02.1Fixed in Version 
Summary0005418: Configure script does not honour honor CC environement variable
DescriptionOCaml's configure script does not honor some environment variables used by some other configure scripts to convey configuration options. Taking these variables into account makes OCaml build procedure blend smoothly in OS packages systems.

The targeted variables are: CC, AS.
Tagspatch
Attached Filespatch file icon configure.patch [^] (266 bytes) 2011-12-09 09:19 [Show Content]

- Relationships

-  Notes
(0006364)
meyer (developer)
2011-12-17 19:51

Hello,

I am not sure what kind of improvement it gives over -cc and -as command line options. In particular, how it should interact with these.

My worry is also that it's too implicit. Why not to say ./configure -cc ${CC} -as ${AS} ?

However I'm not maintaining any packages, so I have no strong evidence if such tweak to environment would work out much better. If you provide some examples how it will improve packaging I'd be grateful.

Best,
Wojciech
(0006891)
michi (reporter)
2012-02-06 23:41

Hi Wojciech,

Mantis Bug Tracker wrote:

> I am not sure what kind of improvement it gives over -cc and -as command line
> options. In particular, how it should interact with these.
>
> My worry is also that it's too implicit. Why not to say ./configure -cc ${CC}
> -as ${AS} ?

This way of passing arguments to configure files is consistent with the way to pass arguments to Makefiles. GNU Autotools (autoconf et al.) also stick to this convention.

(Most probably, people working on a project requiring fancy compiler options have a shell code snippet setting CC, CFLAGS, etc. that they can source before starting to work in the project.)

> However I'm not maintaining any packages, so I have no strong evidence if such
> tweak to environment would work out much better. If you provide some examples
> how it will improve packaging I'd be grateful.

Taking CC into account makes packaging easier, because CC just works the same way as with other packages. At that time, the FreeBSD port patches ocaml's Makefiles to let them understand CC.

If you are open for a patch, I will submit you a more accurate version than the one I sent the first time.

Best,
Michael
(0006900)
doligez (administrator)
2012-02-08 17:51
edited on: 2014-07-16 20:08

I tend to agree with Wojciech, it's too implicit. More than once I've had a spurious environment variable that caused strange errors and wasted a lot of my time.

See the discussion of 0005385 for an example.

Also, it's not clear whether you want to change the behaviour of "configure" or the Makefiles themselves.

(0006901)
michi (reporter)
2012-02-08 20:27

It seems that the FreeBSD port will keep its patch to the upstream build system for quite a long timeā€¦ which is also fine, as far as I am concerned.

However, while I agree that configuration options passed by environment variable may be a bit implicit (and it sometimes bate me as well), I would like to make two points:

1. There is many build systems using environment variables like CC, CFLAGS and so on as parameters. At least the BSD build system (bsd.prog.mk for instance), the gnu autotools, and virtually *all* make-alike utility comes with default rules involving these environment variables. So environment variables like CC, CFLAGS, and so on, are stamped `use with caution` and caution they deserve.

2. What is broken is not the use environment variables to pass options to a procedure, but inconditionnaly setting them! I have some projects requiring paricular environment variables to be set. Instead of globally setting these variables, I have a .tcshrc file in the root dir of the project, say ~/project/x and an alias project_x='cd ~/project/x && source .tcshrc' which sets me ready to work on the project.

Console programs in KDE or OS-X also have a notion of `profile` that gives another convenient way to associate custom shells to projects.

Best regards,
Michael
(0008142)
avsm (reporter)
2012-09-22 00:10

I don't quite understand why the FreeBSD port needs to patch any Makefiles. The OpenBSD port simply passes:

CONFIGURE_ARGS+=-cc '${CC} ${CFLAGS}'

which lets the ports system work fine with a custom CC and/or CFLAGS.
(0008408)
michi (reporter)
2012-11-01 21:01

While porting ocaml-4.00.1 I decided to switch the old strategy I inherited with the port to the one you suggested.

Meanwhile I noticed that gcc is hardcoded Makefile portions generating dependencies (grep for 'gcc -MM'). The concerned files are:

> find . -name Makefile | xargs grep -l 'gcc -MM'
./asmrun/Makefile
./byterun/Makefile
./otherlibs/bigarray/Makefile
./otherlibs/graph/Makefile
./otherlibs/num/Makefile
./otherlibs/str/Makefile
./otherlibs/systhreads/Makefile
./otherlibs/threads/Makefile
./otherlibs/unix/Makefile

As FreeBSD maintainer of the port, I am interested in using clang as a compiler and 'clang -MM' does the same work as 'gcc -MM'.

I made simple tests, and it seems that 'gcc/clang -MM' works fine when given superfluous options, so it could be an acceptable solution to replace 'gcc -MM' by '${CC} -MM'.
(0009752)
doligez (administrator)
2013-07-11 16:19

I don't like having gcc hard-coded in the Makefiles. We should see if we can change that.

- Issue History
Date Modified Username Field Change
2011-12-09 09:19 michi New Issue
2011-12-09 09:19 michi File Added: configure.patch
2011-12-17 18:04 meyer Assigned To => meyer
2011-12-17 18:04 meyer Status new => assigned
2011-12-17 19:51 meyer Note Added: 0006364
2011-12-31 02:41 meyer Status assigned => acknowledged
2011-12-31 02:41 meyer Assigned To meyer =>
2012-02-06 23:41 michi Note Added: 0006891
2012-02-08 17:51 doligez Note Added: 0006900
2012-02-08 20:27 michi Note Added: 0006901
2012-09-06 16:47 doligez Target Version => 4.00.1+dev
2012-09-20 18:04 doligez Target Version 4.00.1+dev => 4.00.2+dev
2012-09-22 00:10 avsm Note Added: 0008142
2012-11-01 21:01 michi Note Added: 0008408
2013-07-11 16:19 doligez Note Added: 0009752
2013-07-11 16:19 doligez Target Version 4.00.2+dev => 4.02.0+dev
2013-07-12 18:15 doligez Target Version 4.02.0+dev => 4.01.1+dev
2013-11-29 11:43 doligez Tag Attached: patch
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-07-16 20:08 doligez Note Edited: 0006900 View Revisions
2014-07-16 20:10 doligez Target Version 4.02.0+dev => 4.02.1+dev
2014-09-04 00:25 doligez Target Version 4.02.1+dev => undecided
2014-09-22 22:12 doligez Target Version undecided => after-4.02.1


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker