Technical Blog Post
Abstract
SDK1.10: How to create a project using IBM XL C/C++ Compiler Community Edition on IBM SDK for Linux on Power
Body
Overview
Coming with the new IBM SDK 1.10 release is the support for XL C/C++ Compiler Community Edition projects. On this post you will learn how to create and run an XL project from inside the IBM SDK 1.10.
Considerations
Due to XL C/C++ CE support to ppc64le architecture only, the creation of projects using such compiler is only possible locally on Power Systems. That can be done by direct physical access to a Power system, via VNC or by exporting X to your system.
Installing the XL C/C++ Community Edition
To install the XL C/C++ Community Edition, simply follow the instructions on their official repository page regarding your Linux distribution.
The ideal environment would be to install XLC after IBM Advance Toolchain, to make use of linkage and imports done by AT.
From their web page:
Using the Advance Toolchain with IBM XLC and XLF When compiling binaries using XLC or XLF, the user must add the -F <path_to_cfg_file> option to the compiler command line. The Advance Toolchain provides a script that creates those files in /opt/atX.X/scripts. This script is automatically run during installation. If you need to re-run it later (i.e. you installed XLC/XLF after the Advance Toolchain installation), execute the following command: /opt/atX.X/scripts/at-create-ibmcmp-cfg.sh Please notice the absolute path when calling the script. DO NOT call it using a relative path. The script creates the config files in /opt/atX.X/scripts. This procedure does not affect the default XLC/XLF configuration. |
Creating a project
Considering you have full access to a graphical desktop to your Power system, proceed by doing as follows:
- Open IBM SDK via launcher or via command line from a terminal by issuing /opt/ibm/ibm-sdk-lop/ibm-sdk-lop
- Go to File > New > Other...
- From the list of available Wizards, open xlC CE Toolchain C/C++ Project, select the type of project you will create and press Next:
Image 1: xlC CE Toolchain C Project
- In the next window, insert a Project name, and whether it will be an Empty Project or a project template, and click Finish:
Image 2: Executable project type and compiler selected
The project will be created. If you chose a template to start with, you will see the <project_name>.c file open, and the project directory on the Project Explorer View:
Image 3: "xlc-project" directory and the "xlc-project.c"
- To run the project, right click on the project name, on the Project Explorer tab, then click on Build Project. The Binaries folder will be created and there you can find your binary file.
Image 4: Binary selected
- To run your program, right click on the binary file and select Run As > Local C/C++ Application. The output will be displayed in the console tab, in the bottom window.
Image 6: Application run result at the Console tab
Conclusion
Creating and running an XL C/C++ Compiler Community Edition project is as easy as 6 steps. The trick relies solely in migrating your code to this structure.
Note: you can also import your project as a Makefile project, using the wizard for that, and then adapt your Makefile to make use the xlC compiler.
Once again, keep in mind that XL C/C++ Compiler Community Edition can only operate on ppc64le architectures, so projects have to be created locally in the Power System (meaning that remote/synchronized projects are not yet supported).
Have fun with your code.
UID
ibm16170055