pgcc compile error (linking error) using Xcode 5.0 (OS X)


I installed pgCC and use trial license successfully.
But, when I compile the simple program (like"hello world")

pgcc -g hello.o

error message is showing as follow:

ld: warning: directory not found for option ‘-L/Volumes/Xcode/’
ld: warning: directory not found for option ‘-L/Volumes/Xcode/’
ld: library not found for -lgcc

I try to set LD_LIBRARY_PATH to find library but I failed…
Now, I use pgcc 13.10 version and OS X 10.9.1.
Of course, I compile same code with gcc successfully…
(gcc -v test.c -> success
pgcc -v test.c -> linking error!!)

How do I fix that?

On OS X, pgCC is the same as pgcc, and the PGI C++ compiler is called pgcpp.

So, let’s begin this experiment by compiling a hello program from source, and see what is wrong. If hello.o was created by a C++ compiler and now is linked
with a C compiler, you will see problems.

#include <stdio.h>
int main()

% pgcc -v -Wl,-t hello.c -m64 -o hello_c_64
% file hello_c_64

int main()
{ double xx=12345.0; std::cout << “hello” << xx << std::endl; }

% pgcpp -v -Wl,-t hello.cpp -m64 -o hello_cpp_64
% file hello_cpp_64

and see what happens.

But I think the problem is your Xcode installation.
Make sure you have Xcode 4.6 or greater, and that if you
Go to Finder-> Applications -> Xcode
Xcode bar -> preferences -> Components
you will probably see that IOS Simulators are installed,
but the ‘Command Line Tools’ is not installed. Install it.

Then install the PGI compilers again.


Follow your suggestion,

  • I check the Xcode -> version 5.0, command line tool has been installed
  • I re-install PGI 10.13 workstation

After that, I try to compile and link ‘hello.c’ using this command again

-> pgcc -v -Wl,-t hello.c -m64 -o hello_c_64

And, I see different error message as follow:
Undefined symbols for architecture x86_64:
“_print”, referenced from:
_main in hello.o
ld: symbol(s) not found for architecture x86_64
pgcc-Fatal-linker completed with exit code 1

When I change -m64 to -m32, I also see following error message

Undefined symbols for architecture i386:
“_print”, referenced from:
_main in hello.o
ld: symbol(s) not found for inferred architecture i386
pgcc-Fatal-linker completed with exit code 1

Please let me know how to I solve this.
Thanks in advance.

Did you use print instead of printf in hello.c?

As a sanity check, please determine if gcc works

% gcc -m64 -o hello_c_64_gcc hello.c -v -Wl,-t

and if it works, send the full -v output. If it does not, you need to
get gcc working first, before installing PGI.

If gcc works, send the FULL output of

% pgcc -m64 -o hello_c_64_pgcc hello.c -v -Wl,-t

Send the outputs to The FULL outputs, not a

Your instruction is right and there are some bugs in my code.

It works well ~

Thank you all guys ~