Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Error Compiling on Arch Linux #420

Closed
GoogleCodeExporter opened this issue Apr 6, 2015 · 14 comments
Closed

Error Compiling on Arch Linux #420

GoogleCodeExporter opened this issue Apr 6, 2015 · 14 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
Download Depot Tools
mkdir -p ~/scripts
cd ~/scripts
svn co http://src.chromium.org/svn/trunk/tools/depot_tools
To make depot_tools work, you need to switch to python2:

If Python3 in installed:
sudo rm /usr/bin/python
sudo rm /usr/bin/python-config
sudo ln -s /usr/bin/python2 /usr/bin/python
sudo ln -s /usr/bin/python2-config /usr/bin/python-config

Next, download mod_pagespeed source code use depot_tools:
mkdir ~/mod_pagespeed # any directory is fine
cd ~/mod_pagespeed
export PATH=$PATH:~/scripts/depot_tools
gclient config http://modpagespeed.googlecode.com/svn/trunk/src
gclient sync --force --jobs=1

Compile:
cd ~/mod_pagespeed/src
make BUILDTYPE=Release


What is the expected output?
Successful compile.

What do you see instead?
Errors (and attempted corrections) shown below.

What version of the product are you using (please check X-Mod-Pagespeed
header)?
Attempted using Latest Beta & Trunk.

On what operating system?
Arch Linux

Which version of Apache?
Apache 2.2.22

Which MPM?
Prefork

Error #1:
  net/instaweb/apache/apache_message_handler.cc: In constructor ‘net_instaweb::ApacheMessageHandler::ApacheMessageHandler(const server_rec*, const base::StringPiece&, net_instaweb::Timer*)’:
  net/instaweb/apache/apache_message_handler.cc:51:42: error: ‘getpid’ was not declared in this scope
  net/instaweb/apache/apache_message_handler.cc: In member function ‘virtual void net_instaweb::ApacheMessageHandler::MessageVImpl(net_instaweb::MessageType, const char*, va_list)’:
  net/instaweb/apache/apache_message_handler.cc:89:72: error: ‘getpid’ was not declared in this scope
  net/instaweb/apache/apache_message_handler.cc: In member function ‘virtual void net_instaweb::ApacheMessageHandler::FileMessageVImpl(net_instaweb::MessageType, const char*, int, const char*, va_list)’:
  net/instaweb/apache/apache_message_handler.cc:112:72: error: ‘getpid’ was not declared in this scope
  make: *** [out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_message_handler.o] Error 1

Fixed by adding:
  #include <unistd.h>

Error #2 (similar to Error #1):
  net/instaweb/apache/apache_rewrite_driver_factory.cc: In member function ‘void net_instaweb::ApacheRewriteDriverFactory::ChildInit()’:
  net/instaweb/apache/apache_rewrite_driver_factory.cc:344:67: error: ‘getpid’ was not declared in this scope
  make: *** [out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_rewrite_driver_factory.o] Error 1

Fixed by adding:
  #include <unistd.h>


... more errors to follow in further comments tomorrow or over the weekend.

Original issue reported on code.google.com by mwhe...@360psg.com on 20 Apr 2012 at 6:06

@GoogleCodeExporter
Copy link
Author

Thanks for the info, we appreciate your efforts, and please do let us know of 
whatever errors you get/fix.

In case we need to make it conditional, do you know if there's a #define for 
Arch Linux? I had a quick search but couldn't find it but if you happen to know 
it that would help; if you don't then don't worry about it since we'll work it 
out if/when we need it.

Original comment by matterb...@google.com on 20 Apr 2012 at 12:26

@GoogleCodeExporter
Copy link
Author

For unistd we can just use #ifdef unix. 

Original comment by morlov...@google.com on 20 Apr 2012 at 2:12

@GoogleCodeExporter
Copy link
Author

Error #3 (same as #1 & #2):
  net/instaweb/apache/log_message_handler.cc: In function ‘bool {anonymous}::LogMessageHandler(int, const char*, int, size_t, const string&)’:
  net/instaweb/apache/log_message_handler.cc:92:44: error: ‘getpid’ was not declared in this scope
  make: *** [out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/log_message_handler.o] Error 1

Fixed by adding:
  #include <unistd.h>

Error #4 (different error, same solution):
  net/instaweb/apache/mod_instaweb.cc: In function ‘bool net_instaweb::{anonymous}::give_dir_apache_user_permissions(net_instaweb::ApacheRewriteDriverFactory*, const GoogleString&)’:
  net/instaweb/apache/mod_instaweb.cc:644:15: error: ‘geteuid’ was not declared in this scope
  net/instaweb/apache/mod_instaweb.cc:657:34: error: ‘chown’ was not declared in this scope
  make: *** [out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/mod_instaweb.o] Error 1

Fixed by adding:
  #include <unistd.h>

That's all, compiled successfully after the 4th fix.

Original comment by mwhe...@360psg.com on 21 Apr 2012 at 4:35

@GoogleCodeExporter
Copy link
Author

I see this problem on OpenSUSE 12.2 ( pre-release ) and it started when the 
distro switched to GCC 4.7; it was building fine before. Does you Arch Linux 
version use GCC 4.7?

Original comment by robert.munteanu on 26 Apr 2012 at 7:45

@GoogleCodeExporter
Copy link
Author

Yes, it actually does.

Original comment by mwhe...@360psg.com on 26 Apr 2012 at 2:19

@GoogleCodeExporter
Copy link
Author

I'm pretty sure then it relates to GCC 4.7 and sooner or later it's going to 
hit everyone. I'm going to try your fixes on top of my build ; hopefully it 
will work.

Original comment by robert.munteanu on 26 Apr 2012 at 2:48

@GoogleCodeExporter
Copy link
Author

I think I have gcc-4.7 on a home machine. Will take a look there.

Original comment by morlov...@google.com on 1 May 2012 at 1:58

@GoogleCodeExporter
Copy link
Author

Original comment by jmara...@google.com on 31 May 2012 at 7:33

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

similarly on

    Opensuse 12.1

with

    httpd -V (custom build)
==>     Server version: Apache/2.4.3-dev (Unix)
        Server built:   Jun 11 2012 08:20:48
        Server's Module Magic Number: 20120211:3
        Server loaded:  APR 2.0.0-dev
        Compiled using: APR 2.0.0-dev
        Architecture:   64-bit
==>     Server MPM:     event
          threaded:     yes (fixed thread count)
            forked:     yes (variable process count)
        Server compiled with....
         -D APR_HAS_SENDFILE
         -D APR_HAS_MMAP
         -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
         -D APR_USE_SYSVSEM_SERIALIZE
         -D APR_USE_PTHREAD_SERIALIZE
         -D APR_HAS_OTHER_CHILD
         -D AP_HAVE_RELIABLE_PIPED_LOGS
         -D DYNAMIC_MODULE_LIMIT=256
         -D HTTPD_ROOT="/usr/local/apache24x"
         -D SUEXEC_BIN="/usr/local/apache24x/bin/suexec"
         -D DEFAULT_PIDLOG="/var/run/apache2/logs/httpd.pid"
         -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
         -D DEFAULT_ERRORLOG="logs/error_log"
         -D AP_TYPES_CONFIG_FILE="/usr/local/etc/apache2/mime.types"
         -D SERVER_CONFIG_FILE="/usr/local/etc/apache2/httpd.conf"

and

    gcc -v (distro packaging)
        Using built-in specs.
        COLLECT_GCC=/usr/bin/gcc-4.7
        COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.7/lto-wrapper
        Target: x86_64-suse-linux
        Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.7 --enable-ssp --disable-libssp --disable-libitm --disable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --enable-linker-build-id --program-suffix=-4.7 --enable-linux-futex --without-system-libunwind --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
        Thread model: posix
        gcc version 4.7.0 20120604 [gcc-4_7-branch revision 188177] (SUSE Linux)

for both

    gclient config http://modpagespeed.googlecode.com/svn/trunk/src

and

    gclient config  http://modpagespeed.googlecode.com/svn/branches/latest-beta/src

at

    cd src
    make -j15 V=1 $CFG_STR BUILDTYPE=Release

I see simlar errors,

    ...
    net/instaweb/apache/log_message_handler.cc: In function ‘bool {anonymous}::LogMessageHandler(int, const char*, int, size_t, const string&)’:
    net/instaweb/apache/log_message_handler.cc:92:44: error: ‘getpid’ was not declared in this scope
    net/instaweb/apache/apache_message_handler.cc: In constructor ‘net_instaweb::ApacheMessageHandler::ApacheMessageHandler(const server_rec*, const base::StringPiece&, net_instaweb::Timer*)’:
    net/instaweb/apache/apache_message_handler.cc:51:42: error: ‘getpid’ was not declared in this scope
    net/instaweb/apache/apache_message_handler.cc: In member function ‘virtual void net_instaweb::ApacheMessageHandler::MessageVImpl(net_instaweb::MessageType, const char*, __va_list_tag*)’:
    net/instaweb/apache/apache_message_handler.cc:89:72: error: ‘getpid’ was not declared in this scope
    net/instaweb/apache/apache_message_handler.cc: In member function ‘virtual void net_instaweb::ApacheMessageHandler::FileMessageVImpl(net_instaweb::MessageType, const char*, int, const char*, __va_list_tag*)’:
    net/instaweb/apache/apache_message_handler.cc:112:72: error: ‘getpid’ was not declared in this scope
    ...


Original comment by k357...@gmail.com on 15 Jun 2012 at 3:47

@GoogleCodeExporter
Copy link
Author

as suggested, adding

    #include <unistd.h>

to each of

    net/instaweb/apache/apache_message_handler.cc
    net/instaweb/apache/log_message_handler.cc
    net/instaweb/apache/mod_instaweb.cc
    net/instaweb/apache/apache_rewrite_driver_factory.cc

allows the build to complete with gcc 4.7

Original comment by k357...@gmail.com on 30 Jun 2012 at 4:55

@GoogleCodeExporter
Copy link
Author

Now that my machine actually does have gcc-4.7.1 (it has 4.6 as of time of last 
comment), I've committed r1680 with the needed includes.

Original comment by morlov...@google.com on 10 Jul 2012 at 5:05

@GoogleCodeExporter
Copy link
Author

Confirming, with a clean pull of modpagespeed/trunk, r0.10.0.0-1680, building on

 x86_64 arch
 gcc 4.7.1
 glibc 2.14.1

builds, installs & execs with no source patching required.

And, for this build, current test status is:

    ./out/Release/mod_pagespeed_test
        ...
        [ RUN      ] AprFileSystemTest.TestRecursivelyMakeDir_NoPermission
        net/instaweb/util/file_system_test.cc:185: Failure
        Value of: file_system()->Exists(base.c_str(), &handler_).is_false()
          Actual: false
        Expected: true
        [  FAILED  ] AprFileSystemTest.TestRecursivelyMakeDir_NoPermission (0 ms)
        ...
        [----------] Global test environment tear-down
        [==========] 39 tests from 3 test cases ran. (17359 ms total)
        [  PASSED  ] 38 tests.
        [  FAILED  ] 1 test, listed below:
        [  FAILED  ] AprFileSystemTest.TestRecursivelyMakeDir_NoPermission

         1 FAILED TEST

    ./out/Release/pagespeed_automatic_test
        ...
        [ RUN      ] FileCacheTest.Clean
        [0710/110820:WARNING:google_message_handler.cc(36)] Failed to read cache clean timestamp /tmp/gtest.8541/!clean!time!.  Doing an extra cache clean to be safe.
        [0710/110820:WARNING:google_message_handler.cc(36)] Failed to read cache clean timestamp /tmp/gtest.8541/!clean!time!.  Doing an extra cache clean to be safe.
        [0710/110820:WARNING:google_message_handler.cc(36)] Failed to read cache clean timestamp /tmp/gtest.8541/!clean!time!.  Doing an extra cache clean to be safe.
        net/instaweb/util/file_cache_test.cc:146: Failure
        Value of: total_size
          Actual: 33
        Expected: (2 + 4 + 8) * 4
        Which is: 56
        ./net/instaweb/util/cache_test_base.h:89: Failure
        ...
        Expected: CacheInterface::kAvailable
        Which is: 0
        For key: a2
        ./net/instaweb/util/cache_test_base.h:89: Failure
        Value of: callback_.state_
          Actual: 1
        Expected: CacheInterface::kAvailable
        Which is: 0
        For key: a/3
        [  FAILED  ] FileCacheTest.Clean (4 ms)
        ...
        [----------] Global test environment tear-down
        [==========] 1897 tests from 199 test cases ran. (17105 ms total)
        [  PASSED  ] 1896 tests.
        [  FAILED  ] 1 test, listed below:
        [  FAILED  ] FileCacheTest.Clean

         1 FAILED TEST

Original comment by k357...@gmail.com on 10 Jul 2012 at 6:12

@GoogleCodeExporter
Copy link
Author

Maks, do you have any comment on the most recent issue?
IIRC this is caused by running the test as a different user from the one that 
runs httpd?

Original comment by matterb...@google.com on 31 Oct 2012 at 3:11

@GoogleCodeExporter
Copy link
Author

I think I fixed the cache thing a while back in r1686. The first one means the 
test was run as root or some other overprivileged user.



Original comment by morlov...@google.com on 28 Nov 2012 at 7:25

  • Changed state: Fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant