- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Is it possible to use icpc as the C compiler when interfacing fortran and C using iso_c_binding?
I would like to link my code to petsc without using their fortran binding (hence gaining access to some of the functions that are not exposed to fortran), but for some reasons, I need to compile petsc using icpc as my c compiler.
I am attaching a very simple example which works fine when using icc as the c compiler, but fais to link when using icpc as the c compiler:
Everything works fine with icc
MacPro:Interop3 blaise$ make clean && makeifort -g -c TestF2003_C.f90icc -g -c cfunc.cifort -g -o TestF2003_C TestF2003_C.o cfunc.o
but if I use icpc as the c compiler, linking fails
MacPro:Interop3 blaise$ make clean && make CC=icpcifort -g -c TestF2003_C.f90icpc -g -c cfunc.cifort -g -o TestF2003_C TestF2003_C.o cfunc.oUndefined symbols:"___gxx_personality_v0", referenced from:CIE in cfunc.old: symbol(s) not foundmake: *** [TestF2003_C] Error 1
I am assuming that I need to add some library to the linking command, but which one?
Regards,
Blaise
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am replying to myself, since this may be useful to somebody:gxx_personality is defined in libstdc++, so when using icpc as the C compiler, it needs to be added to the link command

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page