XCode Runtime Problem when Using OpenMP

XCode Runtime Problem when Using OpenMP

I have a runtime problem when using openMP in XCode. The same code runs fine from the command line, and XCode runs applications fine when they don't use openMP. I am an academic, and have no budget for support for the compiler, so any help would be appreciated.

Here is the run log for the failure case:

[Session started at 2007-03-16 13:28:25 -0400.]

dyld: Library not loaded: libguide.dylib

Referenced from: /Users/altair4/VanillaHelloWorld/build/Debug/VanillaHelloWorld

Reason: image not found

VanillaHelloWorld has exited due to signal 5 (SIGTRAP).

If I run the code from the command line:

icc -openmp -o Hello_World_omp main.cpp

./Hello_World_omp

the application compiles, links, and executes as expected.

If I run the same project in XCode, but un-comment the traditional HelloWorld code at the beginning of the file, and delete the code after that code (code listing below), not changing any XCode settings, everything works.

I am running XCode 2.4.1 under OS X 10.4.9; behavior was exactly the same under 10.4.8. The only customizations to XCode settings are:

The target building rules specify processing C source files using Intel C++ Compiler 9.1

The Build settings include -openmp under Other Linker Flags.

Everything else is set to the default values.

The compiler is the Intel C++ Compiler 9.1.037.

The Property List Editor indicates that ~/.MacOSX/environment.plist includes one property, DYLD_LIBRARY_PATH, with the value /opt/intel/cc/9.1.037/lib .

/etc/profile includes

source /opt/intel/cc/9.1.037/bin/iccvars.sh

source /opt/intel/idb/9.1.037/bin/idbvars.sh

so, typing env at the command prompt produces, among other things,

DYLD_LIBRARY_PATH=/opt/intel/cc/9.1.037/lib .

File libguide.dylib is present at /opt/intel/cc/9.1.037/lib , and takes up 272 KB, so it is not empty.

Again, any help would be greatly appreciated. I can work in XCode until it is time to create an executable, and then switch to the command line to create and run the executable, but this is just plain ugly and not the sort of thing to demo to students, not to mention what it does to debugging.

Here is the code, which (except for the old-fashioned Hello World at the top) goes with "Multi-Core Programming: Increasing Software Performance Through Software Multithreading" (1st ed.) by Akhter & Roberts (Intel Press):

/*

#include

int main (int argc, char * const argv[]) {

// insert code here...

std::cout << "Hello, World!
";

return 0;

}

*/

///////////////////////////////////////////////////////////////////////////

//

// Copyright (c) 2006 Intel Corporation

// All rights reserved.

//

// Redistribution and use in source and binary forms, with or without

// modification, are permitted provided that the following conditions are met:

//

// * Redistributions of source code must retain the above copyright notice,

// this list of conditions and the following disclaimer.

// * Redistributions in binary form must reproduce the above copyright notice,

// this list of conditions and the following disclaimer in the documentation

// and/or other materials provided with the distribution.

// * Neither name of Intel Corporation nor the names of its contributors

// may be used to endorse or promote products derived from this software

// without specific prior written permission.

//

// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS

// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT

// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR

// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR

// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,

// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,

// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR

// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY

// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING

// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS

// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

//

///////////////////////////////////////////////////////////////////////////

// This code is for Chapter 2

// Reference to Listing 2.1

//

// For compilation, using Intel compiler

// User must install Intel compiler, befo
re running this code

//

// Possible compilation instructions:

//

// Windows: icl /Qopenmp -o Hello_World_omp Hello_World_omp.c

// Linux: icc -openmp -o Hello_World_omp Hello_World_omp.c

//

// Note: There is a Makefile in this package as well.

// The Makefile is used for both OpenMP and pthread examples.

#include

#include

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You can set -openmp in the target info properties page -> build tab -> Collection -> Language -> Process Openmp Directives

You can set DYLD_LIBRARY_PATH in the executable in properties page.

In Xcode -> Groups & File -> Executables -> double click the executable or "get info"

select "Arguments" tab -> Variables to be set in the environment:

add

Name

DYLD_LIBRARY_PATH

Value

/opt/intel/cc/9.1.037/lib

Thanks, that did the trick!

I would be good if this was documented somewhere. At least you have documented it here!

Thanks again,

Paul

Good point. We have it documented for thecommand line, but not from within Xcode IDE. I have submitted a change request to Intel Support folks.

Leave a Comment

Please sign in to add a comment. Not a member? Join today