PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

pgcc compile error (linking error) using Xcode 5.0 (OS X)
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
970980hs



Joined: 01 Jan 2014
Posts: 10

PostPosted: Thu Jan 02, 2014 11:15 pm    Post subject: pgcc compile error (linking error) using Xcode 5.0 (OS X) Reply with quote

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?
Back to top
View user's profile
jtull



Joined: 30 Jun 2004
Posts: 445

PostPosted: Fri Jan 03, 2014 10:08 am    Post subject: Reply with quote

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 <iostream>
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.
Back to top
View user's profile
970980hs



Joined: 01 Jan 2014
Posts: 10

PostPosted: Fri Jan 03, 2014 12:00 pm    Post subject: The other problem for linking Reply with quote

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.
Back to top
View user's profile
N. Shamsundar



Joined: 20 Apr 2005
Posts: 23

PostPosted: Fri Jan 03, 2014 8:06 pm    Post subject: Re: The other problem for linking Reply with quote

970980hs wrote:
Hi,

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
Thanks in advance.


Did you use print instead of printf in hello.c?
Back to top
View user's profile
jtull



Joined: 30 Jun 2004
Posts: 445

PostPosted: Mon Jan 06, 2014 2:44 pm    Post subject: Reply with quote

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.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group