PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

How do I compile using g77 with a pgf77-compiled library

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Ole_miss



Joined: 11 Sep 2007
Posts: 2

PostPosted: Tue Sep 11, 2007 10:53 am    Post subject: How do I compile using g77 with a pgf77-compiled library Reply with quote

I am trying to compile my code with with the g77 compiler while linking with a library file that was previously compiled with pgf77. I have heard about the extra underscore problem but when I tried the -Msecond_underscore flag, it didn't work so I am certain I am not doing something right. Any help would be greatly appreciated.
Back to top
View user's profile
hongyon



Joined: 19 Jul 2004
Posts: 551

PostPosted: Tue Sep 11, 2007 5:01 pm    Post subject: Reply with quote

Hi,

You can just compile as normal. For example:-
I have 2 files:
myhost% cat a.f
subroutine test(a,b,c)
integer a,b,c
c=a+b
end
myhost% cat main.f

program testme
integer a,b,c
a=1
b=3
c=2
call test(a,b,c)
print *, "C is", c
end

myhost% g77 a.f -c
myhost% pgf77 a.o main.f
main.f:
myhost% a.out
C is 4

As long as you link to the right libraries.

Hongyon
Back to top
View user's profile
Ole_miss



Joined: 11 Sep 2007
Posts: 2

PostPosted: Tue Sep 11, 2007 5:43 pm    Post subject: Reply with quote

Thanks Hongyoon for your post but I am not sure that it has addressed the crux of my problem.

Say I have a library called libutil.a which was compiled using pgf77 and now it's to be used on a computer running g77 and on which it would be inconvenient to install pgf77. I am thus constrained to using g77. When I typed g77 main.f libutil.a, most of the files containing subroutines in libutil.a couldn't be found. So I thought it might be because g77 introduces the extra underscore. Of course, this hunch might be wrong. I hope you or anyone else can better direct me.

Thanks a great deal once again.
Back to top
View user's profile
hongyon



Joined: 19 Jul 2004
Posts: 551

PostPosted: Wed Sep 12, 2007 9:01 am    Post subject: Reply with quote

Hi,

I suspect that it can't find some PGI runtime libraries that libutil.a needs. You will need to make sure that you link to PGI libraries. I am not sure which ones it needs. You can look on a system that you have PGI compilers and link and add -v in the options and it should display a list of libraries that it link against on the link line. For example, pgf77 main.f libutil.a -v


Hongyon
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
Page 1 of 1

 
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