Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - command-line build using mkbuild: (8 Items)
   
command-line build using mkbuild  
Hello,

I am facing an issue on my machine when building QNX projects from the command line.

Here is the context: I build several binaries inside a QNX container project, all the projects inside the container are 
QNX C++ projects. Inside several common.mk Makefiles I use an environment variable to locate includes from 3rd party 
libraries:

EXTRA_INCVPATH+=$(PROJECT_ROOT)/../../tests  \
	$(3rd_PARTY_DIR)/xsde-3.2.0-i686-windows/libxsde

The compilation works perfectly inside the IDE (Windows XP or Windows 7), but as soon as I launch the compilation from 
the command line the $(3rd_PARTY_DIR) environment variable is not replaced correctly, as can be seen in this extract of 
the compiler command output:

-ID:/svn_dev/my_project/Prj/QNX/../../tests
-I/xsde-3.2.0-i686-windows/libxsde

Here is the command line that is used:

mkbuild.bat -ws D:\svn_dev\ -projects my_project -target Build-Release

Is there something special to do so that environment variables are visible from the QNX Makefiles when using mkbuild.bat
?

Thanks for your help!
Martin
Re: command-line build using mkbuild  
Hi, Martin,

How are you setting up the environment in your build?  The environment should be inherited by the make from the IDE, 
which inherits it from the mkbuild.bat script, which inherits it from your build script.

For that matter, how are you setting this environment variable for interactive builds in the IDE?

Cheers,

Christian


On 2011-08-12, at 8:31 AM, Martin Duvanel wrote:

> Hello,
> 
> I am facing an issue on my machine when building QNX projects from the command line.
> 
> Here is the context: I build several binaries inside a QNX container project, all the projects inside the container 
are QNX C++ projects. Inside several common.mk Makefiles I use an environment variable to locate includes from 3rd party
 libraries:
> 
> EXTRA_INCVPATH+=$(PROJECT_ROOT)/../../tests  \
>         $(3rd_PARTY_DIR)/xsde-3.2.0-i686-windows/libxsde
> 
> The compilation works perfectly inside the IDE (Windows XP or Windows 7), but as soon as I launch the compilation from
 the command line the $(3rd_PARTY_DIR) environment variable is not replaced correctly, as can be seen in this extract of
 the compiler command output:
> 
> -ID:/svn_dev/my_project/Prj/QNX/../../tests
> -I/xsde-3.2.0-i686-windows/libxsde
> 
> Here is the command line that is used:
> 
> mkbuild.bat -ws D:\svn_dev\ -projects my_project -target Build-Release
> 
> Is there something special to do so that environment variables are visible from the QNX Makefiles when using mkbuild.
bat?
> 
> Thanks for your help!
> Martin
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post88059
> 
> 

Re: command-line build using mkbuild  
I don't think it is environment variable, env variables cannot start with digit. Is this IDE build variable?

On 08/12/2011 08:31 AM, Martin Duvanel wrote:
> Hello,
> 
> I am facing an issue on my machine when building QNX projects from the command line.
> 
> Here is the context: I build several binaries inside a QNX container project, all the projects inside the container 
are QNX C++ projects. Inside several common.mk Makefiles I use an environment variable to locate includes from 3rd party
 libraries:
> 
> EXTRA_INCVPATH+=$(PROJECT_ROOT)/../../tests  \
> 	$(3rd_PARTY_DIR)/xsde-3.2.0-i686-windows/libxsde
> 
> The compilation works perfectly inside the IDE (Windows XP or Windows 7), but as soon as I launch the compilation from
 the command line the $(3rd_PARTY_DIR) environment variable is not replaced correctly, as can be seen in this extract of
 the compiler command output:
> 
> -ID:/svn_dev/my_project/Prj/QNX/../../tests
> -I/xsde-3.2.0-i686-windows/libxsde
> 
> Here is the command line that is used:
> 
> mkbuild.bat -ws D:\svn_dev\ -projects my_project -target Build-Release
> 
> Is there something special to do so that environment variables are visible from the QNX Makefiles when using mkbuild.
bat?
> 
> Thanks for your help!
> Martin
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post88059
> 
Re: command-line build using mkbuild  
Hi Christian and Elena, 

Thanks for the quick answer. It is set as a Windows environment variable (system, not user), it actually does not start 
with a digit, the actual name is much longer so I shortened it for the sake of readability.
When I reproduce the problem I just launch a cmd.exe and launch the mkbuild.bat command. I have checked that the 
variable is visible if I type 'set' before launching mkbuild.bat
The IDE seems okay with that way of defining the environment variables.

Thanks!
Martin
Re: command-line build using mkbuild  
Normally make would not read env var unless -e option specified for make invocation...

On 08/12/2011 10:34 AM, Martin Duvanel wrote:
> Hi Christian and Elena, 
> 
> Thanks for the quick answer. It is set as a Windows environment variable (system, not user), it actually does not 
start with a digit, the actual name is much longer so I shortened it for the sake of readability.
> When I reproduce the problem I just launch a cmd.exe and launch the mkbuild.bat command. I have checked that the 
variable is visible if I type 'set' before launching mkbuild.bat
> The IDE seems okay with that way of defining the environment variables.
> 
> Thanks!
> Martin
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post88072
> 
Re: command-line build using mkbuild  
Ok, I just tried to create a make target 'all-env' that calls 'make -e' instead of 'make' for one of my problematic 
projects, and launch a build from the command line like this:

C:\QNX650\host\win32\x86\usr\bin>mkbuild.bat -ws d:\svn_dev\ -projects my_project -target all-env

I do not use the QNX container in this case, I just try to compile one QNX C++ project that uses my environment variable
. It did not work either (env variable is not available), here is an excerpt from the command line:

C:\QNX650\host\win32\x86\usr\bin\make.exe -e JLEVEL=3 CPULIST=ppc EXCLUDE_VARIANTLIST=spe VARIANTLIST=g EXTRA_SUFFIXES=
cpp  all --file=C:/Users/my_user/App Data/Local/Temp/QMakefile131316299032757092.tmp

C:/QNX650/host/win32/x86/usr/bin/make.exe -j 3 -Cppc -fMakefile all make.exe[1]: Entering directory `D:/svn_dev/projects
/QNX/6.5/my_project/ppc'

C:/QNX650/host/win32/x86/usr/bin/make.exe -j 3 -Co-be-g -fMakefile all make.exe[2]: Entering directory `D:/svn_dev/
projects/QNX/6.5/my_project/ppc/o-be-g'

...

So the first make call takes correctly the -e argument, but it is not present anymore in the following calls. This is 
where I am a bit lost in the way the QNX build chain is instantiated, how and where should I specify the -e option for 
make? Is it somewhere in the common.mk file?

Thanks again!
Martin
Re: command-line build using mkbuild  
So I couldn't solve the issue but found a workaround for now, which is to have the following lines in my common.mk file:


ifndef 3rd_PARTY_DIR
3rd_PARTY_DIR=C:/3rd-Party-Software
endif

With the absolute path of the folder on the automated build machine. This way it works using the environment variable on
 my developer PC, and it takes the build machine specific value when run from the command line on the build machine.

I have another problem now: according to the mkbuild documentation, a return value of 0 means an error occured, whereas 
a return value >0 means success:
http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=/com.qnx.doc.neutrino_utilities/m/mkbuild.html

However when building a QNX container project, I observe the opposite behaviour: return value of 0 for success and 1 for
 errors. Is there a way to avoid making an explicit test on the type of project built before testing the return value? 
And where should I report this bug?

Thank you,
Martin

PS: the documentation of mkbuild for QNX containers is really lacky, one should specify its container configuration to 
be built with the -target option, not the -variant as suggested.
Re: command-line build using mkbuild  
My mistake, mkbuild ALWAYS returns 0 after building a container project, error or no errors. This is even more annoying.
.. I guess I will have to parse the output :-(