tee3 / boost-build-iar

A Boost.Build toolset for the IAR C/C++ Compiler
Boost Software License 1.0
0 stars 0 forks source link

How to build? #1

Open TGMM opened 3 years ago

TGMM commented 3 years ago

Hello, I'm extremely new to the B2 world and I've been wanting to build the boost library using the IAR compiler. I saw the toolset and I thought I'd give it a try, I have no experience using toolsets (nor B2) mind you.

I've configured my project-config.jam as such:

import option ; 

using iccarm : 8.30.1 : "C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.1/arm/bin/iccarm.exe" ; 

option.set keep-going : false ; 

And i'm getting the following error: boost/tools/build/src/build\property.jam:811: in class@property-map.find from module object(property-map)@37 error: Ambiguous key

After looking for it for a bit I noticed you encountered the same issue a while ago and posted your workaround in this issue. But the repo with the workaround is not there anymore, so I'm wondering what the solution is.

I'm sorry for bothering you, any help is appreciated. Thanks in advance.

tee3 commented 3 years ago

It's been quite a while since I worked with the IAR compiler, but I would be glad to try to help.

It looks like this toolset does not have the code that broke B2 in that issue, so it might be another issue. What version of Boost.Build are you using and on what system? Can you post more of the error output?

TGMM commented 3 years ago

So these are the steps I followed I went to the boost page and downloaded the latest version, which was 1.74.0 (it's now 1.75.0). I unzipped it, opened the tools folder then the build folder. Then ran the bootstrap.bat with mingw as argument. (.\bootstrap.bat mingw) I copied the iccarm.jam file to the root folder and to the tools/build folder. This is the part where I get lost, if I run .\b2 --toolset=iccarm in the tools/build folder I get the following output:

Jamroot.jam:107: in modules.load from module Jamfile<C:\Users\TGMM\Documents\boost_1_74_0\tools\build>
warning: Bison generator program 'bison' not found. Skipping grammar build.
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\project.jam:372: in load-jamfile from module project
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\project.jam:64: in load from module project
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\project.jam:142: in project.find from module project
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src\build-system.jam:618: in load from module build-system
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/kernel\modules.jam:295: in import from module modules
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/kernel/bootstrap.jam:139: in boost-build from module
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/boost-build.jam:8: in module scope from module
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\feature.jam:327: in validate-feature from module feature
error: unknown feature "<testing.launcher>"
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\feature.jam:361: in expand-subfeatures-aux from module feature
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\feature.jam:422: in expand-subfeatures from module feature
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\feature.jam:871: in feature.expand from module feature
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\targets.jam:1104: in evaluate-requirements from module targets
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\targets.jam:1122: in common-properties2 from module targets
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\targets.jam:1018: in targets.common-properties from module targets
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\targets.jam:1314: in class@basic-target.generate from module object(alias-target-class)@113
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\targets.jam:812: in generate-really from module object(main-target)@144
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\targets.jam:784: in class@main-target.generate from module object(main-target)@144
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/build\targets.jam:273: in class@project-target.generate from module object(project-target)@95
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src\build-system.jam:797: in load from module build-system
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/kernel\modules.jam:295: in import from module modules
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/src/kernel/bootstrap.jam:139: in boost-build from module
C:/Users/TGMM/Documents/boost_1_74_0/tools/build/boost-build.jam:8: in module scope from module

I tried following the guide at the boost repo instead and modifying the generated project-config.jam with the following:

import option ; 

using iccarm : 8.30.1 : "C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.1/arm/bin/iccarm.exe" ; 

option.set keep-going : false ; 

and when I run b2 (which generates in the root folder instead of the tools/build one) I get this:

C:/Users/TGMM/Documents/boost/tools/build/src/build\property.jam:811: in class@property-map.find from module object(property-map)@37
error: Ambiguous key
C:/Users/TGMM/Documents/boost/tools/build/src/build\type.jam:334: in generated-target-ps from module type
C:/Users/TGMM/Documents/boost/tools/build/src/build\type.jam:271: in type.generated-target-suffix from module type
C:/Users/TGMM/Documents/boost/tools/build/src/build\virtual-target.jam:531: in virtual-target.add-prefix-and-suffix from module virtual-target
C:/Users/TGMM/Documents/boost/tools/build/src/build\virtual-target.jam:490: in _adjust-name from module object(file-target)@8863
C:/Users/TGMM/Documents/boost/tools/build/src/build\virtual-target.jam:287: in abstract-file-target.__init__ from module object(file-target)@8863
C:/Users/TGMM/Documents/boost/tools/build/src/build\virtual-target.jam:583: in class@file-target.__init__ from module object(file-target)@8863
C:/Users/TGMM/Documents/boost/tools/build/src/kernel\class.jam:90: in class.new from module class
C:/Users/TGMM/Documents/boost/tools/build/src/build\generators.jam:576: in generated-targets from module object(C-compiling-generator)@92
C:/Users/TGMM/Documents/boost/tools/build/src/build\generators.jam:468: in construct-result from module object(C-compiling-generator)@92
C:/Users/TGMM/Documents/boost/tools/build/src/build\generators.jam:418: in run-really from module object(C-compiling-generator)@92
C:/Users/TGMM/Documents/boost/tools/build/src/build\generators.jam:392: in class@generator.run from module object(C-compiling-generator)@92
C:/Users/TGMM/Documents/boost/tools/build/src/build\generators.jam:1019: in try-one-generator-really from module generators
C:/Users/TGMM/Documents/boost/tools/build/src/build\generators.jam:1081: in try-one-generator from module generators
C:/Users/TGMM/Documents/boost/tools/build/src/build\generators.jam:1319: in construct-really from module generators
C:/Users/TGMM/Documents/boost/tools/build/src/build\generators.jam:1405: in generators.construct from module generators
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:1615: in construct from module object(typed-target)@449
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:1364: in class@basic-target.generate from module object(typed-target)@449
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:812: in generate-really from module object(main-target)@8844
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:784: in class@main-target.generate from module object(main-target)@8844
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:934: in targets.generate-from-reference from module targets
C:/Users/TGMM/Documents/boost/tools/build/src/build\configure.jam:367: in find-builds-raw from module configure
C:/Users/TGMM/Documents/boost/tools/build/src/build\configure.jam:457: in configure.find-builds from module configure
C:/Users/TGMM/Documents/boost\boostcpp.jam:591: in boostcpp.deduce-address-model from module boostcpp
C:/Users/TGMM/Documents/boost/tools/build/src/kernel\modules.jam:107: in modules.call-in from module Jamfile<C:\Users\TGMM\Documents\boost>
C:/Users/TGMM/Documents/boost/tools/build/src/util\indirect.jam:105: in indirect.call from module indirect
C:/Users/TGMM/Documents/boost/tools/build/src/build\property.jam:132: in property.evaluate-conditionals-in-context from module property
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:1088: in evaluate-requirements from module targets
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:1122: in common-properties2 from module targets
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:1018: in targets.common-properties from module targets
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:1314: in alias-target-class.generate from module object(top-level-target)@445
C:/Users/TGMM/Documents/boost\boostcpp.jam:403: in build-multiple from module object(top-level-target)@445
C:/Users/TGMM/Documents/boost\boostcpp.jam:393: in class@top-level-target.generate from module object(top-level-target)@445
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:812: in generate-really from module object(main-target)@8834
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:784: in class@main-target.generate from module object(main-target)@8834
C:/Users/TGMM/Documents/boost/tools/build/src/build\targets.jam:273: in class@project-target.generate from module object(project-target)@97
C:/Users/TGMM/Documents/boost/tools/build/src\build-system.jam:797: in load from module build-system
C:/Users/TGMM/Documents/boost/tools/build/src/kernel\modules.jam:295: in import from module modules
C:/Users/TGMM/Documents/boost/tools/build/src/kernel/bootstrap.jam:139: in boost-build from module
C:/Users/TGMM/Documents/boost/boost-build.jam:17: in module scope from module

As you can probably tell, I don't know what I'm doing. Thanks for taking the time to read this.

tee3 commented 3 years ago

I will try to help you out. However, what you are doing is fairly complicated and will require learning a bit about B2. I have created an (untested) recipe below to get you started.

I would not recommend changing the Boost.Build installation. You should definitely revert back to the standard Boost installation before continuing. You should not have to do that to use the IAR toolset.

I would encourage you to ask questions at the Boost.Build mailing list (https://lists.boost.org/mailman/listinfo.cgi/boost-build). To use B2 more effectively, there is a lot more to learn.

There are a couple of things to note here.

Here is a very simple approach that will work. The steps below should get you started. Basically, we just tell B2 where to find boost-build-iar and we set some features properly on the command line. The directories I use below are examples, you will have to set yourself up how you like.

  1. Check out boost-build-iar to a directory somewhere on your hard drive (C:\TEMP\boost-build-iar).
git clone https://github.com/tee3/boost-build-iar.git C:\TEMP\boost-build-iar
  1. Create a directory for your project somewhere (C:\TEMP\yourproject).
mkdir C:\TEMP\yourproject
  1. Switch to that project.
cd C:\TEMP\yourproject
  1. Create a simple C file named hello.c with the following contents.
int main () { return 0; }
  1. Create a Jamroot to build main.
exe hello : hello.c ;
  1. Create a project-config.jam file with the following contents.
using iccarm : 8.30.1 : "C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.1/arm/bin/iccarm.exe" ; 
  1. Build the hello program using the desired toolset from the command line. The build products will be located within the bin directory.
C:\TEMP\yourproject> set BOOST_BUILD_PATH=C:\TEMP\boost-build-iar
C:\TEMP\yourproject> b2 toolset=iccarm=8.30.1 target-os=elf link=static

Note that if you run the project as follows without any changes, you will build the native version of hello, also in the bin directory, but with a different path reflecting your default compiler.

C:\TEMP\yourproject> b2

Good luck!