Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-4177

Failure building the Crowd Apache Connector from source on Amazon Linux

    • Icon: Bug Bug
    • Resolution: Tracked Elsewhere
    • Icon: Low Low
    • None
    • None
    • None
    • None
    • Amazon Linux AMI 2014.09.1 (HVM) - ami-4985b048

      I wanted to use the Crowd Apache Connector on Amazon EC2 instances with Amazon Linux. Atlassian does not provide the binary for the Amazon Linux, so I found I need to build it from the source. I tried the build procedure where I encountered some small problems. Here I want to share what I found, and how I could manage it.

      Given:
      Crowd Apache Connector version: http://downloads.atlassian.com/software/crowd/downloads/cwdapache/mod_authnz_crowd-2.2.2.tar.gz
      Amazon EC2 OS version: Amazon Linux AMI 2014.09.1 (HVM) - ami-4985b048

      I followed the instruction described in Installing the Crowd Apache Connector on other UNIX-Like Systems.

      1. I opened a terminal on the EC2 instance, change to a suitable working directory, and enter the following command:

      $ mkdir ~/cwdapache
      $ cd ~/cwdapache
      $ su -c "yum -y install autoconf automake gcc httpd-devel libcurl-devel libtool libxml2-devel mod_dav_svn subversion-devel"
      

      – Success with no problem.

      2. I entered the root password when prompted.
      – Success with no problem.

      3. I entered the following commands:

      $ wget http://downloads.atlassian.com/software/crowd/downloads/cwdapache/mod_authnz_crowd-2.2.2.tar.gz
      $ tar xzf mod_authnz_crowd-2.2.2.tar.gz
      $ cd mod_authnz_crowd-2.2.2
      

      – OK but ...

      $ autoreconf --install
      automake: warnings are treated as errors
      /usr/share/automake-1.13/am/ltlibrary.am: warning: 'mod_authnz_crowd.la': linking libtool libraries using a non-POSIX
      /usr/share/automake-1.13/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
      src/Makefile.am:3:   while processing Libtool library 'mod_authnz_crowd.la'
      src/Makefile.am:8: warning: 'CFLAGS' is a user variable, you should not override it;
      src/Makefile.am:8: use 'AM_CFLAGS' instead
      /usr/share/automake-1.13/am/ltlibrary.am: warning: 'mod_authz_svn_crowd.la': linking libtool libraries using a non-POSIX
      /usr/share/automake-1.13/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
      src/svn/Makefile.am:1:   while processing Libtool library 'mod_authz_svn_crowd.la'
      src/svn/Makefile.am:6: warning: 'CFLAGS' is a user variable, you should not override it;
      src/svn/Makefile.am:6: use 'AM_CFLAGS' instead
      autoreconf: automake failed with exit status: 1
      $ ./configure
      checking for a BSD-compatible install... /usr/bin/install -c
      checking whether build environment is sane... yes
      checking for a thread-safe mkdir -p... /bin/mkdir -p
      checking for gawk... gawk
      checking whether make sets $(MAKE)... yes
      checking whether make supports nested variables... yes
      checking for gcc... gcc
      checking whether the C compiler works... yes
      checking for C compiler default output file name... a.out
      checking for suffix of executables...
      checking whether we are cross compiling... no
      checking for suffix of object files... o
      checking whether we are using the GNU C compiler... yes
      checking whether gcc accepts -g... yes
      checking for gcc option to accept ISO C89... none needed
      checking for style of include used by make... GNU
      checking dependency style of gcc... gcc3
      checking build system type... x86_64-unknown-linux-gnu
      checking host system type... x86_64-unknown-linux-gnu
      checking how to print strings... printf
      checking for a sed that does not truncate output... /bin/sed
      checking for grep that handles long lines and -e... /bin/grep
      checking for egrep... /bin/grep -E
      checking for fgrep... /bin/grep -F
      checking for ld used by gcc... /usr/bin/ld
      checking if the linker (/usr/bin/ld) is GNU ld... yes
      checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
      checking the name lister (/usr/bin/nm -B) interface... BSD nm
      checking whether ln -s works... yes
      checking the maximum length of command line arguments... 1572864
      checking whether the shell understands some XSI constructs... yes
      checking whether the shell understands "+="... yes
      checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
      checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
      checking for /usr/bin/ld option to reload object files... -r
      checking for objdump... objdump
      checking how to recognize dependent libraries... pass_all
      checking for dlltool... no
      checking how to associate runtime and link libraries... printf %s\n
      checking for ar... ar
      checking for archiver @FILE support... @
      checking for strip... strip
      checking for ranlib... ranlib
       
      checking command to parse /usr/bin/nm -B output from gcc object... ok
      checking for sysroot... no
      checking for mt... no
      checking if : is a manifest tool... no
      checking how to run the C preprocessor... gcc -E
      checking for ANSI C header files... yes
      checking for sys/types.h... yes
      checking for sys/stat.h... yes
      checking for stdlib.h... yes
      checking for string.h... yes
      checking for memory.h... yes
      checking for strings.h... yes
      checking for inttypes.h... yes
      checking for stdint.h... yes
      checking for unistd.h... yes
      checking for dlfcn.h... yes
      checking for objdir... .libs
      checking if gcc supports -fno-rtti -fno-exceptions... no
      checking for gcc option to produce PIC... -fPIC -DPIC
      checking if gcc PIC flag -fPIC -DPIC works... yes
      checking if gcc static flag -static works... no
      checking if gcc supports -c -o file.o... yes
      checking if gcc supports -c -o file.o... (cached) yes
      checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
      checking whether -lc should be explicitly linked in... no
      checking dynamic linker characteristics... GNU/Linux ld.so
      checking how to hardcode library paths into programs... immediate
      checking whether stripping libraries is possible... yes
      checking if libtool supports shared libraries... yes
      checking whether to build shared libraries... yes
      checking whether to build static libraries... yes
      checking for apr_pool_pre_cleanup_register in -lapr-1... yes
      checking for curl_global_init in -lcurl... yes
      checking for xmlFree in -lxml2... yes
      checking for /usr/local/apache2/include/httpd.h... no
      checking for /usr/include/httpd/httpd.h... yes
      checking for httpd... /usr/sbin/httpd
      checking for /usr/local/include/subversion-1/svn_client.h... no
      checking for /usr/include/subversion-1/svn_client.h... yes
      checking for /usr/libexec/apache2/mod_dav.so... no
      checking for /usr/lib64/httpd/modules/mod_dav.so... yes
      checking for /usr/local/apache2/conf/httpd.conf... no
      checking for /etc/httpd/conf/httpd.conf... yes
      checking for /usr/local/apache2/bin/apxs... no
      checking for /usr/sbin/apxs... yes
      checking for /usr/local/apache2/bin/apachectl... no
      checking for /usr/sbin/apache2ctl... no
      checking for /usr/sbin/apachectl... yes
      checking that generated files are newer than configure... done
      configure: creating ./config.status
      config.status: creating Makefile
      config.status: creating src/Makefile
      config.status: creating src/svn/Makefile
      config.status: creating config.h
      config.status: executing depfiles commands
      config.status: executing libtool commands
      $ make
      (CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2/missing autoheader)
      rm -f stamp-h1
      touch config.h.in
      cd . && /bin/sh ./config.status config.h
      config.status: creating config.h
      config.status: config.h is unchanged
      make  all-recursive
      make[1]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2' に入ります
      Making all in src
      make[2]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2/src' に入ります
      make[3]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2' に入ります
      make[3]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2' から出ます
      Making all in svn
      make[3]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2/src/svn' に入ります
      make[4]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2' に入ります
      make[4]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2' から出ます
      /bin/sh ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../..  -I/usr/include/httpd `apr-1-config --cppflags --includes` -I/usr/include/subversion-1  `apr-1-config --cflags` -g -O2 -I/usr/include/libxml2 -MT mod_authz_svn_crowd.lo -MD -MP -MF .deps/mod_authz_svn_crowd.Tpo -c -o mod_authz_svn_crowd.lo mod_authz_svn_crowd.c
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/include/httpd -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1 -I/usr/include/subversion-1 -pthread -g -O2 -I/usr/include/libxml2 -MT mod_authz_svn_crowd.lo -MD -MP -MF .deps/mod_authz_svn_crowd.Tpo -c mod_authz_svn_crowd.c  -fPIC -DPIC -o .libs/mod_authz_svn_crowd.o
      mod_authz_svn_crowd.c: In function 'get_access_conf':
      mod_authz_svn_crowd.c:284:7: warning: 'svn_repos_authz_read' is deprecated (declared at /usr/include/subversion-1/svn_repos.h:320) [-Wdeprecated-declarations]
             svn_err = svn_repos_authz_read(&access_conf, access_file,
             ^
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/include/httpd -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1 -I/usr/include/subversion-1 -pthread -g -O2 -I/usr/include/libxml2 -MT mod_authz_svn_crowd.lo -MD -MP -MF .deps/mod_authz_svn_crowd.Tpo -c mod_authz_svn_crowd.c -o mod_authz_svn_crowd.o >/dev/null 2>&1
      mv -f .deps/mod_authz_svn_crowd.Tpo .deps/mod_authz_svn_crowd.Plo
      /bin/sh ../../libtool  --tag=CC   --mode=link gcc `apr-1-config --cflags` -g -O2 -I/usr/include/libxml2 -module  -o mod_authz_svn_crowd.la -rpath /usr/local/lib mod_authz_svn_crowd.lo  -lcurl -lapr-1  -lxml2 -lz -lm -ldl
      libtool: link: gcc -shared  -fPIC -DPIC  .libs/mod_authz_svn_crowd.o   -lcurl /usr/lib64/libapr-1.so -lpthread -lxml2 -lz -lm -ldl  -pthread -O2   -pthread -Wl,-soname -Wl,mod_authz_svn_crowd.so.0 -o .libs/mod_authz_svn_crowd.so.0.0.0
      libtool: link: (cd ".libs" && rm -f "mod_authz_svn_crowd.so.0" && ln -s "mod_authz_svn_crowd.so.0.0.0" "mod_authz_svn_crowd.so.0")
      libtool: link: (cd ".libs" && rm -f "mod_authz_svn_crowd.so" && ln -s "mod_authz_svn_crowd.so.0.0.0" "mod_authz_svn_crowd.so")
      libtool: link: ar cru .libs/mod_authz_svn_crowd.a  mod_authz_svn_crowd.o
      libtool: link: ranlib .libs/mod_authz_svn_crowd.a
      libtool: link: ( cd ".libs" && rm -f "mod_authz_svn_crowd.la" && ln -s "../mod_authz_svn_crowd.la" "mod_authz_svn_crowd.la" )
      make[3]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2/src/svn' から出ます
      make[3]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2/src' に入ります
      make[4]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2' に入ります
      make[4]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2' から出ます
      /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I/usr/include/httpd `apr-1-config --cppflags --includes` `xml2-config --cflags`  `apr-1-config --cflags` -g -O2 -I/usr/include/libxml2 -MT mod_authnz_crowd.lo -MD -MP -MF .deps/mod_authnz_crowd.Tpo -c -o mod_authnz_crowd.lo mod_authnz_crowd.c
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/httpd -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1 -I/usr/include/libxml2 -pthread -g -O2 -I/usr/include/libxml2 -MT mod_authnz_crowd.lo -MD -MP -MF .deps/mod_authnz_crowd.Tpo -c mod_authnz_crowd.c  -fPIC -DPIC -o .libs/mod_authnz_crowd.o
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/httpd -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1 -I/usr/include/libxml2 -pthread -g -O2 -I/usr/include/libxml2 -MT mod_authnz_crowd.lo -MD -MP -MF .deps/mod_authnz_crowd.Tpo -c mod_authnz_crowd.c -o mod_authnz_crowd.o >/dev/null 2>&1
      mv -f .deps/mod_authnz_crowd.Tpo .deps/mod_authnz_crowd.Plo
      /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I/usr/include/httpd `apr-1-config --cppflags --includes` `xml2-config --cflags`  `apr-1-config --cflags` -g -O2 -I/usr/include/libxml2 -MT crowd_client.lo -MD -MP -MF .deps/crowd_client.Tpo -c -o crowd_client.lo crowd_client.c
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/httpd -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1 -I/usr/include/libxml2 -pthread -g -O2 -I/usr/include/libxml2 -MT crowd_client.lo -MD -MP -MF .deps/crowd_client.Tpo -c crowd_client.c  -fPIC -DPIC -o .libs/crowd_client.o
      crowd_client.c: In function 'make_validate_session_url':
      crowd_client.c:848:5: warning: passing argument 1 of 'curl_free' discards 'const' qualifier from pointer target type [enabled by default]
           curl_free(escapedToken);
           ^
      In file included from crowd_client.c:13:0:
      /usr/include/curl/curl.h:1935:18: note: expected 'void *' but argument is of type 'const char *'
       CURL_EXTERN void curl_free(void *p);
                        ^
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/httpd -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1 -I/usr/include/libxml2 -pthread -g -O2 -I/usr/include/libxml2 -MT crowd_client.lo -MD -MP -MF .deps/crowd_client.Tpo -c crowd_client.c -o crowd_client.o >/dev/null 2>&1
      mv -f .deps/crowd_client.Tpo .deps/crowd_client.Plo
      /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I/usr/include/httpd `apr-1-config --cppflags --includes` `xml2-config --cflags`  `apr-1-config --cflags` -g -O2 -I/usr/include/libxml2 -MT cache.lo -MD -MP -MF .deps/cache.Tpo -c -o cache.lo cache.c
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/httpd -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1 -I/usr/include/libxml2 -pthread -g -O2 -I/usr/include/libxml2 -MT cache.lo -MD -MP -MF .deps/cache.Tpo -c cache.c  -fPIC -DPIC -o .libs/cache.o
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/httpd -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1 -I/usr/include/libxml2 -pthread -g -O2 -I/usr/include/libxml2 -MT cache.lo -MD -MP -MF .deps/cache.Tpo -c cache.c -o cache.o >/dev/null 2>&1
      mv -f .deps/cache.Tpo .deps/cache.Plo
      /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I/usr/include/httpd `apr-1-config --cppflags --includes` `xml2-config --cflags`  `apr-1-config --cflags` -g -O2 -I/usr/include/libxml2 -MT util.lo -MD -MP -MF .deps/util.Tpo -c -o util.lo util.c
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/httpd -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1 -I/usr/include/libxml2 -pthread -g -O2 -I/usr/include/libxml2 -MT util.lo -MD -MP -MF .deps/util.Tpo -c util.c  -fPIC -DPIC -o .libs/util.o
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/httpd -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1 -I/usr/include/libxml2 -pthread -g -O2 -I/usr/include/libxml2 -MT util.lo -MD -MP -MF .deps/util.Tpo -c util.c -o util.o >/dev/null 2>&1
      mv -f .deps/util.Tpo .deps/util.Plo
      /bin/sh ../libtool  --tag=CC   --mode=link gcc `apr-1-config --cflags` -g -O2 -I/usr/include/libxml2 -module -lcurl `xml2-config --libs`  -o mod_authnz_crowd.la -rpath /usr/local/lib mod_authnz_crowd.lo crowd_client.lo cache.lo util.lo  -lcurl -lapr-1  -lxml2 -lz -lm -ldl
      libtool: link: gcc -shared  -fPIC -DPIC  .libs/mod_authnz_crowd.o .libs/crowd_client.o .libs/cache.o .libs/util.o   -lcurl /usr/lib64/libapr-1.so -lpthread -lxml2 -lz -lm -ldl  -pthread -O2   -pthread -Wl,-soname -Wl,mod_authnz_crowd.so.0 -o .libs/mod_authnz_crowd.so.0.0.0
      libtool: link: (cd ".libs" && rm -f "mod_authnz_crowd.so.0" && ln -s "mod_authnz_crowd.so.0.0.0" "mod_authnz_crowd.so.0")
      libtool: link: (cd ".libs" && rm -f "mod_authnz_crowd.so" && ln -s "mod_authnz_crowd.so.0.0.0" "mod_authnz_crowd.so")
      libtool: link: ar cru .libs/mod_authnz_crowd.a  mod_authnz_crowd.o crowd_client.o cache.o util.o
      libtool: link: ranlib .libs/mod_authnz_crowd.a
      libtool: link: ( cd ".libs" && rm -f "mod_authnz_crowd.la" && ln -s "../mod_authnz_crowd.la" "mod_authnz_crowd.la" )
      make[3]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2/src' から出ます
      make[2]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2/src' から出ます
      make[2]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2' に入ります
      make[2]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2' から出ます
      make[1]: ディレクトリ `/home/ec2-user/cwdapache/mod_authnz_crowd-2.2.2' から出ます 
      

      – Failure.

      I amended 3 files input to the autotools:

      1. mod_authnz_crowd-2.2.2/configure.ac
      At 3rd line, I inserted following 2 lines:

      m4_pattern_allow([AM_PROG_AR])
      AM_PROG_AR
      

      By this change the file looked like this:

      AC_INIT([mod_authnz_crowd], m4_esyscmd([./version-gen]), [support@atlassian.com])
      AM_INIT_AUTOMAKE([-Wall -Werror foreign])
       
      m4_pattern_allow([AM_PROG_AR])
      AM_PROG_AR
       
      AC_PROG_CC
      AC_PROG_LIBTOOL
      AC_CONFIG_HEADERS([config.h])
      AC_CONFIG_FILES([
          Makefile
          src/Makefile
          src/svn/Makefile
      ])
      AC_CONFIG_MACRO_DIR([m4])
      ...
      

      2. mod_authnz_crowd-2.2.2/src/Makefile.am

      I commented out a line where the CFLAGS variable appeared.

      By this change the file looked like this:

      AUTOMAKE_OPTIONS = -Wno-override
      SUBDIRS = svn
      lib_LTLIBRARIES = mod_authnz_crowd.la
      mod_authnz_crowd_la_SOURCES = mod_authnz_crowd.c mod_authnz_crowd.h crowd_client.c crowd_client.h cache.c cache.h util.c util.h
      mod_authnz_crowd_la_LDFLAGS = -module -lcurl `xml2-config --libs`
      AM_CFLAGS = `apr-1-config --cflags`
      AM_CPPFLAGS = -I@APACHE_INCLUDE_DIR@ `apr-1-config --cppflags --includes` `xml2-config --cflags`
      #CFLAGS=-g -Wmissing-prototypes -O1   # -O2 causes mysterious crashes
      TESTS = test.py
      ...
      

      3. mod_authnz_crowd-2.2.2/src/svn/Makefile.am

      Again I commented out a line where the CFLAGS variable appeared.

      By this change the file looked like this:

      lib_LTLIBRARIES = mod_authz_svn_crowd.la
      mod_authz_svn_crowd_la_SOURCES = mod_authz_svn_crowd.c
      mod_authz_svn_crowd_la_LDFLAGS = -module
      AM_CFLAGS = `apr-1-config --cflags`
      AM_CPPFLAGS = -I@APACHE_INCLUDE_DIR@ `apr-1-config --cppflags --includes` -I@SVN_DIR@/include/subversion-1
      #CFLAGS=-g -O1   # -O2 causes mysterious crashes
      

      With these amendments, I tried to build the module again:

      autoreconf --install
      ./configure
      make
      su -c "make install"
      

      Success with no error messages.

      I am not sure if the amendments I made is harmfull or not. I hope Atlassian to have a look at this.

            [CWD-4177] Failure building the Crowd Apache Connector from source on Amazon Linux

            kazuakim added a comment -

            kazuakim added a comment - I refiled this to https://ecosystem.atlassian.net/browse/CWDAPACHE-60

            joe added a comment -

            Thanks for this. Issues for the Crowd Apache connector are tracked in the CWDAPACHE project, so I'm going to resolve this. Please re-file there, or against https://bitbucket.org/atlassian/cwdapache.

            joe added a comment - Thanks for this. Issues for the Crowd Apache connector are tracked in the CWDAPACHE project, so I'm going to resolve this. Please re-file there, or against https://bitbucket.org/atlassian/cwdapache .

              Unassigned Unassigned
              fa7e5f740bb3 kazuakim
              Affected customers:
              0 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: