apache / incubator-pagespeed-mod

Apache module for rewriting web pages to reduce latency and bandwidth.
http://modpagespeed.com
Apache License 2.0
696 stars 158 forks source link

Support OSX with PSOL #612

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
PSOL won't currently build on OSX.  While supporting mod_pagespeed in Apache on 
OSX might be difficult, just getting PSOL to build might be practical.  If 
ngx_pagespeed is going to support OSX [1] it needs PSOL to support OSX.

If you follow the "build from source" instructions for mod_pagespeed on OSX you 
get:

  $ gclient config http://modpagespeed.googlecode.com/svn/trunk/src
  ...
  $ gclient sync --force --jobs=1
  ...
  $ cd src/
  $ make mod_pagespeed_test pagespeed_automatic_test
  make: *** No rule to make target `mod_pagespeed_test`.  Stop.

[1] https://github.com/pagespeed/ngx_pagespeed/issues/149

Original issue reported on code.google.com by jefftk@google.com on 25 Jan 2013 at 4:01

GoogleCodeExporter commented 9 years ago
gyp doesn't generate makefiles on OS X by default. You need to either use 
Xcode, or pass "-f make" to gyp. The easy way of doing that might be to just 
hardcode it in the DEPS file.

Original comment by morlov...@google.com on 25 Jan 2013 at 4:07

GoogleCodeExporter commented 9 years ago
To elaborate on Maks' comment: in order to compile with make you need to modify 
src/DEPS:

    @@ -265,7 +265,7 @@
       {
         # A change to a .gyp, .gypi, or to GYP itself should run the generator.
         "pattern": ".",
    -    "action": ["python", "src/build/gyp_chromium",
    +    "action": ["python", "src/build/gyp_chromium", "--format=make",
                    "-Dchromium_revision=" + Var("chromium_revision_num")],
       },
     ]

I still get compilation errors, however.

Original comment by jefftk@google.com on 25 Jan 2013 at 4:50

GoogleCodeExporter commented 9 years ago
Instead of the patch to add --format=make to gyp arguments, you can instead set 
an environment variable and re-run runhooks:

    GYP_GENERATORS=make gclient runhooks

Original comment by jefftk@google.com on 25 Jan 2013 at 8:37

GoogleCodeExporter commented 9 years ago
> I still get compilation errors, however.

To be specific:

$ make mod_pagespeed_test pagespeed_automatic_test
  CXX(host) out/Debug/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/stubs/strutil.o
In file included from 
third_party/protobuf/src/google/protobuf/stubs/strutil.cc:33:
third_party/protobuf/src/google/protobuf/stubs/strutil.h:36:20: warning: 
stdlib.h: No such file or directory
third_party/protobuf/src/google/protobuf/stubs/strutil.h:37:18: warning: 
vector: No such file or directory
In file included from 
third_party/protobuf/src/google/protobuf/stubs/strutil.h:38,
                 from third_party/protobuf/src/google/protobuf/stubs/strutil.cc:33:
third_party/protobuf/src/google/protobuf/stubs/common.h:38:20: warning: 
assert.h: No such file or directory
third_party/protobuf/src/google/protobuf/stubs/common.h:40:19: warning: 
cstddef: No such file or directory
third_party/protobuf/src/google/protobuf/stubs/common.h:41:18: warning: string: 
No such file or directory
...

It looks like includes are screwed up.

Original comment by jefftk@google.com on 29 Jan 2013 at 9:19

GoogleCodeExporter commented 9 years ago
I did check that I can build normally with those includes.  If I create tmp.c 
with contents:

    // Print something a specified number of times.                                                                                                                                   
    #include <stdlib.h>
    #include <stdio.h>
    int main(int argc, char** argv) {
      if (argc != 3) {
         printf("usage: %s count text\n", argv[0]);  
         return 1;
      }
      int n = atoi(argv[1]);
      int i;
      for (i = 0 ; i < n ; i++) {
         printf("%s\n", argv[2]);
      }
      return 0;
    }

$ gcc -Wall -o tmp.out tmp.c && ./tmp.out 3 "hello world"
hello world
hello world
hello world

