Candypz / google-glog

Automatically exported from code.google.com/p/google-glog
Other
0 stars 0 forks source link

Cannot compile with MinGW #27

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Attempt to compile glog 0.3.0 with Mingw 4.4.1 (gcc.exe (TDM-2 mingw32)
4.4.1)

What is the expected output? What do you see instead?
Make produces following output:

/bin/sh ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.
-I./src  -I
./src    -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare  
-DNDEBUG
 -g -O2 -MT libglog_la-logging.lo -MD -MP -MF .deps/libglog_la-logging.Tpo
-c -o
 libglog_la-logging.lo `test -f 'src/logging.cc' || echo './'`src/logging.cc
mkdir .libs
 g++ -DHAVE_CONFIG_H -I. -I./src -I./src -Wall -Wwrite-strings
-Woverloaded-virt
ual -Wno-sign-compare -DNDEBUG -g -O2 -MT libglog_la-logging.lo -MD -MP -MF
.dep
s/libglog_la-logging.Tpo -c src/logging.cc  -DDLL_EXPORT -DPIC -o
.libs/libglog_
la-logging.o
In file included from src/logging.cc:32:
src/utilities.h:78:19: error: port.h: No such file or directory
src/logging.cc:118: warning: dereferencing type-punned pointer will break
strict
-aliasing rules
src/logging.cc:135: warning: dereferencing type-punned pointer will break
strict
-aliasing rules
src/logging.cc:152: warning: dereferencing type-punned pointer will break
strict
-aliasing rules
src/logging.cc:155: warning: dereferencing type-punned pointer will break
strict
-aliasing rules
src/logging.cc:165: warning: dereferencing type-punned pointer will break
strict
-aliasing rules
src/logging.cc:208: warning: 'google::LogMessage::num_messages_' redeclared
with
out dllimport attribute: previous dllimport ignored
src/logging.cc:213: warning: 'google::LogSeverityNames' redeclared without
dllim
port attribute: previous dllimport ignored
src/logging.cc: In function 'const char*
google::GetLogSeverityName(google::LogS
everity)':
src/logging.cc:220: warning: 'const char*
google::GetLogSeverityName(google::Log
Severity)' redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc: At global scope:
src/logging.cc:227: warning: 'virtual google::base::Logger::~Logger()'
redeclare
d without dllimport attribute: previous dllimport ignored
src/logging.cc:289: warning: 'void google::ReprintFatalMessage()'
redeclared wit
hout dllimport attribute: previous dllimport ignored
src/logging.cc:290: warning: 'google::base::Logger*
google::base::GetLogger(goog
le::LogSeverity)' redeclared without dllimport attribute: previous
dllimport ign
ored
src/logging.cc:291: warning: 'void google::base::SetLogger(google::LogSeverity,
google::base::Logger*)' redeclared without dllimport attribute: previous
dllimpo
rt ignored
src/logging.cc: In member function 'bool
google::<unnamed>::LogFileObject::Creat
eLogfile(const char*)':
src/logging.cc:722: error: 'symlink' was not declared in this scope
src/logging.cc: In member function 'virtual void
google::<unnamed>::LogFileObjec
t::Write(bool, time_t, const char*, int)':
src/logging.cc:764: error: 'localtime_r' was not declared in this scope
src/logging.cc: At global scope:
src/logging.cc:906: warning: 'google::LogMessage::kMaxLogMessageLen' redeclared
without dllimport attribute after being referenced with dll linkage
src/logging.cc:923: warning:
'google::LogMessage::fatal_msg_data_exclusive_' red
eclared without dllimport attribute: previous dllimport ignored
src/logging.cc:924: warning: 'google::LogMessage::fatal_msg_data_shared_'
redecl
ared without dllimport attribute: previous dllimport ignored
src/logging.cc:926: warning:
'google::LogMessage::LogMessageData::~LogMessageDat
a()' redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc:931: warning: 'google::LogMessage::LogMessage(const char*,
int, g
oogle::LogSeverity, int, void (google::LogMessage::*)())' redeclared
without dll
import attribute: previous dllimport ignored
src/logging.cc:937: warning: 'google::LogMessage::LogMessage(const char*,
int, c
onst google::CheckOpString&)' redeclared without dllimport attribute:
previous d
llimport ignored
src/logging.cc:943: warning: 'google::LogMessage::LogMessage(const char*, int)'
redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc:947: warning: 'google::LogMessage::LogMessage(const char*,
int, g
oogle::LogSeverity)' redeclared without dllimport attribute after being
referenc
ed with dll linkage
src/logging.cc:951: warning: 'google::LogMessage::LogMessage(const char*,
int, g
oogle::LogSeverity, google::LogSink*, bool)' redeclared without dllimport
attrib
ute: previous dllimport ignored
src/logging.cc:958: warning: 'google::LogMessage::LogMessage(const char*,
int, g
oogle::LogSeverity, std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<
char>, std::allocator<char> > > >*)' redeclared without dllimport
attribute: pre
vious dllimport ignored
src/logging.cc:964: warning: 'google::LogMessage::LogMessage(const char*,
int, g
oogle::LogSeverity, std::string*)' redeclared without dllimport attribute:
previ
ous dllimport ignored
src/logging.cc:970: warning: 'void google::LogMessage::Init(const char*,
int, go
ogle::LogSeverity, void (google::LogMessage::*)())' redeclared without
dllimport
 attribute after being referenced with dll linkage
src/logging.cc: In member function 'void google::LogMessage::Init(const
char*, i
nt, google::LogSeverity, void (google::LogMessage::*)())':
src/logging.cc:1010: error: 'localtime_r' was not declared in this scope
src/logging.cc: At global scope:
src/logging.cc:1054: warning: 'google::LogMessage::~LogMessage()'
redeclared wit
hout dllimport attribute after being referenced with dll linkage
src/logging.cc:1061: warning: 'void google::LogMessage::Flush()' redeclared
with
out dllimport attribute after being referenced with dll linkage
src/logging.cc:1131: warning: 'void google::LogMessage::SendToLog()' redeclared
without dllimport attribute after being referenced with dll linkage
src/logging.cc:1220: warning: 'void
google::LogMessage::RecordCrashReason(google
::glog_internal_namespace_::CrashReason*)' redeclared without dllimport
attribut
e after being referenced with dll linkage
src/logging.cc:1246: error: definition of 'void (*
google::g_logging_fail_func)(
)volatile' is marked 'dllimport'
src/logging.cc: In function 'void google::InstallFailureFunction(void (*)())':
src/logging.cc:1251: warning: 'void google::InstallFailureFunction(void (*)())'
redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc: At global scope:
src/logging.cc:1255: warning: 'static void google::LogMessage::Fail()'
redeclare
d without dllimport attribute after being referenced with dll linkage
src/logging.cc:1260: warning: 'void google::LogMessage::SendToSink()'
redeclared
 without dllimport attribute after being referenced with dll linkage
src/logging.cc:1273: warning: 'void google::LogMessage::SendToSinkAndLog()'
rede
clared without dllimport attribute after being referenced with dll linkage
src/logging.cc:1279: warning: 'void google::LogMessage::SaveOrSendToLog()'
redec
lared without dllimport attribute after being referenced with dll linkage
src/logging.cc:1292: warning: 'void
google::LogMessage::WriteToStringAndLog()' r
edeclared without dllimport attribute after being referenced with dll linkage
src/logging.cc:1305: warning: 'void
google::LogMessage::SendToSyslogAndLog()' re
declared without dllimport attribute: previous dllimport ignored
src/logging.cc:1338: warning: 'static google::int64
google::LogMessage::num_mess
ages(int)' redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'std::ostream&
google::operator<<(std::ostream&, con
st google::PRIVATE_Counter&)':
src/logging.cc:1345: warning: 'std::ostream&
google::operator<<(std::ostream&, c
onst google::PRIVATE_Counter&)' redeclared without dllimport attribute:
previous
 dllimport ignored
src/logging.cc: At global scope:
src/logging.cc:1352: warning:
'google::ErrnoLogMessage::ErrnoLogMessage(const ch
ar*, int, google::LogSeverity, int, void (google::LogMessage::*)())' redeclared
without dllimport attribute: previous dllimport ignored
src/logging.cc:1358: warning: 'google::ErrnoLogMessage::~ErrnoLogMessage()'
rede
clared without dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'void google::FlushLogFiles(google::LogSeverity)':
src/logging.cc:1366: warning: 'void google::FlushLogFiles(google::LogSeverity)'
redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'void
google::FlushLogFilesUnsafe(google::LogSeverit
y)':
src/logging.cc:1370: warning: 'void
google::FlushLogFilesUnsafe(google::LogSever
ity)' redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'void
google::SetLogDestination(google::LogSeverity,
 const char*)':
src/logging.cc:1374: warning: 'void
google::SetLogDestination(google::LogSeverit
y, const char*)' redeclared without dllimport attribute: previous dllimport
igno
red
src/logging.cc: In function 'void
google::SetLogSymlink(google::LogSeverity, con
st char*)':
src/logging.cc:1378: warning: 'void
google::SetLogSymlink(google::LogSeverity, c
onst char*)' redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc: At global scope:
src/logging.cc:1382: warning: 'virtual google::LogSink::~LogSink()'
redeclared w
ithout dllimport attribute: previous dllimport ignored
src/logging.cc:1385: warning: 'virtual void
google::LogSink::WaitTillSent()' red
eclared without dllimport attribute after being referenced with dll linkage
src/logging.cc:1389: warning: 'static std::string
google::LogSink::ToString(goog
le::LogSeverity, const char*, int, const tm*, const char*, size_t)'
redeclared w
ithout dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'void google::AddLogSink(google::LogSink*)':
src/logging.cc:1418: warning: 'void google::AddLogSink(google::LogSink*)'
redecl
ared without dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'void google::RemoveLogSink(google::LogSink*)':
src/logging.cc:1422: warning: 'void
google::RemoveLogSink(google::LogSink*)' red
eclared without dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'void google::SetLogFilenameExtension(const
char*)':

src/logging.cc:1426: warning: 'void google::SetLogFilenameExtension(const
char*)
' redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'void
google::SetStderrLogging(google::LogSeverity)'
:
src/logging.cc:1430: warning: 'void
google::SetStderrLogging(google::LogSeverity
)' redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'void
google::SetEmailLogging(google::LogSeverity, c
onst char*)':
src/logging.cc:1434: warning: 'void
google::SetEmailLogging(google::LogSeverity,
 const char*)' redeclared without dllimport attribute: previous dllimport
ignore
d
src/logging.cc: In function 'void google::LogToStderr()':
src/logging.cc:1438: warning: 'void google::LogToStderr()' redeclared
without dl
limport attribute: previous dllimport ignored
src/logging.cc: In function 'bool google::SendEmail(const char*, const
char*, co
nst char*)':
src/logging.cc:1513: warning: 'bool google::SendEmail(const char*, const char*,
const char*)' redeclared without dllimport attribute: previous dllimport
ignored

src/logging.cc: In function 'const std::vector<std::basic_string<char,
std::char
_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, st
d::char_traits<char>, std::allocator<char> > > >&
google::GetLoggingDirectories(
)':
src/logging.cc:1568: warning: 'const std::vector<std::basic_string<char,
std::ch
ar_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > >&
google::GetLoggingDirectorie
s()' redeclared without dllimport attribute after being referenced with dll
link
age
src/logging.cc: In function 'void
google::GetExistingTempDirectories(std::vector
<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
std::al
locator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >
 >*)':
src/logging.cc:1598: warning: 'void
google::GetExistingTempDirectories(std::vect
or<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
std::
allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >
 > >*)' redeclared without dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'void google::TruncateLogFile(const char*,
google::i
nt64, google::int64)':
src/logging.cc:1612: warning: 'void google::TruncateLogFile(const char*,
google:
:int64, google::int64)' redeclared without dllimport attribute: previous
dllimpo
rt ignored
src/logging.cc: In function 'void google::TruncateLogFile(const char*,
google::i
nt64, google::int64)':
src/logging.cc:1621: error: 'O_NOFOLLOW' was not declared in this scope
src/logging.cc:1631: error: 'truncate' was not declared in this scope
src/logging.cc:1660: error: 'pread' was not declared in this scope
src/logging.cc:1661: error: 'pwrite' was not declared in this scope
src/logging.cc: In function 'void google::TruncateStdoutStderr()':
src/logging.cc:1687: warning: 'void google::TruncateStdoutStderr()'
redeclared w
ithout dllimport attribute: previous dllimport ignored
src/logging.cc: In function 'std::string* google::CheckstrcmptrueImpl(const
char
*, const char*, const char*)':
src/logging.cc:1713: warning: 'std::string*
google::CheckstrcmptrueImpl(const ch
ar*, const char*, const char*)' redeclared without dllimport attribute:
previous
 dllimport ignored
src/logging.cc: In function 'std::string*
google::CheckstrcmpfalseImpl(const cha
r*, const char*, const char*)':
src/logging.cc:1714: warning: 'std::string*
google::CheckstrcmpfalseImpl(const c
har*, const char*, const char*)' redeclared without dllimport attribute:
previou
s dllimport ignored
src/logging.cc: In function 'std::string* google::CheckstrcasecmptrueImpl(const
char*, const char*, const char*)':
src/logging.cc:1715: warning: 'std::string*
google::CheckstrcasecmptrueImpl(cons
t char*, const char*, const char*)' redeclared without dllimport attribute:
prev
ious dllimport ignored
src/logging.cc: In function 'std::string*
google::CheckstrcasecmpfalseImpl(const
 char*, const char*, const char*)':
src/logging.cc:1716: warning: 'std::string*
google::CheckstrcasecmpfalseImpl(con
st char*, const char*, const char*)' redeclared without dllimport
attribute: pre
vious dllimport ignored
src/logging.cc: In function 'int google::posix_strerror_r(int, char*, size_t)':
src/logging.cc:1719: warning: 'int google::posix_strerror_r(int, char*,
size_t)'
 redeclared without dllimport attribute after being referenced with dll linkage
src/logging.cc: In function 'int google::posix_strerror_r(int, char*, size_t)':
src/logging.cc:1731: error: 'strerror_r' was not declared in this scope
src/logging.cc: At global scope:
src/logging.cc:1769: warning:
'google::LogMessageFatal::LogMessageFatal(const ch
ar*, int)' redeclared without dllimport attribute after being referenced
with dl
l linkage
src/logging.cc:1772: warning:
'google::LogMessageFatal::LogMessageFatal(const ch
ar*, int, const google::CheckOpString&)' redeclared without dllimport attribute
after being referenced with dll linkage
src/logging.cc:1776: warning: 'google::LogMessageFatal::~LogMessageFatal()'
rede
clared without dllimport attribute after being referenced with dll linkage
make: *** [libglog_la-logging.lo] Error 1

What version of the product are you using? On what operating system?
Windows Vista
Glog 0.3.0
MinGW (gcc.exe (TDM-2 mingw32) 4.4.1)

Please provide any additional information below.

Original issue reported on code.google.com by AndrewMc...@gmail.com on 14 Jan 2010 at 6:41

GoogleCodeExporter commented 8 years ago
Same trouble under wine-1.1.38/MinGW-4.4.0

Original comment by zl29ah@gmail.com on 2 Mar 2010 at 5:23

GoogleCodeExporter commented 8 years ago
I believe this is because ./configure creates a utilities.h file that should 
include windows/port.h instead of just port.h; however, fixing this simply 
leads to issue 15

Original comment by warrensi...@gmail.com on 10 Oct 2010 at 11:16

GoogleCodeExporter commented 8 years ago
I don't think that last solution is correct - though I do not have a Windows 
machine to test.  (To third parties, I'm implicated in this because Warren and 
I are working on a project and he's on the Windows side...)

Let's actually look at the files in the directory.

src/
  config.h
  # other stuff.
  glog/
    log_severity.h
    logging.h
    # other 

  windows/
    config.h
    port.h
    glog/
      log_severity.h
      logging.h
      # other stuff.

You can see that the windows/ subdirectory contains "amended" copies of files 
in the main directory.

So it seems to me that including windows/port.h is not the right thing - in 
fact, the writers of the code are intending to shadow window's "port.h" with 
their own.

It seems to me that the solution is that that src/windows subdirectory needs to 
be in the include path of your compilation before the src/ subdirectory.

 I have to say that I'm not sure how the include path really gets set inside config, but I'm pretty sure that this is the correct diagnosis of the issue.

Original comment by tom.ritc...@gmail.com on 12 Oct 2010 at 3:44

GoogleCodeExporter commented 8 years ago
I did a hack on Makefile to inlcude 'src/windows' with -I option. With this the 
src/windows/port.h is included automatically.

But the below problem remains:

src/windows/port.h: In function 'tm* localtime_r(const time_t*, tm*)':
src/windows/port.h:133:28: error: 'localtime_s' was not declared in this scope
src/windows/port.h: In function 'char* strerror_r(int, char*, size_t)':
src/windows/port.h:138:33: error: 'strerror_s' was not declared in this scope

So i opened the time.h and string.h from C:\MinGW\include to see whether the 
files have the functions localtime_s and strerror_s but there are no such 
definitions.

I have attached the files for reference!

Please advise on how to modify glog source for MINGW!

Original comment by kdkoms...@live.in on 2 Oct 2012 at 5:39

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

Please dont use MSYS/MINGW for compiling GLOG builds. I fixed the errors with 
src/windows/port.h . But the errors related to src/logging.cc cant be solved as 
MSYS/MINGW does not have 'syslink' (symbolic link) in unistd.h 
(http://mingw.org/wiki/MSYS_1_0_12_Features)

So for WINDOWS environment better use Visual Studio or Cygwin environment!

Thanks
KDK

Original comment by kdkoms...@live.in on 2 Oct 2012 at 8:16