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

Hi~

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/Xcode.app/Contents/Developer/usr/lib/llvm-gcc/4.2.1’
ld: warning: directory not found for option ‘-L/Volumes/Xcode/Xcode.app/Contents/Developer/usr/lib/llvm-gcc/4.2.1’
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.

hello.c
#include <stdio.h>
int main()
{printf(“Hello!\n”);}

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


hello.cpp
#include
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.

Hi,

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 trs@pgroup.com. The FULL outputs, not a
fragment.

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

It works well ~

Thank you all guys ~