56
Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Student Workbook Author: Bonnie Aona Copyright © 2010 Intel Corporation All Rights Reserved Revision: 12.0 World Wide Web: http://www.intel.com

Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Embed Size (px)

Citation preview

Page 1: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

Student Workbook

Author: Bonnie Aona

Copyright © 2010 Intel Corporation

All Rights Reserved

Revision: 12.0

World Wide Web: http://www.intel.com

Page 2: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

Disclaimer and Legal Information

The information contained in this document is provided for informational purposes only and represents the current view of Intel Corporation (“Intel”) and its contributors (“Contributors”) on, as of the date of publication. Intel and the Contributors make no commitment to update the information contained in this document, and Intel reserves the right to make changes at any time, without notice.

DISCLAIMER. THIS DOCUMENT, IS PROVIDED “AS IS.” NEITHER INTEL, NOR THE CONTRIBUTORS MAKE ANY REPRESENTATIONS OF ANY KIND WITH RESPECT TO PRODUCTS REFERENCED HEREIN, WHETHER SUCH PRODUCTS ARE THOSE OF INTEL, THE CONTRIBUTORS, OR THIRD PARTIES. INTEL, AND ITS CONTRIBUTORS EXPRESSLY DISCLAIM ANY AND ALL WARRANTIES, IMPLIED OR EXPRESS, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR ANY PARTICULAR PURPOSE, NON-INFRINGEMENT, AND ANY WARRANTY ARISING OUT OF THE INFORMATION CONTAINED HEREIN, INCLUDING WITHOUT LIMITATION, ANY PRODUCTS, SPECIFICATIONS, OR OTHER MATERIALS REFERENCED HEREIN. INTEL, AND ITS CONTRIBUTORS DO NOT WARRANT THAT THIS DOCUMENT IS FREE FROM ERRORS, OR THAT ANY PRODUCTS OR OTHER TECHNOLOGY DEVELOPED IN CONFORMANCE WITH THIS DOCUMENT WILL PERFORM IN THE INTENDED MANNER, OR WILL BE FREE FROM INFRINGEMENT OF THIRD PARTY PROPRIETARY RIGHTS, AND INTEL, AND ITS CONTRIBUTORS DISCLAIM ALL LIABILITY THEREFOR.

INTEL, AND ITS CONTRIBUTORS DO NOT WARRANT THAT ANY PRODUCT REFERENCED HEREIN OR ANY PRODUCT OR TECHNOLOGY DEVELOPED IN RELIANCE UPON THIS DOCUMENT, IN WHOLE OR IN PART, WILL BE SUFFICIENT, ACCURATE, RELIABLE, COMPLETE, FREE FROM DEFECTS OR SAFE FOR ITS INTENDED PURPOSE, AND HEREBY DISCLAIM ALL LIABILITIES THEREFOR. ANY PERSON MAKING, USING OR SELLING SUCH PRODUCT OR TECHNOLOGY DOES SO AT HIS OR HER OWN RISK.

Licenses may be required. Intel, its contributors and others may have patents or pending patent applications, trademarks, copyrights or other intellectual proprietary rights covering subject matter contained or described in this document. No license, express, implied, by estoppels or otherwise, to any intellectual property rights of Intel or any other party is granted herein. It is your responsibility to seek licenses for such intellectual property rights from Intel and others where appropriate.

Limited License Grant. Intel hereby grants you a limited copyright license to copy this document for your use and internal distribution only. You may not distribute this document externally, in whole or in part, to any other person or entity.

LIMITED LIABILITY. IN NO EVENT SHALL INTEL, OR ITS CONTRIBUTORS HAVE ANY LIABILITY TO YOU OR TO ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF YOUR USE OF THIS DOCUMENT OR RELIANCE UPON THE INFORMATION CONTAINED HEREIN, UNDER ANY CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL, OR ANY CONTRIBUTOR HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.

Copyright © Intel Corporation, 2010. All rights reserved.

2

Page 3: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

About this Document

Intel and the Intel Logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.

Revision History

Document Number

Revision Number

Description Revision Date

1.0 Initial release. December 2007

1.1 Added Troubleshooting for “No launchable executable” May 2008

2.0 Added new Activity for Xocde builds on Snow Leopard April 2010

3

Page 4: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

Contents 1 About this Document.........................................................................................5

1.1 Intended Audience .................................................................................5 1.2 Using Student Workbook .........................................................................5 1.3 Conventions and Symbols........................................................................6 1.4 Related Information................................................................................6

2 System Requirements........................................................................................7 2.1 Hardware Requirements ..........................................................................7 2.2 Software Requirements ...........................................................................7 2.3 Time Required .......................................................................................7

3 Activity 1 - Command Line Compilation with the Intel® Fortran Compiler..................8

4 Activity 2 - Using the Intel® Fortran Compiler Under Xcode* 2.4.x or 2.5.x IDE for Mac OS* X 10.4.x (“Tiger”) ..............................................................................12

5 Activity 3 - Using the Intel® Fortran Compiler Under Xcode* 3.1.x IDE for Mac OS* X 10.5.x (“Leopard”) ..........................................................................................26

6 Activity 4 - Using the Intel® Fortran Compiler Under Xcode* 3.2.x IDE for Mac OS* X 10.6.x (“Snow Leopard”)..................................................................................40

7 Troubleshooting..............................................................................................55

§

4

Page 5: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

About this Document

1 About this Document

In this lab, you will learn:

• How to compile using the Intel® Fortran Compiler command line interface

• How to compile applications using the Intel Fortran Compiler within the Xcode* IDE

• How to configure options for the Fortran compiler within the Xcode* IDE

