View previous topic :: View next topic |
Author |
Message |
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Tue May 12, 2020 11:00 am Post subject: Multiply defined symbols for INTEL build using clearwin64.dl |
|
|
Hello,
I am building a GUI application using INTEL's 64 bit fortran compiler ifort, INTEL's linker xilink and SALFORD's Dll clearwin64.dll.
If I am using clearwin64.dll and clearwin64.lib of SALFORD ftn95 version 7.10 the building process works fine and creates the executable successfully.
However, if using clearwin64.dll and clearwin64.lib of SALFORD ftn95 version 8.61 (version info of clearwin64.dll in resource monitor: 22.2.3.15, date: 03.02.2020), then INTEL's linker xilink reports the following errors (and does not create the executable expected):
Code: |
LIBCMT.lib(memcpy.obj) : error LNK2005: memmove already defined in clearwin64.lib(clearwin64.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: exit already defined in clearwin64.lib(clearwin64.dll)
LIBCMT.lib(unlink.obj) : error LNK2005: remove already defined in clearwin64.lib(clearwin64.dll)
LIBCMT.lib(getenv.obj) : error LNK2005: getenv already defined in clearwin64.lib(clearwin64.dll)
LIBCMT.lib(atox.obj) : error LNK2005: atoi already defined in clearwin64.lib(clearwin64.dll)
..\p64_intel\p0918w.exe : fatal error LNK1169: one or more multiply defined symbols found
|
. I could force xilink to ignore this (via option "/FORCE:MULTIPLE") and thus I could create the executable in question (named p0918w.exe).
But I am unsure about possible side effects and hence would like to know more about the errors/warnings.
I used commmand
Code: |
dumpbin /EXPORTS clearwin64.dll
|
to observe that e.g. symbol exit is exported by clearwin64.dll version 8.61, but not by clearwin64.dll version 7.10. I wonder why this is the case.
Please note: clearwin64.lib is the import library supplied by SALFORD and needed for the build process using INTEL's ifort. Moreover, all the module files (and corresponding objects) needed for building have not been suppied by SALFORD and have been built by me using ifort and the module sources supplied by SALFORD in directory
of the ftn95 installation in question ( i.e. version 7.10 or version 8.61).
LIBCMT.lib is a C Link Library used (mt stands for multithreaded) and I suspect that it is used because the GUI application is built from Fortran and C/C++ sources.
Any comment is welcome.
Regards,
Dietmar |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Tue May 12, 2020 12:44 pm Post subject: |
|
|
These C functions (including exit) are exported by the latest version of clearwin64.dll and have been included in recent versions but presumably not in the early version that you mention.
They were added for those who need these functions when combining 64 bit Silverfrost Fortran with 64 bit Silverfrost C/C++.
I don't know if there is any risk in using "/FORCE:MULTIPLE" and, at the moment I can't think of a work-around other than supplying a variant of clearwin64.dll that does not export these functions. |
|
Back to top |
|
|
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Tue May 12, 2020 2:25 pm Post subject: |
|
|
Paul,
using "/FORCE:MULTIPLE" results in warnings
Code: |
LIBCMT.lib(memcpy.obj) : warning LNK4006: memmove already defined in clearwin64.lib(clearwin64.dll); second definition ignored
LIBCMT.lib(crt0dat.obj) : warning LNK4006: exit already defined in clearwin64.lib(clearwin64.dll); second definition ignored
LIBCMT.lib(unlink.obj) : warning LNK4006: remove already defined in clearwin64.lib(clearwin64.dll); second definition ignored
LIBCMT.lib(getenv.obj) : warning LNK4006: getenv already defined in clearwin64.lib(clearwin64.dll); second definition ignored
LIBCMT.lib(atox.obj) : warning LNK4006: atoi already defined in clearwin64.lib(clearwin64.dll); second definition ignored
..\p64_intel\p0918w.exe : warning LNK4088: image being generated due to /FORCE option; image may not run
|
hence the symbols of clearwin64.dll are used and the symbols of ifort's libcmt.dll ignored.
For the moment I can live with option "/FORCE:MULTIPLE" but in the long term I would appreciate, if you could supply a variant of clearwin64.dll/clearwin64.lib that do not export these functions.
By the way: does this phenomenon occur for GNU Fortran, as well?
Thanks,
Dietmar |
|
Back to top |
|
|
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Fri Jul 17, 2020 2:33 pm Post subject: |
|
|
Paul,
one of my intel64 applications linked with clearwin64.dll of ftn95 version 8.63 crashes when calling
. Via dumpbin I see that it is still part of clearwin64.dll.
The same is true if I replace EXIT$ by EXIT.
Would it be possible to remove both symbols from clearwin64.dll?
Regards,
Dietmar |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Fri Jul 17, 2020 4:23 pm Post subject: |
|
|
Dietmar
EXIT$ and EXIT are native FTN95 intrinsics so I don't see how we can remove support for them.
These routines are subroutines that require a CALL and they both take a single integer argument.
Maybe you could replace the call to EXIT$ by STOP. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Sat Jul 18, 2020 2:47 pm Post subject: |
|
|
Dietmar,
You could always ask Intel to change their compiler ....
Eddie |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Sun Jul 19, 2020 4:57 am Post subject: |
|
|
Dietmar,
Rather than mess with CLEARWIN64.DLL, you could produce your custom version of an import library for the DLL by (1) use DUMPBIN /exports on the DLL to produce a DEF file, (2) edit the DEF file and remove the symbols such as EXIT and EXIT$ that you do not want exported, and (3) use LIB.exe on the DEF file to generate your custom version of CLEARWIN64.a.
You then use your custom version of CLEARWIN64.a when linking your application with the INTEL RTL. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Sun Jul 19, 2020 7:42 am Post subject: |
|
|
That is an interesting idea from mecej4. clearwin64.dll is built using Microsoft C/C++ and I could supply the .def file from which a custom .lib stub library could be produced. |
|
Back to top |
|
|
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Mon Jul 20, 2020 10:42 am Post subject: |
|
|
Paul, mecej4,
this sounds good. I would appreciate if Paul could send me a def file (based on version 8.63 of ftn95 environent). I still do not understand if this def file will contain both the symols exit and exit$ or not and how I would create the corresponing lib file from this def file using utility lib.
Thanks and regards,
Dietmar |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Mon Jul 20, 2020 11:41 am Post subject: |
|
|
The procedure is quite simple.
1. Obtain the DEF file from PaulLaidler and make a working copy, say DSCLRWIN.def. This a plain text file, with the first one or two lines naming the new library that will be built. Subsequent lines contain the names of entry points in CLEARWIN64.DLL, one entry per line. You are going to prune this list to suit your needs.
2. Edit the DEF file working copy and remove the lines containing entries that you do not want to be visible to the MS linker when you link your Intel Fortran programs, such as EXIT$.
3. Create the new import library (stub library) using the LIB utility (part of MS Visual C package, also used by Intel Fortran)
Code: | lib /def:dsclrwin.def /machine:amd64 |
Use the resulting dsclrwin.lib file instead of the one that you used in the past when linking with Intel Fortran (clearwin64.lib?). |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
|
Back to top |
|
|
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Mon Jul 20, 2020 2:28 pm Post subject: |
|
|
mecej4, Paul,
thanks for your instructions and the def file. This helped to remove the "exit doubly defined" warning. Unfortunately it does not prevent the runtime error. Hence I first will try to get rid of all other symbols which are doubly defined before attacking the runtime error occurring when calling exit.
Regards
Dietmar |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Mon Jul 20, 2020 2:43 pm Post subject: |
|
|
Dietmar,
Please keep in mind that non-standard functions such as EXIT$ may have different interfaces depending on whether they are provided by Silverfrost or Intel.
When you use such routines, you have to make sure that you are passing the correct types, order and values of arguments, and take appropriate actions depending on returned error codes. |
|
Back to top |
|
|
|