Is it possible to build with a different C++ standard?

Is there any support / options for building OpenCPI under C++17 please?

At this time there is no way to build OpenCPI using C++17. This is something we are looking at in our roadmap; supporting later versions of C++.

Whilst you can’t easily compile the framework in newer C++, you can use newer C++ for your ACI applications by adding something like this to the Makefile:

# Pick the relevant compile option for your compiler
RccExtraCompileOptions=-std=c++14
include $(OCPI_CDK_DIR)/include/application.mk

I think this can also work for RCC Workers, but again you need to add a Makefile:

# Pick the relevant compile option for your compiler
RccExtraCompileOptions=-std=c++14
include $(OCPI_CDK_DIR)/include/rcc/rcc-worker.mk
2 Likes

Thank you again for all your help @aolivarez @waltersdom ! You’ve both been extremely helpful for me getting started with OpenCPI. Cheers

Sorry to bug you again @waltersdom, but I’m struggling to get this to work. I originally thought you meant the gen/worker-name.mk file, but this is overwritten when I “ocpidev build” and so obviously those changes are lost.

Where should I add a Makefile with those two lines please?

Thank you in advance!

In the worker directory itself, in a file called Makefile.

Basically, before the XMLs took over, all workers needed a Makefile in them. This is one of the settings that remain available in that file but not in the XML (AFAIK).

With those changes I now get:

make: *** No rule to make target ‘gen/-build.xml’, needed by ‘…/lib/rcc/-build.xml’. Stop.

Maybe there are some vars missing?

Here’s a minimal reproducible example:

# starting from the OpenCPI root directory
source ./cdk/opencpi-setup.sh -s 
cd projects/test
ocpidev create component test_rcc_compile_options
ocpidev create worker test_rcc_compile_options.rcc
cd components/test_rcc_compile_options.rcc
echo -e "RccExtraCompileOptions=-std=c++17\ninclude \$(OCPI_CDK_DIR)/include/worker.mk" > Makefile
ocpidev build

Since the skeleton file does not contain any C++ you’ll see a warning on the output. Below is what my output looks like.

Compiling test_rcc_compile_options.cc for target linux-u20_04-x86_64, configuration 0
Generating dispatch file: target-ubuntu20_04/test_rcc_compile_options_dispatch.c
Compiling target-ubuntu20_04/test_rcc_compile_options_dispatch.c for target linux-u20_04-x86_64, configuration 0
cc1: warning: command line option ‘-std=c++17’ is valid for C++/ObjC++ but not for C
Generating artifact/runtime xml file target-ubuntu20_04/test_rcc_compile_options_assy-art.xml for all workers in one binary
Linking final artifact file "target-ubuntu20_04/test_rcc_compile_options.so" and adding metadata to it...
Creating link to export worker binary: ../lib/rcc/ubuntu20_04/test_rcc_compile_options.so -> target-ubuntu20_04/test_rcc_compile_options.so
Creating link from ../lib/rcc -> test_rcc_compile_options-rcc.xml to expose the test_rcc_compile_options implementation xml.
1 Like

Awesome, thank you @aolivarez. I think I had an old gen directory lying around. After a clean, THEN create the Makefile, then build again and all is working :slightly_smiling_face:

Thanks to you both, again!