Unresolved external symbol with OpenACC (fortran)

Dear all,

I am compiling my code with pgfortran (in VS shell) as DLL. This code calls OpenACC but it looks like there is a link poblem.
I simplified my code and i now only have an OpenACC statement as follows:

!$acc data copy(x(:,:))
!$acc end data

And here are the errors I get:

Error	1	unresolved external symbol __pgi_uacc_dataenterstart referenced in function bladeindvel_	BladeIndVel.obj 	
Error	2	unresolved external symbol __pgi_uacc_dataonb referenced in function bladeindvel_	BladeIndVel.obj 	
Error	3	unresolved external symbol __pgi_uacc_dataenterdone referenced in function bladeindvel_	BladeIndVel.obj 	
Error	4	unresolved external symbol __pgi_uacc_dataexitstart referenced in function bladeindvel_	BladeIndVel.obj 	
Error	5	unresolved external symbol __pgi_uacc_dataoffb2 referenced in function bladeindvel_	BladeIndVel.obj 	
Error	6	unresolved external symbol __pgi_uacc_dataexitdone referenced in function bladeindvel_	BladeIndVel.obj 	
Error	7	6 unresolved externals	C:\Users\vleroy\Documents\5-CodeDevelopment\InWave_v3.1\buildsolvers\Install\bin\AeroModule_PVF90.dll

I am a beginner with OpenACC but it looks like the errors do not come from my code.

I read on the forum that there was an issue with some libs when compiling a DLL using OpenACC (https://www.pgroup.com/userforum/viewtopic.php?p=20717&sid=5e8a19b5895a994aab6ba9bf735286ec) so I use to following options when compiling, for “the OpenACC part” :

-acc -ta=tesla:cc50,nordc -laccapi -laccg -laccn -laccg2

Could anyone help me ?


Hi Vincent,

These are all symbols from the OpenACC runtime libraries so I suspect that you’re missing the runtime libraries from your link line. Make sure you’re using the same link flags as you have for your compilation.

Which compiler version are you using? With the 2017 releases, we have an separate issue which will prevent you from putting OpenACC inside of a DLL. As a work around, you’ll need to use PGI 16.10 until we get it resolved.



Thank you for you answer. I am using the v17.10 compiler. I’ll try with the 16.10 compiler.



I installed PGI 16.10 as you advised (with VS Shell). I thus also had to reinstall CUDA 8.0 (I previously had CUDA 9.0). I now have another problem when navigating through visual studio options. As soon as I try to access in the project properties “fortran > Target Accelerators”, the program crashes.

I found two errors details in the computer system. Sorry, they are in French but I think you can still understand them. The first one is a “.NET Runtime” error :

Application : devenv.exe
Version du Framework : v4.0.30319
Description : le processus a été arrêté en raison d'une exception non gérée.
Informations sur l'exception : System.AccessViolationException
   Ã  System.StubHelpers.MngdNativeArrayMarshaler.ConvertContentsToManaged(IntPtr, System.Object ByRef, IntPtr)
   Ã  System.Windows.Forms.UnsafeNativeMethods+IDispatch.Invoke(Int32, System.Guid ByRef, Int32, Int32, tagDISPPARAMS, System.Object[], tagEXCEPINFO, IntPtr[])
   Ã  System.Windows.Forms.ComponentModel.Com2Interop.ComNativeDescriptor.GetPropertyValue(System.Object, Int32, System.Object[])
   Ã  System.Windows.Forms.ComponentModel.Com2Interop.Com2TypeInfoProcessor.InternalGetProperties(System.Object, ITypeInfo, Int32, Int32 ByRef)
   Ã  System.Windows.Forms.ComponentModel.Com2Interop.Com2TypeInfoProcessor.GetProperties(System.Object)
   Ã  System.Windows.Forms.ComponentModel.Com2Interop.ComNativeDescriptor.GetPropsInfo(System.Object)
   Ã  System.Windows.Forms.ComponentModel.Com2Interop.ComNativeDescriptor.GetProperties(System.Object, System.Attribute[])
   Ã  System.Windows.Forms.ComponentModel.Com2Interop.ComNativeDescriptor+ComTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties(System.Attribute[])
   Ã  System.ComponentModel.TypeDescriptor+TypeDescriptionNode+DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties(System.Attribute[])
   Ã  System.ComponentModel.TypeDescriptor.GetPropertiesImpl(System.Object, System.Attribute[], Boolean, Boolean)
   Ã  System.ComponentModel.ComponentConverter.GetProperties(System.ComponentModel.ITypeDescriptorContext, System.Object, System.Attribute[])
   Ã  System.Windows.Forms.PropertyGridInternal.PropertiesTab.GetProperties(System.ComponentModel.ITypeDescriptorContext, System.Object, System.Attribute[])
   Ã  Microsoft.VisualStudio.PropertyBrowser.VSPropertiesTab.GetProperties(System.ComponentModel.ITypeDescriptorContext, System.Object, System.Attribute[])
   Ã  System.Windows.Forms.PropertyGridInternal.GridEntry.GetPropEntries(System.Windows.Forms.PropertyGridInternal.GridEntry, System.Object, System.Type)
   Ã  System.Windows.Forms.PropertyGridInternal.GridEntry.CreateChildren(Boolean)
   Ã  System.Windows.Forms.PropertyGridInternal.SingleSelectRootGridEntry.CreateChildren()
   Ã  System.Windows.Forms.PropertyGridInternal.GridEntry.set_InternalExpanded(Boolean)
   Ã  System.Windows.Forms.PropertyGridInternal.GridEntry.Create(System.Windows.Forms.PropertyGridInternal.PropertyGridView, System.Object[], System.IServiceProvider, System.ComponentModel.Design.IDesignerHost, System.Windows.Forms.Design.PropertyTab, System.Windows.Forms.PropertySort)
   Ã  System.Windows.Forms.PropertyGrid.UpdateSelection()
   Ã  System.Windows.Forms.PropertyGrid.RefreshProperties(Boolean)
   Ã  System.Windows.Forms.PropertyGrid.Refresh(Boolean)
   Ã  System.Windows.Forms.PropertyGrid.set_SelectedObjects(System.Object[])
   Ã  Microsoft.VisualStudio.PropertyBrowser.PropertyBrowser+GridProxy.Microsoft.VisualStudio.Designer.Interfaces.IVSMDPropertyGrid.SetSelectedObjects(Int32, Int32)

The second one is an “Application” error:

Nom de l’application défaillante devenv.exe, version : 14.0.23107.0, horodatage : 0x559b7ead
Nom du module défaillant : OLEAUT32.dll, version : 6.1.7601.23775, horodatage : 0x58f4db68
Code d’exception : 0xc0000005
Décalage d’erreur : 0x0000462e
ID du processus défaillant : 0x185c
Heure de début de l’application défaillante : 0x01d369bf56ddf7f5
Chemin d’accès de l’application défaillante : C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe
Chemin d’accès du module défaillant: C:\Windows\syswow64\OLEAUT32.dll
ID de rapport : a3ee083b-d5b2-11e7-95fa-64006a6e8747

Do you know why do I get these error after I reinstalled everything ?[/quote]