1.1 Intended Audience The intended audience is any user of the Intel® Fortran Compiler for Mac OS* X.

1.2 Using Student Workbook This Student Workbook contains the following sections

Table 1 Document Organization

Section Description

System Requirements System configuration and time requirements to perform the Activities in this Student Workbook.

Activity 1 Command line compilation with the Intel® Fortran Compiler for Mac OS* X

Activity 2 Using the Intel® Fortran Compiler on Mac OS* X 10.4.x (“Tiger”)

Activity 3 Using the Intel® Fortran Compiler on Mac OS* X 10.5.x (“Leopard”)

Activity 4 Using the Intel® Fortran Compiler on Mac OS* X 10.6.x (“Snow Leopard”)

Troubleshooting “No launchable executable at path” error

5

Page 6: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

1.3 Conventions and Symbols

The following conventions are used in this document.

Table 2 Conventions and Symbols used in this Document

This type style Indicates an element of syntax, reserved word, keyword, filename, computer output, or part of a program example. The text appears in lowercase unless uppercase is significant.

This type style Indicates the exact characters you type as input. Also used to highlight the elements of a graphical user interface such as buttons and menu names.

This type style Indicates a placeholder for an identifier, an expression, a string, a symbol, or a value. Substitute one of these items for the placeholder.

[ items ]

Indicates that the items enclosed in brackets are optional.

{ item | item } Indicates to select only one of the items listed between braces. A vertical bar ( | ) separates the items.

... (ellipses) Indicates that you can repeat the preceding item.

1.4 Related Information

Apple Developer Connection:

http://developer.apple.com/

Intel® Fortran Compiler for Mac OS* X product Home:

http://www.intel.com/cd/software/products/asmo-na/eng/compilers/fmac/267426.htm

Intel® Fortran Compiler for Mac OS* X support Home:

http://www.intel.com/cd/software/products/asmo-na/eng/compilers/fmac/288281.htm

6

Page 7: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

System Requirements

2 System Requirements

2.1 Hardware Requirements • An iMac* system based on an Intel® Core™ Duo or Intel® Core™ 2 Duo

processor (minimum 1.83 GHz or greater).

• 1GB RAM

• 100 GB of disk space, plus an additional 200MB during installation for download and temporary files.

2.2 Software Requirements • Mac OS* X 10.4.9 or greater

• Mac OS* X Developer Tools

• Xcode* Version 2.4.1 or greater

• gcc* Version 4.0 or greater

• Intel® Fortran Compiler 10.x or higher for Mac OS* X

NOTE: Use Intel® Fortran Compiler version 11.1 and higher on systems running Mac OS* X 10.6.x (“Snow Leopard”) and Xcode* 3.2.x

Use Intel® Fortran Compiler version 10.1 and higher on systems running Mac OS* X 10.5.x (“Leopard”) and Xcode* 3.1.x

2.3 Time Required 30 minutes for the Command build Activity and one Xcode build Activity.

7

Page 8: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

3 Activity 1 - Command Line Compilation with the Intel® Fortran Compiler In this activity you will compile and run a simple program from the command line. Launch a terminal window by clicking on the “Terminal” icon on the bottom of your screen, or by launching “Finder”, then selecting Applications Utilities Terminal.

2. Navigate to the HelloMacWorld directory. If this directory is not available on your system, create a source file using the lines listed at the end of this activity.

$ cd HelloMacWorld

3. Test the default compiler setup with:

$ ifort –V

4. Record the following information about your compiler:

• Version ________.

• Build ________.

• Package ID ________.

4. Compile and execute the hello_macosx_world.f90 program using the default compiler:

$ ifort hello_macosx_world.f90 -o hello

$ ./hello

8

Page 9: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 1 - Command Line Compilation with the Intel® Fortran Compiler

5. Results should be similar to the output shown below:

6. On Mac OS* X, the default (most recent) installation version of the Intel® Fortran Compiler for Mac OS* X can be viewed using the following command:

$ ls /usr/bin/ifort

7. Building a 64-bit executable vs. a 32-bit executable

Use the -m32 or -m64 compiler option to choose whether the IA-32 or Intel(R) 64 compiler is executed. By using this symbolic link you do not need to remember any compiler version specific information, and you ensure the correct 32-bit or 64-bit compiler is executed.

For example, on a 64-bit Mac OS* X 10.5.x (“Leopard”) system, the default will be the Intel® 64 Compiler. To build with the non-default 32-bit Compiler, use the –m32 option:

Ifort –V –m32 hello_macosx_world.f90 -o hello32

If you are running on a Mac OS* X 10.4.x (“Tiger”) system, the default will be the IA-32 Compiler. To build with the non-default 64-bit Compiler on a 64-bit system, use the –m64 option:

Ifort –V –m64 hello_macosx_world.f90 -o hello64

9

Page 10: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

8. You can read a summary of compiler options from the command line by invoking the compiler with the -help option:

$ ifort -help

9. To list all the versions of the 11.x Intel® Fortran Compiler for Mac OS* X installed on your system:

$ ls -al /opt/intel/Compiler

Or to list only 11.x version(s) of the Compiler:

$ ls –al /opt/intel/Compiler/11*

10. To list all the versions of the 10.x and older IA-32 Intel® Fortran Compiler for Mac OS* X installed on your system:

$ ls -al /opt/intel/fc

Or to list only 10.x version(s) of the IA-32 Compiler:

$ ls –al /opt/intel/fc/10*

To list all the versions of the 10.x and older Intel(R) 64 Fortran Compiler for Mac OS* X installed on your system:

$ ls -al /opt/intel/fce

Or to list only 10.x version(s) of the Intel 64 Compiler:

$ ls –al /opt/intel/fce/10*

11. If you wish to set the compiler version and the environment variables to a different installation version than the default, do this by “sourcing” the compiler environment script ifortvars.sh for the installed version you want to use.

Additionally, when running an executable built with the “-shared-intel” switch, the environment variable DYLD_LIBRARY_PATH must be defined. The compiler environment script file ifortvars.sh (or ifortvars.csh) can be ‘sourced’ to set this variable.

For the 11.x IA-32 Compiler, use the /opt/intel/Compiler/…. path

$ source /opt/intel/Compiler/11.1/xxx/bin/ifortvars.sh ia32

Or $ source /opt/intel/Compiler/11.1/xxx/bin/ifortvars.csh ia32

Examples:

10

Page 11: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 1 - Command Line Compilation with the Intel® Fortran Compiler

$ source /opt/intel/Compiler/11.1/084/bin/ifortvars.sh ia32

Or $ source /opt/intel/Compiler/11.1/084/bin/ifortvars.csh ia32

For the 11.x Intel 64 Compiler, use the /opt/intel/Compiler/…. path

$ source /opt/intel/Compiler/11.1/xxx/bin/ifortvars.sh intel64

Or $ source /opt/intel/Compiler/11.1/xxx/bin/ifortvars.csh intel64

Examples:

$ source /opt/intel/Compiler/11.1/084/bin/ifortvars.sh intel64

Or $ source /opt/intel/Compiler/11.1/084/bin/ifortvars.csh intel64

For the 10.x and older IA-32 Compiler, use the /opt/intel/fc/…. path

$ source /opt/intel/fc/10.x.xxx/bin/ifortvars.sh

Or $ source /opt/intel/fc/10.x.xxx/bin/ifortvars.csh

Examples:

$ source /opt/intel/fc/10.0.017/bin/ifortvars.sh

Or $ source /opt/intel/fc/10.0.017/bin/ifortvars.csh

For the 10.x and older Intel 64 Compiler, use the /opt/intel/fce/…. path

$ source /opt/intel/fce/10.x.xxx/bin/ifortvars.sh

Or $ source /opt/intel/fce/10.x.xxx/bin/ifortvars.csh

Examples:

$ source /opt/intel/fce/10.0.017/bin/ifortvars.sh

Or $ source /opt/intel/fce/10.0.017/bin/ifortvars.csh

Source lines for hello_macosx_world.f90 sample file:

program main

print *, "Hello MAC OS* X World"

end program

11

Page 12: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

4 Activity 2 - Using the Intel® Fortran Compiler Under Xcode* 2.4.x or 2.5.x IDE for Mac OS* X 10.4.x (“Tiger”) In this activity, you will learn how to set up and compile with the Intel® Fortran Compiler under the Xcode* 2.4.x or 2.5.x IDE on systems running Mac OS* X 10.4.x (“Tiger”). You will build the “hello_macosx_world” program in this activity, but you may also use these instructions to build other applications.

1. To create a new Xcode* project:

a. Launch the Xcode* application by selecting

Finder > Macintosh HD > Developer > Applications > Xcode

b. Or double-click on the Xcode icon on the applications toolbar.

c. Choose New Project from the File menu.

d. When the New Project Assistant window appears, select Empty Project. Creating an Empty Project will require you to create a Target, which will be discussed in a later section of this document.

d. Name your project and specify an alternate directory if you do not want to use the default directory. For this tutorial, name your project

12

Page 13: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 2 - Using the Intel® Fortran Compiler Under Xcode* 2.4.x or 2.5.x IDE for Mac OS* X 10.4.x (“Tiger”)

“hellomacosxworld”, then click Finish. This creates the named project, with an .xcodeproj extension, i.e., hellomacosxworld.xcodeproj.

2. Alternatively, when the New Project Assistant window appears, select a project under Command Line Utility > Standard Tool.

NOTE:

If you choose Standard Tool as shown above, you will have to delete the C main program that is automatically created. Do this by highlighting the C main module, then choosing Delete from the Action pop-up menu in the toolbar, then click on the “Delete References” button.

However, you will not need to create a Target; the Standard Tool method will create the Target by default.

13

Page 14: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

Select “Delete References and Files”

14

Page 15: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 2 - Using the Intel® Fortran Compiler Under Xcode* 2.4.x or 2.5.x IDE for Mac OS* X 10.4.x (“Tiger”)

3. Adding Files to an Xcode* Project

To add a file to your Xcode* project, choose Add > New File… or Add > Existing Files… from the Action pop-up menu in the toolbar. (The Existing Files… option may not be available, depending on which group in the Groups & Files list is selected.) To add a new Fortran file, choose either Fortran Free Format File or Fortran Fixed Format File, listed under BSD. Alternatively, you can choose New Empty File from the File menu and provide an appropriate Fortran file extension when you specify the file name.

For this tutorial, add your hello_macosx_world.f90 file to your Xcode* project.

15

Page 16: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

4. Creating a Target for an Xcode* Project

When using Empty Project for the new project creation, you must create the Target.

• Highlight Targets under Groups & Files

• Choose Create New Target from the Action pop-up menu in the toolbar.

• Select BSD > Shell Tool from the menu.

5. Adding Files to an Xcode* Target

You must add your project source files to your Xcode* target. Highlight the target’s name, then choose Add > New File… or Add > Existing Files… from the Action pop-up menu in the toolbar. (The Existing Files… option may not be available, depending on which group in the Groups & Files list is selected.) To add a new Fortran file, choose either Fortran Free Format File or Fortran Fixed Format File, listed under BSD. Alternatively, you can choose New Empty File from the File menu and provide an appropriate Fortran file extension when you specify the file name.

