Unfortunately CC = gcc did not work.
I figured it out at last. The correct incantation is:

COMPONENT_BUILD_ARGS += CC=gcc

That passes "CC=gcc" to the "make".

With kind regards,
Denys Rtveliashvili

FWIW I have NEVER ever seen a makefile that used a variable named COMPILER.  Moreover, 
given that Gnu make supports C, C++ and several flavors of FORTRAN by default, it seems 
unlikely that COMPILER is used anywhere.  You can test that assertion by not setting 
COMPILER and adding an "@echo $COMPILER" line to the all target.

I think you're misreading the make output.  It's referencing calling the linker.  
The Gnu crowd like to have the compiler frontend do everything.  That's OK for 
single language packages, but doesn't work very well for a mixture of C++, C & 
FORTRAN.

The normal makefile directive is:

CC = gcc

or

CC = /my/path/gcc

with the required tabs at the start of the rule.

In any event, "CC=gcc make library" is unlikely to work.

make library CC=gcc

or make CC=gcc library

are normal invocations of make.

Hope this helps,
Reg

--------------------------------------------
On Sun, 5/15/16, Denys Rtveliashvili <[email protected]> wrote:

  Subject: [oi-dev] Specifying GCC as a compiler in a Makefile for simple       
library
  To: "OpenIndiana Developer mailing list" <[email protected]>
  Date: Sunday, May 15, 2016, 6:19 PM
Hello, I am trying to build a very simple library. That library has a Makefile and the correct way to
  build it on
      Illumos would be to do this:
CC=gcc make library So I wrote a Makefile for a oi-userland package with the
  following
      in it:
COMPILER= gcc include
  $(WS_MAKE_RULES)/prep.mk
include $(WS_MAKE_RULES)/justmake.mk include $(WS_MAKE_RULES)/ips.mk However, gmake build fails: symlink cloning /root/oi-userland/components/library/http-parser/http-parser-2.1
        to
  /root/oi-userland/components/library/http-parser/build/i86
(cd
  /root/oi-userland/components/library/http-parser/build/i86;
        /usr/bin/env LD_OPTIONS="-M
  /usr/lib/ld/map.noexstk -M
        /usr/lib/ld/map.noexdata -M /usr/lib/ld/map.pagealign
  -Bdirect -z
        ignore" LD_EXEC_OPTIONS="-z
  aslr=disable" CCACHE="/usr/bin/ccache"
        CC_gcc_32="/usr/gcc/4.9/bin/gcc"
        CC_gcc_64="/usr/gcc/4.9/bin/gcc"
  CXX_gcc_32="/usr/gcc/4.9/bin/g++"
        CXX_gcc_64="/usr/gcc/4.9/bin/g++"
CCACHE_BASEDIR="/root/oi-userland/components/library/http-parser/build/i86"
        /usr/gnu/bin/make  library)
make[1]: Entering directory '/root/oi-userland/components/library/http-parser/build/i86' cc -I. -DHTTP_PARSER_STRICT=0 -Wall -Wextra
  -Werror -O3
        -fPIC -c http_parser.c -o libhttp_parser.o
cc: -W option with unknown program all So it is clear that it makes use of the
  "COMPILER" variable,
      otherwise it would not have had "CC_gcc_32" in
  the messages.
      However, it looks like it does not pass CC variable to
  the Makefile
      it eventually calls, so that Makefile is using the
  default (and
      incompatible) compiler.
Please can you suggest something? With kind regards, Denys Rtveliashvili -----Inline Attachment Follows----- _______________________________________________
  oi-dev mailing list
  [email protected]
  http://openindiana.org/mailman/listinfo/oi-dev

_______________________________________________
oi-dev mailing list
[email protected]
http://openindiana.org/mailman/listinfo/oi-dev


_______________________________________________
oi-dev mailing list
[email protected]
http://openindiana.org/mailman/listinfo/oi-dev

Reply via email to