Original comment by jefftk@google.com on 29 Jan 2013 at 9:27

GoogleCodeExporter commented 9 years ago
tip: passing V=1 to make will make it print the command lines.

Original comment by morlov...@google.com on 29 Jan 2013 at 9:32

GoogleCodeExporter commented 9 years ago
The command is:

  g++ '-DCHROMIUM_REVISION=90205' '-DGOOGLE_PROTOBUF_NO_RTTI' '-DDYNAMIC_ANNOTATIONS_ENABLED=1' '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' -Ithird_party/chromium/src -Ithird_party/protobuf -Ithird_party/protobuf/src  -isysroot /Developer/SDKs/MacOSX10.5.sdk -O0 -gdwarf-2 -fvisibility=hidden -Wnewline-eof -mmacosx-version-min=10.5 -arch i386 -fno-strict-aliasing -funsigned-char -Wno-error -Wendif-labels -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility-inlines-hidden -fno-threadsafe-statics -MMD -MF out/Debug/.deps/out/Debug/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/stubs/strutil.o.d.raw  -c -o out/Debug/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/stubs/strutil.o third_party/protobuf/src/google/protobuf/stubs/strutil.cc

I think the problematic part is the -isysroot /Developer/SDKs/MacOSX10.5.sdk

Original comment by jefftk@google.com on 29 Jan 2013 at 10:41

GoogleCodeExporter commented 9 years ago
After failing to switch xcode's sysroot and deplyoyment target in the xcode 
gui, I fell back to doing it with sed:

    $ cd mod_pagespeed/src
    $ find . | grep pbxproj$ | while read line; do
        sed -i -e 's/MACOSX_DEPLOYMENT_TARGET = 10.5;/MACOSX_DEPLOYMENT_TARGET = 10.8;/' "$line"
    done
    $ find . | grep pbxproj$ | while read line ; do
        sed -i -e 's/SDKROOT = macosx10.5;/SDKROOT = macosx10.8;/' "$line"
    done

This gave new errors, and it looks like the root of them is that it's trying to 
run:

    /Applications/Xcode.app/Contents/Developer/usr/bin/gcc-4.2

Which doesn't exist.  There is a gcc right next to it, and gcc -v gives "gcc 
version 4.2.1" so I link it:

    sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/gcc /Applications/Xcode.app/Contents/Developer/usr/bin/gcc-4.2

But trying to build I get:

    $ xcodebuild -verbose -project all.xcodeproj -configuration Debug -target pagespeed_automatic
    === BUILD NATIVE TARGET protobuf_full_do_not_use OF PROJECT protobuf WITH CONFIGURATION Debug ===
    Check dependencies
    Unsupported compiler 'GCC 4.2' selected for architecture 'i386'
    ** BUILD FAILED **

Original comment by jefftk@google.com on 1 Feb 2013 at 4:10

GoogleCodeExporter commented 9 years ago
We're running an old version of gyp and chromium.  Maks is updating them for a 
different reason; I'm going to try again to get this to build on OSX when he 
finishes.

Original comment by jefftk@google.com on 1 Feb 2013 at 4:22

GoogleCodeExporter commented 9 years ago
The change to use a newer gyp is committed to svn: 
https://code.google.com/p/modpagespeed/source/detail?r=2465

Original comment by jefftk@google.com on 1 Feb 2013 at 4:42

GoogleCodeExporter commented 9 years ago
With the new version of gyp I got:

    Compiler: /Users/jefftk/mod_pagespeed/src/base/../third_party/llvm-build/Release+Asserts/bin/clang
    Reason:   /Users/jefftk/mod_pagespeed/src/base/../third_party/llvm-build/Release+Asserts/bin/clang -v -E -dM -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -x objective-c++ -c /dev/null 2>&1
     ** BUILD FAILED **

Checking, clang doesn't exist in 
third_party/llvm-build/Release+Asserts/bin/clang

PageSpeed Insights has in the hooks part of its DEPS file [1] the section:

   {
    # Pull clang on mac. If nothing changed, or on non-mac platforms, this takes
    # zero seconds to run. If something changed, it downloads a prebuilt clang,
    # which takes ~20s, but clang speeds up builds by more than 20s.
    "pattern": ".",
    "action": ["python", "src/tools/clang/scripts/update.py", "--mac-only"],
  },

Adding this to mod_pagespeed/src/DEPS fixes that problem.

[1] https://code.google.com/p/page-speed/source/browse/lib/trunk/src/DEPS

Original comment by jefftk@google.com on 1 Feb 2013 at 6:02

GoogleCodeExporter commented 9 years ago
It compiles now:

    $ cd mod_pagespeed/src/build
    $ xcodebuild -verbose -project all.xcodeproj -configuration Debug -target pagespeed_automatic
    ...
    ** BUILD SUCCEEDED **

I can't build pagespeed_automatic.a, however, because that uses a Makefile and 
I was using command-line xcode.

Original comment by jefftk@google.com on 1 Feb 2013 at 6:42

GoogleCodeExporter commented 9 years ago
It also compiles with make:

    $ cd mod_pagespeed/src
    $ GYP_GENERATORS=make gclient runhooks
    $ make mod_pagespeed_test pagespeed_automatic_test

I can now start to build pagespeed_automatic.a, but not successfully:

    $ cd net/instaweb/automatic
    $ make all V=1
    ... lots of compiling ...
    rm -f out/Release/libinstaweb_console.a && ./gyp-mac-tool filter-libtool libtool  -static -o out/Release/libinstaweb_console.a 
    libtool: no files specified

Original comment by jefftk@google.com on 1 Feb 2013 at 7:17

GoogleCodeExporter commented 9 years ago
You can use net/instaweb/automatic/Makefile with xcode-built object files.  
That was my main flow for a while.

Original comment by jmara...@google.com on 1 Feb 2013 at 7:20

GoogleCodeExporter commented 9 years ago
The command:

    ./gyp-mac-tool filter-libtool libtool  -static -o out/Release/libinstaweb_console.a 

Is a functionally a simple wrapper around:

    libtool  -static -o out/Release/libinstaweb_console.a

Which is wrong because it's giving libtool an output library but no input 
object files.   Need to figure out why the makefile is doing that.

Original comment by jefftk@google.com on 1 Feb 2013 at 8:37

GoogleCodeExporter commented 9 years ago
The makefile is invoking libtool via:

    quiet_cmd_alink = LIBTOOL-STATIC $@
    cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)

The last bit, $(filter %.o,$^), means "of the prerequisites, only the .o 
files".  Apparently there aren't any?  Earlier libtool invocations 
(libinstaweb_rewriter.a, libinstaweb_automatic.a, ...) succeeded.

Original comment by jefftk@google.com on 1 Feb 2013 at 9:13

GoogleCodeExporter commented 9 years ago
Changing net/instaweb/instaweb.gyp to put the type of the instaweb_console as 
'none' let it get past that and build some .a files:

       'target_name': 'instaweb_console',
-      'type': '<(library)',
+      'type': 'none',
       'dependencies': [

Now it's stuck on:

    In file included from third_party/httpd24/src/include/httpd.h:44:
    third_party/httpd24/src/include/ap_config.h:138:10: fatal error: 'ap_config_auto.h' file not found
    #include "ap_config_auto.h"

Looking at our generated files, it looks we're not including it properly:

    $ find . | grep ap_config_auto.h$ | grep mac
    ./third_party/httpd/gen/arch/mac/ia32/include/ap_config_auto.h
    ./third_party/mod_spdy/src/third_party/apache/httpd/gen/arch/mac/ia32/include/ap_config_auto.h

And the command in question includes this directory:

    /Users/jefftk/mod_pagespeed/src/third_party/llvm-build/Release+Asserts/bin/clang++ '-DCHROMIUM_REVISION=161115' '-DCHROMIUM_BUILD' '-DUSE_LIBJPEG_TURBO=1' '-DENABLE_ONE_CLICK_SIGNIN' '-DENABLE_REMOTING=1' '-DENABLE_WEBRTC=1' '-DENABLE_CONFIGURATION_POLICY' '-DENABLE_INPUT_SPEECH' '-DENABLE_NOTIFICATIONS' '-DENABLE_HIDPI=1' '-DENABLE_GPU=1' '-DENABLE_EGLIMAGE=1' '-DUSE_SKIA=1' '-DENABLE_TASK_MANAGER=1' '-DENABLE_WEB_INTENTS=1' '-DENABLE_EXTENSIONS=1' '-DENABLE_PLUGIN_INSTALLATION=1' '-DENABLE_PROTECTOR_SERVICE=1' '-DENABLE_SESSION_SERVICE=1' '-DENABLE_THEMES=1' '-DENABLE_BACKGROUND=1' '-DENABLE_AUTOMATION=1' '-DENABLE_PRINTING=1' '-DENABLE_CAPTIVE_PORTAL_DETECTION=1' '-DHAVE_CONFIG_H' '-DDARWIN' '-DSIGPROCMASK_SETS_THREAD_MASK' '-DGOOGLE_PROTOBUF_NO_RTTI' '-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER' '-D__STDC_FORMAT_MACROS' '-DNDEBUG' '-DNVALGRIND' '-DDYNAMIC_ANNOTATIONS_ENABLED=0' -Ithird_party/chromium/src -Iout/Release/obj/gen/protoc_out/instaweb -I. -Ithird_party/re2/src -Ithird_party/httpd24/src/include -Ithird_party/httpd24/src/os/unix -Ithird_party/httpd24/gen/arch/mac/ia32/include -Ithird_party/apr/src/include -Ithird_party/apr/src/include/arch/unix -Ithird_party/apr/gen/arch/mac/ia32/include -Ithird_party/aprutil/src/include -Ithird_party/aprutil/gen/arch/mac/ia32/include -Ithird_party/protobuf -Ithird_party/protobuf/src -Ithird_party/gflags/gen/arch/mac/ia32/include -Ithird_party/gflags/src -Iout/Release/obj/gen  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -O3 -gdwarf-2 -fvisibility=hidden -Werror -Wnewline-eof -mmacosx-version-min=10.6 -arch i386 -Wall -Wendif-labels -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wheader-hygiene -Wno-char-subscripts -Wno-unused-function -Wno-unnamed-type-template-args -Wno-c++11-extensions -Wno-covered-switch-default -Wno-implicit-conversion-floating-point-to-bool -fvisibility-inlines-hidden -fno-threadsafe-statics -fno-strict-aliasing -funsigned-char -Wno-error -MMD -MF out/Release/.deps/out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_message_handler.o.d.raw  -c -o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_message_handler.o net/instaweb/apache/apache_message_handler.cc

Which doesn't have third_party/httpd/gen/arch/mac/ia32/include, only 
third_party/httpd24/gen/arch/mac/ia32/include

Original comment by jefftk@google.com on 1 Feb 2013 at 10:01

GoogleCodeExporter commented 9 years ago
That's correct because it's building 
out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_message_han
dler.o

What I think this means is that we need the Apache 2.4 genfiles on mac.
(Which is independent of this stuff, really).

Original comment by morlov...@google.com on 1 Feb 2013 at 10:04

GoogleCodeExporter commented 9 years ago
> we need the Apache 2.4 genfiles on mac

Yes, that's the issue:

$ cd ~/mod_pagespeed/src
$ find . | grep ap_config_auto.h$
./third_party/httpd/gen/arch/linux/ia32/include/ap_config_auto.h
./third_party/httpd/gen/arch/linux/x64/include/ap_config_auto.h
./third_party/httpd/gen/arch/mac/ia32/include/ap_config_auto.h
./third_party/httpd24/gen/arch/linux/ia32/include/ap_config_auto.h
./third_party/httpd24/gen/arch/linux/x64/include/ap_config_auto.h
./third_party/mod_spdy/src/third_party/apache/httpd/gen/arch/linux/ia32/include/
ap_config_auto.h
./third_party/mod_spdy/src/third_party/apache/httpd/gen/arch/linux/x64/include/a
p_config_auto.h
./third_party/mod_spdy/src/third_party/apache/httpd/gen/arch/mac/ia32/include/ap
_config_auto.h

Original comment by jefftk@google.com on 5 Feb 2013 at 6:04

GoogleCodeExporter commented 9 years ago
Where are genfiles configured?

Original comment by jefftk@google.com on 5 Feb 2013 at 6:09

GoogleCodeExporter commented 9 years ago
I've got the genfiles, and will be exporting them to svn soon.

With httpd24/gen/arch/linux/ia32/include/ap_config_auto.h and 
httpd24/gen/arch/linux/ia32/include/ap_config_layout.h manually provided I get 
linker errors:

$ cd mod_pagespeed/src/net/instaweb/automatic
$ make all V=1
cd /Users/jefftk/mod_pagespeed/src && make BUILDTYPE=Release
  LD_LIBRARY_PATH=/Users/jefftk/mod_pagespeed/src/out/Release/lib.host:/Users/jefftk/mod_pagespeed/src/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd build; mkdir -p /Users/jefftk/mod_pagespeed/src/out/Release/obj/gen/build; python util/lastchange.py -o "/Users/jefftk/mod_pagespeed/src/out/Release/obj/gen/build/LASTCHANGE" -d ../LASTCHANGE.in
  ./gyp-mac-tool flock /Users/jefftk/mod_pagespeed/src/out/Release/linker.lock /Users/jefftk/mod_pagespeed/src/third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-search_paths_first -Wl,-search_paths_first -Wl,-dead_strip -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -Lout/Release -install_name /usr/local/lib/mod_pagespeed_ap24.so  -o out/Release/mod_pagespeed_ap24.so out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_cache.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_config.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_message_handler.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_request_context.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_rewrite_driver_factory.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_server_context.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/apache_slurp.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/header_util.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/in_place_resource_recorder.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/instaweb_context.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/instaweb_handler.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/interface_mod_spdy.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/log_message_handler.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/mod_spdy_fetch_controller.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/mod_spdy_fetcher.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/apache/mod_instaweb.o out/Release/obj.target/mod_pagespeed_ap24/net/instaweb/util/mem_debug.o out/Release/libinstaweb_apr.a out/Release/libbase.a out/Release/libgflags.a out/Release/libbase_static.a out/Release/libmodp_b64.a out/Release/libdynamic_annotations.a out/Release/libserf.a out/Release/libzlib.a out/Release/libinstaweb_automatic.a out/Release/libinstaweb_blink_critical_line_data_pb.a out/Release/libprotobuf_lite.a out/Release/libinstaweb_critical_line_info_pb.a out/Release/libinstaweb_http.a out/Release/libhttp_core.a out/Release/libinstaweb_util_core.a out/Release/libinstaweb_http_pb.a out/Release/libpagespeed_core.a out/Release/libgoogleurl.a out/Release/libicuuc.a out/Release/libicudata.a out/Release/libpagespeed_output_pb.a out/Release/libpagespeed_resource_pb.a out/Release/libtimeline_pb.a out/Release/libdomain_registry_lib.a out/Release/libassert_lib.a out/Release/libinstaweb_htmlparse_core.a out/Release/libinstaweb_htmlparse_core_gperf.a out/Release/libinstaweb_flush_early_pb.a out/Release/libinstaweb_rewriter.a out/Release/libinstaweb_add_instrumentation_data2c.a out/Release/libinstaweb_add_instrumentation_opt_data2c.a out/Release/libinstaweb_client_domain_rewriter_data2c.a out/Release/libinstaweb_client_domain_rewriter_opt_data2c.a out/Release/libinstaweb_rewriter_html.a out/Release/libinstaweb_critical_images_beacon_data2c.a out/Release/libinstaweb_critical_images_beacon_opt_data2c.a out/Release/libinstaweb_defer_iframe_data2c.a out/Release/libinstaweb_defer_iframe_opt_data2c.a out/Release/libinstaweb_delay_images_data2c.a out/Release/libinstaweb_delay_images_opt_data2c.a out/Release/libinstaweb_delay_images_inline_data2c.a out/Release/libinstaweb_delay_images_inline_opt_data2c.a out/Release/libinstaweb_detect_reflow_data2c.a out/Release/libinstaweb_detect_reflow_opt_data2c.a out/Release/libinstaweb_deterministic_data2c.a out/Release/libinstaweb_deterministic_opt_data2c.a out/Release/libinstaweb_js_defer_data2c.a out/Release/libinstaweb_js_defer_opt_data2c.a out/Release/libinstaweb_lazyload_images_data2c.a out/Release/libinstaweb_lazyload_images_opt_data2c.a out/Release/libinstaweb_local_storage_cache_data2c.a out/Release/libinstaweb_local_storage_cache_opt_data2c.a out/Release/libinstaweb_rewriter_base.a out/Release/libinstaweb_util.a out/Release/libinstaweb_http_gperf.a out/Release/libinstaweb_clientstate_pb.a out/Release/libinstaweb_logging_pb.a out/Release/libinstaweb_propcache_pb.a out/Release/libbase64.a out/Release/libjsoncpp.a out/Release/libre2.a out/Release/libinstaweb_rewriter_html_gperf.a out/Release/libinstaweb_rewriter_html_option_gperf.a out/Release/libinstaweb_rewriter_pb.a out/Release/libinstaweb_spriter_pb.a out/Release/libinstaweb_rewriter_css.a out/Release/libinstaweb_spriter.a out/Release/libpng.a out/Release/libcss_parser.a out/Release/libutf.a out/Release/libinstaweb_rewriter_image.a out/Release/libpagespeed_image_converter.a out/Release/libpagespeed_jpeg_optimizer.a out/Release/libpagespeed_jpeg_reader.a out/Release/libjpeg.a out/Release/libpagespeed_png_optimizer.a out/Release/libpagespeed_scanline_utils.a out/Release/libdgiflib.a out/Release/libgiflib_core.a out/Release/libopngreduc.a out/Release/libpagespeed_webp_optimizer.a out/Release/libwebp_dec.a out/Release/libwebp_dsp.a out/Release/libwebp_enc.a out/Release/libwebp_utils.a out/Release/libpagespeed_jpeg_utils.a out/Release/libhighgui.a out/Release/libopencv_imgproc.a out/Release/libopencv_core.a out/Release/libinstaweb_rewriter_javascript.a out/Release/libpagespeed_jsminify.a out/Release/libinstaweb_htmlparse.a out/Release/libinstaweb_system.a out/Release/libinstaweb_util_pthread.a out/Release/libprocess_context.a out/Release/libinstaweb_console_css_data2c.a out/Release/libinstaweb_console_js_data2c.a out/Release/libinstaweb_console_body_data2c.a -framework AppKit -framework Carbon -framework CoreFoundation -framework Foundation -framework IOKit -framework Security
Undefined symbols for architecture i386:
  "_apr_psprintf", referenced from:
      _serf__ssltunnel_connect in libserf.a(ssltunnel.o)
  "_apr_socket_accept", referenced from:
      _serf__process_listener in libserf.a(incoming.o)
  "_apr_socket_opt_set", referenced from:
      _serf__open_connections in libserf.a(instaweb_outgoing.o)
...
  "_apr_pollset_add", referenced from:
      _mc_conn_construct in libinstaweb_apr.a(apr_memcache2.o)
      _apr_memcache2_multgetp in libinstaweb_apr.a(apr_memcache2.o)
      _pollset_add in libserf.a(context.o)
  "_apr_pool_create_ex", referenced from:
      __ZN12net_instaweb26ApacheRewriteDriverFactoryC2EP10server_recRKN4base16BasicStringPieceISsEE in apache_rewrite_driver_factory.o
      __ZN12net_instaweb11AprMemCache3GetERKSsPNS_14CacheInterface8CallbackE in libinstaweb_apr.a(apr_mem_cache.o)
      __ZN12net_instaweb11AprMemCache8MultiGetEPSt6vectorINS_14CacheInterface11KeyCallbackESaIS3_EE in libinstaweb_apr.a(apr_mem_cache.o)
      __ZN12net_instaweb11AprMemCache9GetStatusEPSs in libinstaweb_apr.a(apr_mem_cache.o)
      __ZN12net_instaweb9SerfFetch5StartEPNS_19SerfUrlAsyncFetcherE in libinstaweb_apr.a(serf_url_async_fetcher.o)
      __ZN12net_instaweb29AprCreateThreadCompatiblePoolEP10apr_pool_t in libinstaweb_apr.a(apr_thread_compatible_pool.o)
      _apr_memcache2_server_create in libinstaweb_apr.a(apr_memcache2.o)
      ...
ld: symbol(s) not found for architecture i386

Original comment by jefftk@google.com on 5 Feb 2013 at 10:06

GoogleCodeExporter commented 9 years ago
Those are the symbols we normally expect to pickup from Apache; no 
clue how to make that work with Mach-O...It might be worth building some 
non-mod_pagespeed module as a library to see how it deals with that
(perhaps just from the main Apache build, its configure flag takes a flag 
 on what to make dynamic; I think scripts/build_apache will do it w/mod_ssl)

Original comment by morlov...@google.com on 5 Feb 2013 at 10:14

GoogleCodeExporter commented 9 years ago
This error is building mod_pagespeed_ap24.so.  PSOL doesn't need that, so I'm 
going to see what it takes to skip building it on mac.

Original comment by jefftk@google.com on 5 Feb 2013 at 10:37

GoogleCodeExporter commented 9 years ago
Maybe "make instaweb_apr" will get most of the pieces, but you might need a few 
more.

Original comment by morlov...@google.com on 5 Feb 2013 at 10:42

GoogleCodeExporter commented 9 years ago
On Linux at least  instaweb_apr pagespeed_automatic gets you the .a, plus 
re2_bench_util is needed for test binaries.. 

Original comment by morlov...@google.com on 5 Feb 2013 at 11:22

GoogleCodeExporter commented 9 years ago
I need four static libraries:

   libapr.a
   libaprutil.a
   libserf.a
   pagespeed_automatic.a

I have the first three, but even with "make instaweb_apr pagespeed_automatic" I 
don't have pagespeed_automatic.a

Original comment by jefftk@google.com on 6 Feb 2013 at 12:36

GoogleCodeExporter commented 9 years ago
Hi all,
   Did anyone be able to get the mod_pagespeed_ap24.so compiled under mac osx?  I got stuck at the same ld symbol not found issue.  I have libapr.a libaprutil.a libserf.a under out/Release/.

I could get the mod_pagespeed_test and pagespeed_automatic_test compiled.

Original comment by patrickl...@gmail.com on 1 Aug 2013 at 11:16

GoogleCodeExporter commented 9 years ago
@patricklin88

I wasn't able to; I ran out of time on this and had to move to something else.  
I think someone else might have gotten it working via XCode?  Sorry!

Fixing mac support would be great, if you have some time to look into why this 
isn't working.

Original comment by jefftk@google.com on 2 Aug 2013 at 12:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
@jefftk

Thanks for your reply.  I tried the Xcode project to compile but got into the 
same issue.  I first need to remove the instaweb_console dependency and then it 
will continue and bust at the apache apr LD symbol issue.

There were a lot of mac support before and converted the mk files or created 
the xcodebuild project.  Hope someone could figure out what latest changes 
broke the mac build.

Original comment by patrickl...@gmail.com on 2 Aug 2013 at 4:37

GoogleCodeExporter commented 9 years ago

Original comment by jmara...@google.com on 12 Nov 2013 at 4:26

GoogleCodeExporter commented 9 years ago
FYI I've been messing around trying to get this all to work on my Mac.  The 
first question is which version of Xcode to use.  I'm having various failures 
of different sorts with Xcode 4.6 and Xcode 5.0.1. E.g.

I seem to have a repeated problem with both versions where the STL include 
'functional' gets included multiple times despite the seemingly correct use of 
an ifndef pattern to prevent that.  This results in multiply defined symbols.

Original comment by jmara...@gmail.com on 21 Nov 2013 at 6:41

GoogleCodeExporter commented 9 years ago
Issue 1056 has been merged into this issue.

Original comment by jmara...@google.com on 22 Mar 2015 at 6:08

jeffkaufman commented 9 years ago

Added to Accepted Feature Requests.