16

Page 17: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 2 - Using the Intel® Fortran Compiler Under Xcode* 2.4.x or 2.5.x IDE for Mac OS* X 10.4.x (“Tiger”)

6. Be sure to select the Project (Target) that is associated with your source file. This should prevent “Build and Go” errors like “No launchable executable present at path”.

For this tutorial, add your hello_macosx_world.f90 file to your Xcode* target.

17

Page 18: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

7. Selecting the Intel Compiler

To select the Intel® Fortran compiler under Xcode* 2.4.x or 2.5.x, do the following:

a. Double-click the target you want to change in the Target group under the Groups & Files list.

b. In the Target Info window, click Rules.

c. To add a new rule, click the + button at the bottom, left-hand corner of the Target Info window.

d. From the new Rule section, choose FORTRAN source files using Intel® Fortran Compiler.

NOTE: The Intel® Fortran Compiler versions 10.1 and higher are not supported for Mac OS* X 10.4.x (“Tiger”) nor for Xcode* 2.4.x and older.

Once you have added a Fortran source file and a Target Info Rule, you can view and adjust the Intel compiler option settings. For more information, see “Setting Compiler Options” in the online Fortran Compiler Documentation for Mac OS* X.

18

Page 19: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 2 - Using the Intel® Fortran Compiler Under Xcode* 2.4.x or 2.5.x IDE for Mac OS* X 10.4.x (“Tiger”)

8. Building the Xcode* Target

To build the active target and configuration in Xcode*, highlight the target name, then choose Build and Run from the Build menu or click the Build button in the toolbar. To view the results of your build, click on “Succeeded” or “Failed” that appears in the bottom right corner of the Xcode* IDE window.

To build an individual file for a multi-file project, select the file under the target and then choose Compile from the Action drop-down menu in the toolbar.

NOTE:

Choosing Build from the Build menu or clicking the Build button in the toolbar builds the target specified in the Active Target drop-down menu in the toolbar and not the target or source file currently selected in the Groups & Files list.

19

Page 20: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

9. Editing the source code from the Xcode* IDE

To invoke the source code editor from the Xcode* IDE, click the Target name, click on the Editor icon in the Project window, move the editor view bar down so the target’s source file list reappears, then click on one of the source files and it will appear in the editor. Or, highlight a source code filename under the project name, then click on the Editor icon in the Project window. Example:

10. Modifying the compilation order of the source code for an Xcode* Target

You can change the compilation order of source files associated with an Xcode* target. This is required for compiling Fortran sources that define modules (producing .MOD files). These can, in turn, be used by Fortran sources that use the modules. To re-order the files listed under a target's Compile Sources, click a source and drag it before or after other compilations.

20

Page 21: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 2 - Using the Intel® Fortran Compiler Under Xcode* 2.4.x or 2.5.x IDE for Mac OS* X 10.4.x (“Tiger”)

11. Building 64-bit Executables under Xcode* 2.4.x/2.5.x

To build a 64-bit executable from within Xcode* 2.4.x or 2.5.x, edit the executable's target to change the Architectures setting to x86_64 (you may need to manually enter this selection). This produces a 64-bit binary for Intel® 64 architecture.

• Highlight the target name

• Click on the “info” (“i”) icon to launch the Build and Rules window and select the Build tab

• From the dropdown list for Collection, select Architectures

21

Page 22: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

• If “i386” is displayed, the 32-bit Compiler is being used.

• To use the 64-bit Compiler, highlight the “Architecture” entry, then manually delete the i386 entry and enter x86_64.

• Rebuild the target by highlighting the Target name, then selecting Build and Run from the Build menu.

22

Page 23: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 2 - Using the Intel® Fortran Compiler Under Xcode* 2.4.x or 2.5.x IDE for Mac OS* X 10.4.x (“Tiger”)

12. Running the Executable

Once you have built your Xcode* project, follow these steps to run the executable:

• Expand the Executables heading under Groups & Files.

• Highlight executable you want to run, then choose Run <executable name> from the Action drop-down menu in the toolbar.

• The output from the executable appears in the Run Log window.

23

Page 24: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

13. Using Dynamic Libraries

If you build your Xcode* project with the -shared-intel compiler option to link with the Intel dynamic libraries, you will need to set the DYLD_LIBRARY_PATH environment variable in the Xcode* environment. Follow these steps:

• Expand the Executables heading under Groups & Files.

• Select the executable from which the source is compiled with the -shared-intel option.

• Click Info on the toolbar to display the Executable Info dialog box.

• Under the Arguments tab, add DYLD_LIBRARY_PATH as an environment variable. Set the Value as the full path to the Intel compiler's /lib directory.

NOTE:

If you build your project with the -shared-intel option without setting DYLD_LIBRARY_PATH, a "library not found" error message results at runtime. Depending on your application, the error message may refer to a library other than the one noted in this example:

dyld: Library not loaded: libguide.dylib Referenced from: /Users/test/hello Reason: image not found

24

Page 25: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 2 - Using the Intel® Fortran Compiler Under Xcode* 2.4.x or 2.5.x IDE for Mac OS* X 10.4.x (“Tiger”)

14. Setting Compiler Options

You can use the Xcode* environment to set compiler options, including Intel-specific options. Follow these steps:

• Double-click the desired target.

• In the Target Info window, click Build.

• Expand the Collection menu to view the option categories. This list includes several categories under Intel Fortran Compiler.

• To set an Intel compiler option in the Floating Point category, for example, click on Floating Point to display the floating point options.

• Select a Setting, such as Improve Floating-Point Consistency, to view a short description and the corresponding option name (-[no]fltconsistency) in the bottom portion of the window.

• To select an option, check the corresponding box in the Value column.

The next time you build your project, the selected options will be used in the compilation.

For more information on the various compiler options, see the section on “Using the Compiler Options in Xcode*” in the online Fortran Compiler Documentation for Mac OS* X.

NOTE: To view the settings that have changed from the established defaults, choose Customized Settings.

25

Page 26: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

5 Activity 3 - Using the Intel® Fortran Compiler Under Xcode* 3.1.x IDE for Mac OS* X 10.5.x (“Leopard”) In this activity, you will learn how to set up and compile with the Intel® Fortran Compiler under the Xcode* 3.1.x IDE on systems running Mac OS* X 10.5.x (“Leopard”). You will build the “hello_macosx_world” program in this activity, but you may also use these instructions to build other applications.

Much of this activity will be the same as Activity 2 for building under the Xcode* 2.4.x or 2.5.x IDE on systems running Mac OS* X 10.4.x (“Tiger”), but the differences specific to the Xcode* 3.1.x IDE for the Mac OS* X 10.5.x (“Leopard”) will be noted. Please note that Intel® Fortran Compiler versions 10.1 and higher are not supported for Mac OS* X 10.4.x (“Tiger”) nor for Xcode* 2.4.x and older.

NOTE: Use Intel® Fortran Compiler version 10.1 and higher on systems running Mac OS* X 10.5.x (“Leopard”) with Xcode* 3.x.

1. To create a new Xcode* project:

• Launch the Xcode* application by selecting

Finder > Macintosh HD > Developer > Applications > Xcode

Or double-click on the Xcode icon on the applications toolbar.

• Choose New Project from the File menu.

• When the New Project Assistant window appears, select Empty Project. Creating an Empty Project will require you to create a Target, which will be discussed in a later section of this document.

26

Page 27: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 3 - Using the Intel® Fortran Compiler Under Xcode* 3.1.x IDE for Mac OS* X 10.5.x (“Leopard”)

• Name your project and specify an alternate directory if you do not want to use the default directory. For this tutorial, name your project “hellomacosxworld”, then click Finish. This creates the named project, with an .xcodeproj extension, i.e., hellomacosxworld.xcodeproj.

• Alternatively, when the New Project Assistant window appears, select a project under Command Line Utility > Standard Tool.

NOTE:

If you choose Standard Tool as shown above, you will have to delete the C main program that is automatically created. Do this by highlighting the C main module, then choosing Delete from the Action pop-up menu in the toolbar, then click on the “Delete References” button.

27

Page 28: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

However, you will not need to create a Target; the Standard Tool method will create the Target by default.

• Select “Delete References and Files”

28

Page 29: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 3 - Using the Intel® Fortran Compiler Under Xcode* 3.1.x IDE for Mac OS* X 10.5.x (“Leopard”)

1. Adding files to an Xcode* project

To add a file to your Xcode* project, choose Add > New File… or Add > Existing Files… from the Action pop-up menu in the toolbar. (The Existing Files… option may not be available, depending on which group in the Groups & Files list is selected.) To add a new Fortran file, choose either Fortran Free Format File or Fortran Fixed Format File, listed under Design. Alternatively, you can choose New Empty File from the File menu and provide an appropriate Fortran file extension when you specify the file name.

For this tutorial, add your hello_macosx_world.f90 file to your Xcode* project.

3. Creating a Target for your Xcode project

When using Empty Project for the new project creation, you must create the Target.

• Highlight Targets under Groups & Files

• Choose Create New Target from the Action pop-up menu in the toolbar.

• Select BSD > Shell Tool from the menu.

29

Page 30: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

4. Adding files to an Xcode* Target

You must add your project source files to your Xcode* target. Highlight the target’s name, then choose Add > New File… or Add > Existing Files… from the Action pop-up menu in the toolbar. (The Existing Files… option may not be available, depending on which group in the Groups & Files list is selected.) To add a new Fortran file, choose either Fortran Free Format File or Fortran Fixed Format File, listed under BSD. Alternatively, you can choose New Empty File from the File menu and provide an appropriate Fortran file extension when you specify the file name.

Be sure to select the Project (Target) that is associated with your source file. This should prevent “Build and Go” errors like “No launchable executable present at path”.

30

Page 31: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 3 - Using the Intel® Fortran Compiler Under Xcode* 3.1.x IDE for Mac OS* X 10.5.x (“Leopard”)

For this tutorial, add your hello_macosx_world.f90 file to your Xcode* target.

31

Page 32: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

5. Selecting the Intel Compiler

To select the version 10.1 Intel® Fortran Compiler in Xcode* 3.1.x, do the following:

• Double-click the target you want to change in the Target group under the Groups & Files list.

• In the Target Info window, click Rules.

• To add a new rule, click the + button at the bottom, left-hand corner of the Target Info window.

• From the new Rule section, choose FORTRAN source files using Intel® Fortran Compiler. Please note the Rules window has a different appearance under Xcode* 3.1.x than 2.4.x/2.5.x versions.

NOTE: For Mac OS* X 10.5.x (“Leopard”) with Xcode* 3.1.x, be sure to select the “Intel® Fortran Compiler version 10.1 or higher.

Once you have added a Fortran source file and a Target Info Rule, you can view and adjust the Intel compiler option settings. For more information, see “Setting Compiler Options” in the online Fortran Compiler Documentation.

32

Page 33: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 3 - Using the Intel® Fortran Compiler Under Xcode* 3.1.x IDE for Mac OS* X 10.5.x (“Leopard”)

6. Building 64-bit and 32-bit Executables under Xcode* 3.1.x on Mac OS* X 10.5

To build a 64-bit executable from within Xcode* 3.1.x, edit the executable's target to change the Architectures setting to x86_64 (you may need to manually enter this selection). This produces a 64-bit binary for Intel® 64 architecture.

• Highlight the target name

• Click on the “info” (“i”) icon to launch the Build and Rules window and select the Build tab

• From the dropdown list for Show, select All Settings

• Under the Architectures section, the “Architectures” setting may be set to the 32-bit setting “ppc i386” as shown in the example below.

• To use the 64-bit Compiler, highlight the “Architecture” entry, then double-click on the value for it.

33

Page 34: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

• Check the box for “64-bit”, then click the “OK” button.

• The Build menu will then display the 64-bit “Architectures” setting.

• The “Architectures” setting may be set to build for the 64-bit Compiler, the 32-bit Compiler, or both. Then re-build the target by highlighting the Target name, then selecting Build and Run from the Build menu.

34

Page 35: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 3 - Using the Intel® Fortran Compiler Under Xcode* 3.1.x IDE for Mac OS* X 10.5.x (“Leopard”)

7. Building the Target and Running the Executable

To build the active target and configuration in Xcode*, highlight the target name, then choose Build and Run from the Build menu or click the Build button in the toolbar. To view the results of your build, click on “Succeeded” or “Failed” that appears in the bottom right corner of the XCode* IDE window.

To build an individual file for a multi-file project, select the file under the target and then choose Compile from the Action drop-down menu in the toolbar.

NOTE:

Choosing Build from the Build menu or clicking the Build button in the toolbar builds the target specified in the Active Target drop-down menu in the toolbar and not the target or source file currently selected in the Groups & Files list.

35

Page 36: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

8. Viewing “Build and Go” execution results under Xcode* 3.1.x

Unlike Xcode* 2.4.x or 2.5.x, execution results output to the console window are not automatically displayed under Xcode 3.x*. You must select Run > Console to view the output to the console window.

9. Running/Re-running the Executable

Once you have built your Xcode* project, follow these steps to run or re-run the executable:

• Expand the Executables heading under Groups & Files.

• Highlight executable you want to run, then choose Run <executable name> from the Action drop-down menu in the toolbar.

• Select Run > Console to view the output in the console window.

36

Page 37: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 3 - Using the Intel® Fortran Compiler Under Xcode* 3.1.x IDE for Mac OS* X 10.5.x (“Leopard”)

7. Editing the source code from the Xcode* IDE

To invoke the source code editor from the Xcode* IDE, click the Target name, click on the Editor icon in the Project window, move the editor view bar down so the target’s source file list reappears, then click on one of the source files and it will appear in the editor. Or, highlight a source code filename under the project name, then click on the Editor icon in the Project window.

Example:

11. Modifying the compilation order of the source code for an Xcode* Target

You can change the compilation order of source files associated with an Xcode* target. This is required for compiling Fortran sources that define modules (producing .MOD files). These can, in turn, be used by Fortran sources that use the modules. To re-order the files listed under a target's Compile Sources, click a source and drag it before or after other compilations.

37

Page 38: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

12. Using Dynamic Libraries

If you build your Xcode* project with the -shared-intel compiler option to link with the Intel dynamic libraries, you will need to set the DYLD_LIBRARY_PATH environment variable in the Xcode* environment. Follow these steps:

• Expand the Executables heading under Groups & Files.

• Select the executable from which the source is compiled with the -shared-intel option.

• Click Info on the toolbar to display the Executable Info dialog box.

• Under the Arguments tab, add DYLD_LIBRARY_PATH as an environment variable. Set the Value as the full path to the Intel compiler's /lib directory.

NOTE:

If you build your project with the -shared-intel option without setting DYLD_LIBRARY_PATH, a "library not found" error message results at runtime. Depending on your application, the error message may refer to a library other than the one noted in this example:

dyld: Library not loaded: libguide.dylib Referenced from: /Users/test/hello Reason: image not found

38

Page 39: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 3 - Using the Intel® Fortran Compiler Under Xcode* 3.1.x IDE for Mac OS* X 10.5.x (“Leopard”)

11. Setting Compiler Options

You can use the Xcode* environment to set compiler options, including Intel-specific options. Follow these steps:

• Double-click the desired target.

• In the Target Info window, click Build.

• Expand the Collection menu to view the option categories. This list includes several categories under Intel Fortran Compiler.

• To set an Intel compiler option in the Floating Point category, for example, click on Floating Point to display the floating point options.

• Select a Setting, such as Improve Floating-Point Consistency, to view a short description and the corresponding option name (-[no]fltconsistency) in the bottom portion of the window.

• To select an option, check the corresponding box in the Value column.

The next time you build your project, the selected options will be used in the compilation.

For more information on the various compiler options, see the section on “Using the Compiler Options in Xcode*” in the online Fortran Compiler Documentation.

NOTE: To view the settings that have changed from the established defaults, choose Customized Settings.

39

Page 40: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

6 Activity 4 - Using the Intel® Fortran Compiler Under Xcode* 3.2.x IDE for Mac OS* X 10.6.x (“Snow Leopard”) In this activity, you will learn how to set up and compile with the Intel® Fortran Compiler under the Xcode* 3.2.x IDE on systems running Mac OS* X 10.6.x (“Snow Leopard”). You will build the “hello_macosx_world.f90” program in this activity, but you may also use these instructions to build other Fortran applications.

Much of this activity will be the same as Activity 3 for building under the Xcode* 3.1.x on systems running Mac OS* X 10.5.x (“Leopard”), but the differences specific to the Xcode* 3.2.x IDE for the Mac OS* X 10.6.x (“Snow Leopard”) will be noted. Please note that Intel® Fortran Compiler versions 11.1 and higher are not supported for Mac OS* X 10.4.x (“Tiger”) nor for Xcode* 2.4.x and older.

NOTE: Use Intel® Fortran Compiler version 11.1 and higher on systems running Mac OS* X 10.6.x (“Snow Leopard”) with Xcode* 3.2.x.

1. To create a new Xcode* project:

• Launch the Xcode* application by selecting

Finder > Macintosh HD > Developer > Applications > Xcode

Or double-click on the Xcode icon on the applications toolbar

Or click on the spyglass in the Finder window, type is “Xcode” in the search field, and select the Xcode application from the result list displayed.

• Choose New Project from the File menu or choose Create New Xcode Project from the pop-up screen for Xcode.

40

Page 41: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 4 - Using the Intel® Fortran Compiler Under Xcode* 3.2.x IDE for Mac OS* X 10.6.x (“Snow Leopard”)

2. When the New Project Assistant window appears, select Command Line Utility. Creating a Command Line project will automatically create a Target for your Xcode project.

41

Page 42: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

3. Name your project and specify an alternate directory if you do not want to use the default directory. For this tutorial, name your project “hellomacosxworld”, then click Save. This creates the named project, with an .xcodeproj extension, i.e., hellomacosxworld.xcodeproj.

4. Choose a template for your new Fortran project, either Fortran Fixed Format or Fortran Free Format

42

Page 43: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 4 - Using the Intel® Fortran Compiler Under Xcode* 3.2.x IDE for Mac OS* X 10.6.x (“Snow Leopard”)

5. By choosing Command Line Tool as shown above, you will have to

delete the C main program that is automatically created. Do this by highlighting the C main module, then choosing Delete from the Action pop-up menu in the toolbar, then click on the “Delete References” button.

6. Choose Delete from the Action pop-up menu in the toolbar, then click on the “Delete References” button

43

Page 44: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

7. Select “Delete References”

8. Adding files to an Xcode* project

To add a file to your Xcode* project, choose Add > New File… or Add > Existing Files… from the Action pop-up menu in the toolbar. (The Existing Files… option may not be available, depending on which group in the Groups & Files list is selected.) To add a new Fortran file, choose either Fortran Free Format File or Fortran Fixed Format File, listed under Design. Alternatively, you can choose New Empty File from the File menu and provide an appropriate Fortran file extension when you specify the file name. For this tutorial, add your hello_macosx_world.f90 file to your Xcode* project.

44

Page 45: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 4 - Using the Intel® Fortran Compiler Under Xcode* 3.2.x IDE for Mac OS* X 10.6.x (“Snow Leopard”)

9. Selecting the Intel Fortran Compiler

To select the version 11.1 Intel® Fortran Compiler in Xcode* 3.2.x, do the following:

• Double-click the target you want to change in the Target group under the Groups & Files list.

• In the Target Info window, click Rules.

• To add a new rule, click the + button at the bottom, left-hand corner of the Target Info window.

• From the new Rule section, choose FORTRAN source files using Intel® Fortran Compiler. Please note the Rules window has a different appearance under Xcode* 3.2.x than 2.4.x/2.5.x versions.

NOTE: For Mac OS* X 10.6.x (“Snow Leopard”) with Xcode* 3.2.x, be sure to select the “Intel® Fortran Compiler version 11.1 or higher.

45

Page 46: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

10. Building 64-bit and 32-bit Executables under Xcode* 3.2.x on Mac OS* X 10.6.x

For most 3.2.x projects, you will be creating a 64-bit application, so you must edit the executable's target to change the Architectures setting to x86_64 (you may need to manually enter this selection). Once you have added a Fortran source file and a Target Info Rule, you can view and adjust the Intel compiler option settings. For more information, see “Setting Compiler Options” in the online Fortran Compiler Documentation.

To build a 64-bit executable from within Xcode produces a 64-bit binary for Intel® 64 architecture.

• Highlight the target name

• Click on the “info” (“i”) icon to launch the Build and Rules window and select the Build tab

• From the dropdown list for Show, select All Settings

• Under the Architectures section, the “Architectures” setting may be set to the 32-bit setting “ppc i386” as shown in the example below.

46

Page 47: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 4 - Using the Intel® Fortran Compiler Under Xcode* 3.2.x IDE for Mac OS* X 10.6.x (“Snow Leopard”)

• To use the 64-bit Compiler, highlight the “Architecture” entry, then double-click on the value for it.

• Check the box for “64-bit”, then click the “OK” button.

47

Page 48: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

• The Build menu will then display the 64-bit “Architectures” setting.

• The “Architectures” setting may be set to build for the 64-bit Compiler, the 32-bit Compiler, or both. Then re-build the target by highlighting the Target name, then selecting Build and Run from the Build menu.

48

Page 49: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 4 - Using the Intel® Fortran Compiler Under Xcode* 3.2.x IDE for Mac OS* X 10.6.x (“Snow Leopard”)

11. Building the Target and Running the Executable

To build the active target and configuration in Xcode*, highlight the target name, then choose Build and Run from the Build menu or click the Build button in the toolbar. To view the results of your build, click on “Succeeded” or “Failed” that appears in the bottom right corner of the XCode* IDE window.

To build an individual file for a multi-file project, select the file under the target and then choose Compile from the Action drop-down menu in the toolbar.

NOTE:

Choosing Build from the Build menu or clicking the Build button in the toolbar builds the target specified in the Active Target drop-down menu in the toolbar and not the target or source file currently selected in the Groups & Files list.

49

Page 50: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

12. Viewing “Build and Go” execution results under Xcode* 3.2.x

Unlike Xcode* 2.4.x or 2.5.x, execution results output to the console window are not automatically displayed under Xcode 3.2.x*. You must select Run > Console to view the output to the console window.

50

Page 51: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 4 - Using the Intel® Fortran Compiler Under Xcode* 3.2.x IDE for Mac OS* X 10.6.x (“Snow Leopard”)

13. Running/Re-running the Executable

Once you have built your Xcode* project, follow these steps to run or re-run the executable:

• Expand the Executables heading under Groups & Files.

• Highlight executable you want to run, then choose Run <executable name> from the Action drop-down menu in the toolbar.

• Select Run > Console to view the output in the console window.

51

Page 52: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

14. Editing the source code from the Xcode* IDE

To invoke the source code editor from the Xcode* IDE, click the Target name, click on the Editor icon in the Project window, move the editor view bar down so the target’s source file list reappears, then click on one of the source files and it will appear in the editor. Or, highlight a source code filename under the project name, then click on the Editor icon in the Project window.

Example:

15. Modifying the compilation order of the source code for an Xcode* Target

You can change the compilation order of source files associated with an Xcode* target. This is required for compiling Fortran sources that define modules (producing .MOD files). These can, in turn, be used by Fortran sources that use the modules. To re-order the files listed under a target's Compile Sources, click a source and drag it before or after other compilations.

52

Page 53: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Activity 4 - Using the Intel® Fortran Compiler Under Xcode* 3.2.x IDE for Mac OS* X 10.6.x (“Snow Leopard”)

16. Using Dynamic Libraries

If you build your Xcode* project with the -shared-intel compiler option to link with the Intel dynamic libraries, you will need to set the DYLD_LIBRARY_PATH environment variable in the Xcode* environment. Follow these steps:

• Expand the Executables heading under Groups & Files.

• Select the executable from which the source is compiled with the -shared-intel option.

• Click Info on the toolbar to display the Executable Info dialog box.

• Under the Arguments tab, add DYLD_LIBRARY_PATH as an environment variable. Set the Value as the full path to the Intel compiler's /lib directory.

NOTE:

If you build your project with the -shared-intel option without setting DYLD_LIBRARY_PATH, a "library not found" error message results at runtime. Depending on your application, the error message may refer to a library other than the one noted in this example:

53

Page 54: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

dyld: Library not loaded: libguide.dylib Referenced from: /Users/test/hello Reason: image not found

17. Setting Compiler Options

You can use the Xcode* environment to set compiler options, including Intel-specific options. Follow these steps:

• Double-click the desired target.

• In the Target Info window, click Build.

• Expand the Collection menu to view the option categories. This list includes several categories under Intel Fortran Compiler.

• To set an Intel compiler option in the Floating Point category, for example, click on Floating Point to display the floating point options.

• Select a Setting, such as Improve Floating-Point Consistency, to view a short description and the corresponding option name (-[no]fltconsistency) in the bottom portion of the window.

• To select an option, check the corresponding box in the Value column.

The next time you build your project, the selected options will be used in the compilation.

For more information on the various compiler options, see the section on “Using the Compiler Options in Xcode*” in the online Fortran Compiler Documentation.

NOTE: To view the settings that have changed from the established defaults, choose Customized Settings.

54

Page 55: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Troubleshooting

7 Troubleshooting Symptom error: "No launchable executable present at path" during project build under Xcode*, as described in these Apple user forums:

http://lists.apple.com/archives/xcode-users/2006/Mar/msg00755.html

http://forums.macrumors.com/showthread.php?t=446028

The following workarounds assume that if you are running on Mac OS* X 10.5.x (Leopard) with Xcode 3.0, you have installed a 10.1.xxx version of the Intel(R) Fortran Compiler for Mac OS* X. Older versions of the Compiler do not support the Leopard/Xcode 3.0 configuration.

Workaround 1: For an Existing Xcode* Project

1. Open Xcode.

2. Open your existing Xcode* project that gave the error.

3. Create a new executable by selecting Project > New Custom Executable from the Xcode* menu bar.

4. Enter the executable path (select it using the “Choose” button) that was presented in the “No launchable executable present at <path>” error message.

5. You may have to enter a new unique executable name, e.g., “MyApp2”, in the Executable Name field.

6. Click “Next” and complete the setup steps for your new custom executable.

7. Select Run Menu > Console

8. Then click on Build and Go in the project window.

Workaround 2: For a New Xcode* Project

1. Open Xcode.

2. Select File Menu > New Project from the Xcode* menu bar.

55

Page 56: Getting Started With Intel® Fortran Compiler For Mac … Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard") Disclaimer and Legal Information

Getting Started with Intel® Fortran Compiler for Mac OS* X (including Mac OS* X 10.6.x "Snow Leopard")

56

3. Select either Empty Project, or scroll to Command Line Utility and select the Standard Tool option under it. Please note that if you use the Standard Tool option, you must delete the C main program that is automatically created before you Build the project.

4. Click Next.

5. Type in the name of project.

6. Click Finish.

7. Check that your Build paths are setup correctly for your project in XCode*.

8. Select Run Menu > Console.

9. Then click Build and Go on the project window.

Workaround 3: For an Existing Xcode* Project when building for Release

If you find that building for Debug is successful, but you get the "No launchable executable present at path" error when building for Release, try these steps:

1. Double-click the <Target>, then open the <Rules> menu option.

2. Change the <Architecture> from <ppc i386> to <i386>

3. Check that your Build paths are setup correctly for your project in XCode.

4. Select Run Menu > Console.

5. Then click Build and Go on the project window.

6. If the build is successful, it apparently means that the Target path is recognized or adjusted by "updating" the settings in the IDE.