Re: Linking to a library in mixed C/Fortran 77 code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12 April 2012 23:33, Amittai Aviram wrote:
> I have a test OpenMP application whose source mixes Fortran 77 with C, and I am having a problem in linking to libgomp, the Gnu OpenMP support library that comes with GCC.  The application has two files, "prog.f" (Fortran 77), containing the main program, and "helper.c."  The application uses routines defined in my version of libgomp, which I have altered.  (My altered libgomp links and works fine with OpenMP applications written simply in C, linking both dynamically and statically.)  I am building and attempting to link using GCC 4.6.2, with the libgomp and gcc/omp-low.c altered, but everything else is the same as in the release.  (This is under Ubuntu Linux 2.6 for x86.)  Below is a simplified version of the code and my Makefile.  The problem is in the call to "foo" in function "foo_f," defined in "helper.c":  "foo" is defined in my altered libgomp, but, if I try to build with dynamic linkage (without the "-static" option), ld reports "undefined reference to 'foo.'"  If I build using the "-static" keyword, since OpenMP uses pthreads, I also have to pass ld the linker script "-Wl,--whole-archive -lpthread -Wl,--no-whole-archive."  When I do this, my application builds and runs correctly, but I get this warning at build time:
>
> /usr/lib/../lib64/libpthread.a(sem_open.o): In function `sem_open':
> /build/buildd/eglibc-2.11.1/nptl/sem_open.c:333: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'


Are you asking why you get the warning?  Or how to get rid of it? Or
something else?

If foo isn't being found in your modified libgomp.so it is probably
because libgomp.so is being built with symbol-versioning enabled and
you haven't exported foo from the library as a global symbol.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux