Web lists-archives.com

[Mingw-users] DLL Build issues




Hi Keith and everybody,

I am running into a linker issue. I am trying to convert a Microsoft makefile into its equivalent MinGW using gcc. I am trying to build an example DLL for the ARM debugging toolset, which runs on Windows. I can compile and link an example DLL with no problems using nmake and Visual Studio version 6. My target is a 32-bit Windows 7 machine. I am getting repeated "undefined reference" errors from ld, so I either have an ordering problem, a missing configuration problem, or a library incompatibility problem, or.... Basics first:

 gcc --version
gcc.exe (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ld --version
GNU ld (GNU Binutils) 2.25.1
Copyright (C) 2014 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

$ bash --version
bash --version
GNU bash, version 3.1.23(1)-release (i686-pc-msys)
Copyright (C) 2005 Free Software Foundation, Inc.

$ mintty --version
mintty --version
mintty 1.0.3
(C) 2011 Andy Koppe
License GPLv3+: GNU GPL version 3 or later
There is no warranty, to the extent permitted by law.




Computer is running Windows 7 Enterprise Service Pack 1 64-bit

Here is the output from the successful build using Microsoft tools (from Mintty shell)


$ nmake

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

        cl /c /Za /I..\.. /I..\..\..\armulif /I..\..\..\rdi /I..\..\..\clx /D_CONSOLE /D_MBCS /DNLS /nologo /W3 /GX /GR /WX -DRDI_VERSION=151 -DARM10MODEL  /O2 /G6 /MD /DNDEBUG   /DARM_RELEASE="\"RVARMulatorISS1.4\""  /DBUILD_NUMBER=312 /Iderived  /Fomillisec.obj ..\..\millisec.c
millisec.c
        C:\Progra~2\Mib055~1\VC98\bin\link /INCREMENTAL:no /DLL   /OUT:Millisec.dll /DEF:..\..\sordi.def /IMPLIB:Millisec.lib millisec.obj   version.res ..\..\..\armulif\armulif.b\intelrel\armulif.lib  ..\..\..\clx\clx.b\intelrel\clx.lib  user32.lib
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

   Creating library Millisec.lib and object Millisec.exp
        echo "Made Millisec.dll"
"Made Millisec.dll"

Here is the output from my converted makefile:

$ make -f Makefile.min all
gcc -g -c -O2 -Wall -Z -MD -MF millisec.dep -D_CONSOLE -D_MBCS -DNLS -DARM10MODEL -DARM_RELEASE="/RVARMulatorISS1.4/" -DBUILD_NUMBER=312 -DRDI_VERSION=151 -I../.. -I../../../armulif -I../../../rdi -I../../../clx -I. -Iderived ../../millisec.c -o millisec.o
gcc -shared -g  -L /c/MinGW/lib -L. -L../../../armulif/armulif.b/intelrel -L../../../rdi/rditools.b/intelrel -L../../../clx/clx.b/intelrel  -l user32 --enable-runtime-pseudo-reloc -t  -o millisec.dll --library ../../../armulif/armulif.b/intelrel/armulif.lib --library ../../../clx/clx.b/intelrel/clx.lib --library ../../../rdi/rditools.b/intelrel/rditools.lib millisec.o
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: mode i386pe
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../dllcrt2.o
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/crtbegin.o
millisec.o
(c:/MinGW/lib/libmingw32.a)dllmain.o
(c:/MinGW/lib/libmingw32.a)gccmain.o
(c:/MinGW/lib/libmingw32.a)tlssup.o
(c:/MinGW/lib/libmingw32.a)tlsthrd.o
(c:/MinGW/lib/libmingw32.a)pseudo-reloc.o
(c:/MinGW/lib/libmingw32.a)pseudo-reloc-list.o
(c:/MinGW/lib/libmingw32.a)crtst.o
(c:/mingw/bin/../lib/gcc/mingw32/4.8.1/libgcc.a)_ctors.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00748.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00709.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00682.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00676.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00633.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00625.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00610.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00595.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00583.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00266.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00182.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00137.o
(c:/MinGW/lib/libmsvcrt.a)dczfs00052.o
(c:/MinGW/lib/libmsvcrt.a)dczfh.o
(c:/MinGW/lib/libmsvcrt.a)dczft.o
(c:/MinGW/lib/libkernel32.a)dchds01215.o
(c:/MinGW/lib/libkernel32.a)dchds01213.o
(c:/MinGW/lib/libkernel32.a)dchds01173.o
(c:/MinGW/lib/libkernel32.a)dchds00814.o
(c:/MinGW/lib/libkernel32.a)dchds00734.o
(c:/MinGW/lib/libkernel32.a)dchds00577.o
(c:/MinGW/lib/libkernel32.a)dchds00529.o
(c:/MinGW/lib/libkernel32.a)dchds00510.o
(c:/MinGW/lib/libkernel32.a)dchds00236.o
(c:/MinGW/lib/libkernel32.a)dchds00207.o
(c:/MinGW/lib/libkernel32.a)dchdh.o
(c:/MinGW/lib/libkernel32.a)dchdt.o
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/crtend.omillisec.o: In function `peripsordi_Initialise':
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../../armulif/perip_sordi.h:169: undefined reference to `ToolConf_Lookup'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../../armulif/perip_sordi.h:184: undefined reference to `dir_getdirsep'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../../armulif/perip_sordi.h:185: undefined reference to `clx_findfile'
millisec.o: In function `peripsordi_Info':
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../../armulif/perip_sordi.h:211: undefined reference to `ToolConf_AddTyped'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../../armulif/perip_sordi.h:219: undefined reference to `ToolConf_AddTagged'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../../armulif/perip_sordi.h:214: undefined reference to `ToolConf_AddTagged'
millisec.o: In function `Millisec_Init':
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:185: undefined reference to `CVector_Init'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:192: undefined reference to `ToolConf_DLookupUInt'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:202: undefined reference to `ARMul_GetMCLK'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:206: undefined reference to `Hostif_PrettyPrint'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:220: undefined reference to `ToolConf_FlatChild'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:220: undefined reference to `ARMulif_ReadBusRange'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:185: undefined reference to `Hostif_RaiseError'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:185: undefined reference to `Hostif_PrettyPrint'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:196: undefined reference to `Hostif_ConsolePrint'
millisec.o: In function `Millisec_Exit':
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:238: undefined reference to `CVector_Iterate'
c:\Program Files\ARM\RVARMulator\ExtensionKit\1.4.1\312\win_32-pentium\armulext\millisec.b\intelrel/../../millisec.c:238: undefined reference to `CVector_Clear'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: link errors found, deleting executable `Millisec.dll'
collect2.exe: error: ld returned 1 exit status

make: *** [millisec.dll] Error 1

Any insights or pointers to pertinent documentation will be gratefully accepted and appreciated.

Thanks,
Bob Cavanaugh


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe