[LLVMbugs] [Bug 8346] New: clang under windows/mingw inserts visible standard library functions into object files
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Oct 9 13:18:05 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=8346
Summary: clang under windows/mingw inserts visible standard
library functions into object files
Product: clang
Version: trunk
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: ambrop7 at gmail.com
CC: llvmbugs at cs.uiuc.edu
> clang -O2 -c x.c
> clang -O2 -c y.c
> clang -o a.exe x.o y.o (or gcc)
y.o:fake:(.text+0x0): multiple definition of `strncasecmp'
x.o:fake:(.text+0x0): first defined here
y.o:fake:(.text+0x10): multiple definition of `strcasecmp'
x.o:fake:(.text+0x10): first defined here
collect2: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see
in
vocation)
How I set up clang:
Downloaded a 32-bit compiler from http://mingw-w64.sourceforge.net/ which I
unpacked to c:\\mingw.
Installed clang with:
> set PATH=%PATH%;c:\mingw\bin
> cmake ..\llvm -G "MinGW Makefiles" -DC_INCLUDE_DIRS=C:\\mingw\\i686-w64-mingw32\\include
> mingw32-make install
Did this before running the above clang commands:
> set PATH=%PATH%;c:\mingw\bin;C:\Program Files\LLVM\bin
Also made the following change to llvm to get it to compile:
--- lib/System/Win32/DynamicLibrary.inc (revision 116150)
+++ lib/System/Win32/DynamicLibrary.inc (working copy)
@@ -49,13 +49,11 @@
extern "C" {
// Use old callback if:
-// - Not using Visual Studio
// - Visual Studio 2005 or earlier but only if we are not using the Windows
SDK
// or Windows SDK version is older than 6.0
-// Use new callback if:
-// - Newer Visual Studio (comes with newer SDK).
-// - Visual Studio 2005 with Windows SDK 6.0+
-#if !defined(_MSC_VER) || _MSC_VER < 1500 && (!defined(VER_PRODUCTBUILD) ||
VER_PRODUCTBUILD < 6000)
+// - W32Api older than 3.12
+#if (defined(_MSC_VER) && _MSC_VER < 1500 && (!defined(VER_PRODUCTBUILD) ||
VER_PRODUCTBUILD < 6000)) || \
+ (defined(__W32API_VERSION) && (__W32API_MAJOR_VERSION < 3 ||
(__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 12)))
static BOOL CALLBACK ELM_Callback(PSTR ModuleName,
ModuleBaseType ModuleBase,
ULONG ModuleSize,
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list