Boost logo

Boost :

Subject: [boost] How to make bjam use gcc instead of g++ using custom compiling and linking options
From: Edson Eustachio (edson.eustachio_at_[hidden])
Date: 2014-06-22 11:17:24


Due to some environment settings I cannot change, I have to build a lib
using bjam instead of make. In my own development environment, I have a
Makefile that can successfuly build the lib with the following options:

gcc -x c -fPIC -shared -w -I include -o libfmtkit.so -lm src/fm5x.c
src/fmTXT.c src/fmAiq.c src/fmArray.c src/fmCalc.c src/fmCandle.c
src/fmCT.c src/fmCSI.c src/fmDate.c src/fmDJ.c src/fmFile.c
src/fmFin.c src/fmFS.c src/fmPNF.c src/fmStr.c src/fmTc.c
src/fmTrade.c src/fmTT.c

So, I want to reproduce the options above in a Jamfile The first step is
replace g++ by gcc. I've already found this can be done adding the rule
using gcc But when I do that I got :

$ bjam error: at /usr/share/boost-build/build/project.jam:825 error:
duplicate initialization of gcc with the following parameters: error:
version = 4.4.3

So, I conclude I am already using gcc instead g++. Is that right?

The second step is overwrite the options -fPIC -shared -w to the my Jamfile
Below is the Jamfile:

lib fmtkit :
        src/fm5x.c
        src/fmAiq.c
        src/fmArray.c
        src/fmCSI.c
        src/fmCT.c
        src/fmCalc.c
        src/fmCandle.c
        src/fmChartW.c
        src/fmDJ.c
        src/fmDate.c
        src/fmFS.c
        src/fmFile.c
        src/fmFin.c
        src/fmGraph.c
        src/fmPNF.c
        src/fmStr.c
        src/fmTT.c
        src/fmTXT.c
        src/fmTc.c
        src/fmTrade.c

       : <include>include
       : <link>shared;

I've passed thru the boost documentation but I've not found or I'm not able
to understand how to do that into my Jamfile. Does anyone have some clue of
where should I find instructions to setting that?

This is the output I get when I try to build the lib using the Jamfile
described above:

$ bjam...found 81 targets......updating 3 targets...
gcc.compile.c bin/gcc-4.4.3/debug/fmChartW.oIn file included from
src/fmChartW.c:7:
include/fmChartW.h:163: error: expected ')' before 'hdc'
include/fmChartW.h:166: error: expected ')' before 'hdc'
include/fmChartW.h:175: error: expected ')' before 'hdc'
include/fmChartW.h:176: error: expected ')' before 'hdc'
src/fmChartW.c:13: error: expected ')' before 'hdc'
src/fmChartW.c:300: error: expected ')' before 'hdc'
src/fmChartW.c: In function 'fmChartScreenInit':
src/fmChartW.c:323: warning: implicit declaration of function 'malloc'
src/fmChartW.c:323: warning: incompatible implicit declaration of
built-in function 'malloc'
src/fmChartW.c:329: warning: implicit declaration of function 'free'
src/fmChartW.c:329: warning: incompatible implicit declaration of
built-in function 'free'
src/fmChartW.c: In function 'fmChartScreenClose':
src/fmChartW.c:350: warning: incompatible implicit declaration of
built-in function 'free'
src/fmChartW.c: At top level:
src/fmChartW.c:396: error: expected ')' before 'hdc'
src/fmChartW.c:604: error: expected ')' before 'hdc'
"g++" -x c -O0 -fno-inline -Wall -g -fPIC -I"include" -c -o
"bin/gcc-4.4.3/debug/fmChartW.o" "src/fmChartW.c"
...failed gcc.compile.c bin/gcc-4.4.3/debug/fmChartW.o...
gcc.compile.c bin/gcc-4.4.3/debug/fmGraph.o
...

src/fmGraph.c:2544: error: 'fmSCALETYPESEMILOG' undeclared (first use
in this function)
src/fmGraph.c:2546: error: dereferencing pointer to incomplete type
src/fmGraph.c:2546: error: dereferencing pointer to incomplete type
src/fmGraph.c:2546: error: dereferencing pointer to incomplete type
src/fmGraph.c:2546: error: dereferencing pointer to incomplete type
src/fmGraph.c:2546: error: dereferencing pointer to incomplete type
src/fmGraph.c:2546: error: dereferencing pointer to incomplete type
src/fmGraph.c:2546: error: dereferencing pointer to incomplete type
src/fmGraph.c:2546: error: dereferencing pointer to incomplete type
src/fmGraph.c:2547: error: dereferencing pointer to incomplete type
src/fmGraph.c:2551: error: dereferencing pointer to incomplete type
src/fmGraph.c:2551: error: dereferencing pointer to incomplete type
src/fmGraph.c:2551: error: dereferencing pointer to incomplete type
src/fmGraph.c:2551: error: dereferencing pointer to incomplete type
src/fmGraph.c:2551: error: dereferencing pointer to incomplete type
src/fmGraph.c:2551: error: dereferencing pointer to incomplete type
src/fmGraph.c:2552: error: dereferencing pointer to incomplete type
src/fmGraph.c: In function 'fmGraphYpos':
src/fmGraph.c:2565: error: 'fmSCALETYPESEMILOG' undeclared (first use
in this function)
src/fmGraph.c:2573: error: 'fmSCALETYPEINVERTED' undeclared (first use
in this function)
"g++" -x c -O0 -fno-inline -Wall -g -fPIC -I"include" -c -o
"bin/gcc-4.4.3/debug/fmGraph.o" "src/fmGraph.c"
...failed gcc.compile.c bin/gcc-4.4.3/debug/fmGraph.o......skipped
<pbin/gcc-4.4.3/debug>libfmtkit.so for lack of <pbin/gcc-
4.4.3/debug>fmChartW.o......failed updating 2 targets......skipped 1
target...

Thanks in advance


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk