tracym111 / google-glog

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

./configure CPPFLAGS="-arch i386" results in build failure. #57

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
My diagnosis - you're using CXXFLAGS  in your linker line - but you also need 
CPPFLAGS!  Here's why I think that.

1. If I just ./configure without the CPPFLAGS setting, I don't see this issue.  
2. If I use CXXFLAGS="-arch i386":, I don't see this issue.

From your documentation, CPPFLAGS should be passed to all C and C++ compilers, 
CXXFLAGS just to the C++.

I think that's how it's "generally done".  For example, I configure gtest with 
CPPFLAGS="-arch i386" and it works fine.

*** What steps will reproduce the problem?

1. ./configure CPPFLAGS="-arch i386"
2. make clean && make

*** What is the expected output? What do you see instead?

I expect to see a correct build - but I see errors starting with:

g++ -dynamiclib ${wl}-undefined ${wl}dynamic_lookup -o 
.libs/libglog.0.0.0.dylib  .libs/libglog_la-logging.o 
.libs/libglog_la-raw_logging.o .libs/libglog_la-vlog_is_on.o 
.libs/libglog_la-utilities.o .libs/libglog_la-demangle.o 
.libs/libglog_la-symbolize.o .libs/libglog_la-signalhandler.o  -lpthread  
-install_name  /usr/local/lib/libglog.0.dylib -compatibility_version 1 
-current_version 1.0 -Wl,-single_module
ld: warning: in .libs/libglog_la-logging.o, file was built for i386 which is 
not the architecture being linked (x86_64)
ld: warning: in .libs/libglog_la-raw_logging.o, file was built for i386 which 
is not the architecture being linked (x86_64)
ld: warning: in .libs/libglog_la-vlog_is_on.o, file was built for i386 which is 
not the architecture being linked (x86_64)
ld: warning: in .libs/libglog_la-utilities.o, file was built for i386 which is 
not the architecture being linked (x86_64)
ld: warning: in .libs/libglog_la-demangle.o, file was built for i386 which is 
not the architecture being linked (x86_64)
ld: warning: in .libs/libglog_la-symbolize.o, file was built for i386 which is 
not the architecture being linked (x86_64)
ld: warning: in .libs/libglog_la-signalhandler.o, file was built for i386 which 
is not the architecture being linked (x86_64)
dsymutil .libs/libglog.0.0.0.dylib || :
warning: no debug symbols in executable (-arch x86_64)
(cd .libs && rm -f libglog.0.dylib && ln -s libglog.0.0.0.dylib libglog.0.dylib)
(cd .libs && rm -f libglog.dylib && ln -s libglog.0.0.0.dylib libglog.dylib)
ar cru .libs/libglog.a  libglog_la-logging.o libglog_la-raw_logging.o 
libglog_la-vlog_is_on.o libglog_la-utilities.o libglog_la-demangle.o 
libglog_la-symbolize.o libglog_la-signalhandler.o
ranlib .libs/libglog.a
creating libglog.la
(cd .libs && rm -f libglog.la && ln -s ../libglog.la libglog.la)
g++ -DHAVE_CONFIG_H -I. -I./src  -I./src -arch i386 -D_THREAD_SAFE     -Wall 
-Wwrite-strings -Woverloaded-virtual -Wno-sign-compare   -g -O2 -MT 
logging_unittest-logging_unittest.o -MD -MP -MF 
.deps/logging_unittest-logging_unittest.Tpo -c -o 
logging_unittest-logging_unittest.o `test -f 'src/logging_unittest.cc' || echo 
'./'`src/logging_unittest.cc
mv -f .deps/logging_unittest-logging_unittest.Tpo 
.deps/logging_unittest-logging_unittest.Po
/bin/sh ./libtool --tag=CXX   --mode=link g++ -D_THREAD_SAFE     -Wall 
-Wwrite-strings -Woverloaded-virtual -Wno-sign-compare   -g -O2 -D_THREAD_SAFE  
 -o logging_unittest  logging_unittest-logging_unittest.o  libglog.la       
-lpthread
g++ -D_THREAD_SAFE -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare 
-g -O2 -D_THREAD_SAFE -o .libs/logging_unittest 
logging_unittest-logging_unittest.o -Wl,-bind_at_load  ./.libs/libglog.dylib 
-lpthread
ld: warning: in logging_unittest-logging_unittest.o, file was built for i386 
which is not the architecture being linked (x86_64)
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [logging_unittest] Error 1

*** What version of the product are you using? On what operating system?

glog 0.3.1

Darwin hofmann 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 
2010; root:xnu-1504.7.4~1/RELEASE_I386 i386

*** Please provide any additional information below.

I'm happy to use this great logging system again!  Miss you guys... but having 
a great time...

Original issue reported on code.google.com by tom.ritc...@gmail.com on 4 Aug 2010 at 8:08

GoogleCodeExporter commented 8 years ago
try add LDFLAGS="-arch i386"

Original comment by moonza...@gmail.com on 11 Sep 2013 at 5:26

GoogleCodeExporter commented 8 years ago
Hi, the environment variable CPPFLAGS is used to set flags for the 
C-Pre-Processor, if you want to change behavior of the actual C++ compiler you 
must use CXXFLAGS environment variable

Original comment by frehb...@gmail.com on 6 Oct 2013 at 11:36