# Mod_pagespeed in FreeBSD



## pralive (Oct 19, 2014)

Hi,

I am trying to install the pagespeed module for Nginx on  FreeBSD 9.2  but it keeps giving me errors. Can someone help? Here is the error.

I have gone through below reference URLs already but found nothing helpful. Please help.

https://github.com/pagespeed/ngx_pagespeed/issues/308
https://github.com/pagespeed/ngx_pagespeed/wiki/Building-PSOL-From-Source
https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source


```
configuring additional modules
adding module in /usr/local/src/ngx_pagespeed-release-1.9.32.1-beta
mod_pagespeed_dir=/usr/local/src/ngx_pagespeed-release-1.9.32.1-beta/src
build_from_source=true
checking for psol ... not found
./configure: error: module ngx_pagespeed requires the pagespeed optimization library.
Look in obj/autoconf.err for more details.


from autoconf.err


checking for psol

cc: /usr/local/src/ngx_pagespeed-release-1.9.32.1-beta/src/net/instaweb/automatic/pagespeed_automatic.a: No such file or directory
objs/autotest.cc:5:42: error: pagespeed/kernel/base/string.h: No such file or directory
objs/autotest.cc:6:49: error: pagespeed/kernel/base/string_writer.h: No such file or directory
objs/autotest.cc:7:56: error: pagespeed/kernel/base/null_message_handler.h: No such file or directory
objs/autotest.cc:8:46: error: pagespeed/kernel/html/html_parse.h: No such file or directory
objs/autotest.cc:9:54: error: pagespeed/kernel/html/html_writer_filter.h: No such file or directory
objs/autotest.cc: In function 'int main()':
objs/autotest.cc:14: error: 'GoogleString' was not declared in this scope
objs/autotest.cc:14: error: expected `;' before 'output_buffer'
objs/autotest.cc:15: error: 'net_instaweb' has not been declared
objs/autotest.cc:15: error: expected `;' before 'write_to_string'
objs/autotest.cc:17: error: 'net_instaweb' has not been declared
objs/autotest.cc:17: error: expected `;' before 'handler'
objs/autotest.cc:18: error: 'net_instaweb' has not been declared
objs/autotest.cc:18: error: expected `;' before 'html_parse'
objs/autotest.cc:19: error: 'net_instaweb' has not been declared
objs/autotest.cc:19: error: expected `;' before 'html_writer_filter'
objs/autotest.cc:21: error: 'html_writer_filter' was not declared in this scope
objs/autotest.cc:21: error: 'write_to_string' was not declared in this scope
objs/autotest.cc:22: error: 'html_parse' was not declared in this scope
objs/autotest.cc:29: error: 'output_buffer' was not declared in this scope
objs/autotest.cc:29: error: 'printf' was not declared in this scope
```


----------



## pralive (Oct 19, 2014)

I tried to build mod_pagespeed separately  and got this. Can anyone suggest a solution?


```
CXX(target) out/Release/obj.target/pagespeed_output_pb/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.o
In file included from out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:4:
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2404: error: expected unqualified-id before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2404: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2404: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2411: error: expected unqualified-id before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2411: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2411: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:5005: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:5027: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc: In member function 'virtual void pagespeed::Version::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const':
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6112: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6112: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6112: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6117: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6117: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6117: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc: In member function 'virtual int pagespeed::Version::ByteSize() const':
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6135: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6135: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6135: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6142: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6142: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6142: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc: In member function 'void pagespeed::Version::MergeFrom(const pagespeed::Version&)':
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6166: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6166: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6166: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6169: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6169: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6169: error: expected `)' before 'int'
gmake: *** [out/Release/obj.target/pagespeed_output_pb/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.o] Error 1
```


----------



## ironudjin (Oct 21, 2014)

pralive said:


> checking for psol ... not found
> ./configure: error: module ngx_pagespeed requires the pagespeed optimization library.


It seems you didn't install psol before compiling mod_pagespeed. Read the documentation you've posted above.


----------



## cinto (Oct 22, 2014)

Here is the error while building PSOL:

```
# gmake AR.host="$PWD/build/wrappers/
ar.sh" AR.target="$PWD/build/wrappers/ar.sh" BUILDTYPE=Release mod_pagespeed_test pagespeed_automatic_test
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/stubs/strutil.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/stubs/substitute.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/stubs/structurally_valid.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/descriptor.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/descriptor.pb.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/descriptor_database.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/dynamic_message.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/extension_set_heavy.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/generated_message_reflection.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/message.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/reflection_ops.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/service.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/text_format.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/wire_format.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/io/printer.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/io/tokenizer.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/compiler/importer.o
  CXX(host) out/Release/obj.host/protobuf_full_do_not_use/third_party/protobuf/src/google/protobuf/compiler/parser.o
  AR(host) out/Release/obj.host/third_party/protobuf/libprotobuf_full_do_not_use.a
  CXX(host) out/Release/obj.host/protobuf_lite/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.o
  AR(host) out/Release/obj.host/third_party/protobuf/libprotobuf_lite.a
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/code_generator.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_enum.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_extension.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_field.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_file.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_generator.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_message.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_message_field.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_primitive_field.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_service.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/java/java_string_field.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/python/python_generator.o
  CXX(host) out/Release/obj.host/protoc/third_party/protobuf/src/google/protobuf/compiler/main.o
  LINK(host) out/Release/protoc
  RULE _usr_home_masadmin_mod_pagespeed_src_net_instaweb_instaweb_gyp_instaweb_http_pb_target_genproto_0 out/Release/obj/gen/protoc_out/instaweb/net/instaweb/http/http.pb.h
  CXX(target) out/Release/obj.target/instaweb_http_pb/gen/protoc_out/instaweb/net/instaweb/http/http.pb.o
  AR(target) out/Release/obj.target/net/instaweb/libinstaweb_http_pb.a
  CXX(target) out/Release/obj.target/protobuf_lite/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.o
  CXX(target) out/Release/obj.target/protobuf_lite/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.o
  CXX(target) out/Release/obj.target/protobuf_lite/third_party/protobuf/src/google/protobuf/unknown_field_set.o
  CXX(target) out/Release/obj.target/protobuf_lite/third_party/protobuf/src/google/protobuf/stubs/common.o
  CXX(target) out/Release/obj.target/protobuf_lite/third_party/protobuf/src/google/protobuf/stubs/once.o
  CXX(target) out/Release/obj.target/protobuf_lite/third_party/protobuf/src/google/protobuf/extension_set.o
  CXX(target) out/Release/obj.target/protobuf_lite/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.o
  AR(target) out/Release/obj.target/third_party/protobuf/libprotobuf_lite.a
  RULE _usr_home_masadmin_mod_pagespeed_src_third_party_libpagespeed_src_pagespeed_proto_proto_gen_gyp_pagespeed_genproto_target_genproto_1 out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h
  RULE _usr_home_masadmin_mod_pagespeed_src_third_party_libpagespeed_src_pagespeed_proto_proto_gen_gyp_pagespeed_genproto_target_genproto_0 out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_input.pb.h
  RULE _usr_home_masadmin_mod_pagespeed_src_third_party_libpagespeed_src_pagespeed_proto_proto_gen_gyp_pagespeed_genproto_target_genproto_2 out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_proto_formatter.pb.h
  RULE _usr_home_masadmin_mod_pagespeed_src_third_party_libpagespeed_src_pagespeed_proto_proto_gen_gyp_pagespeed_genproto_target_genproto_3 out/Release/obj/gen/protoc_out/pagespeed/proto/resource.pb.h
  RULE _usr_home_masadmin_mod_pagespeed_src_third_party_libpagespeed_src_pagespeed_proto_proto_gen_gyp_pagespeed_genproto_target_genproto_4 out/Release/obj/gen/protoc_out/pagespeed/proto/timeline.pb.h
  TOUCH out/Release/obj.target/third_party/libpagespeed/src/pagespeed/proto/pagespeed_genproto.stamp
  CXX(target) out/Release/obj.target/pagespeed_output_pb/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.o
In file included from out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:4:
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2404: error: expected unqualified-id before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2404: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2404: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2411: error: expected unqualified-id before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2411: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:2411: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:5005: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.h:5027: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc: In member function 'virtual void pagespeed::Version::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const':
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6112: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6112: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6112: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6117: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6117: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6117: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc: In member function 'virtual int pagespeed::Version::ByteSize() const':
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6135: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6135: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6135: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6142: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6142: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6142: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc: In member function 'void pagespeed::Version::MergeFrom(const pagespeed::Version&)':
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6166: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6166: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6166: error: expected `)' before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6169: error: expected unqualified-id before '(' token
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6169: error: expected primary-expression before 'int'
out/Release/obj/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.cc:6169: error: expected `)' before 'int'
gmake: *** [out/Release/obj.target/
pagespeed_output_pb/gen/protoc_out/pagespeed/proto/pagespeed_output.pb.o] Error 1
```


----------



## ironudjin (Oct 23, 2014)

cinto said:


> Here is the error while building PSOL


Try using lang/gcc as a compiler. Maybe it helps somehow.


----------



## Chris_H (Nov 4, 2014)

Without having actually examined the source(s), it appear to me that there's an unbalanced quote somewhere. This can sometimes also occur using a different shell than the one intended, even when the quotes are all balanced.

--Chris


----------

