Jump to content

[9219][patch] Allow configure to find OpenSSL if pkg-config fails


Auntie Mangos

Recommended Posts

  • Replies 56
  • Created
  • Last Reply

Top Posters In This Topic

I use linux ubuntu and for OpenSSL i use the same and before this comit all where ok ...

Now not :(

I understand that, but I still need the information I asked for if I'm going to try to help. What version of Ubuntu? What version of OpenSSL? How did you install OpenSSL (compiled from source, using apt-get, etc.)? Do you have libssl-dev installed?

Link to comment
Share on other sites

I understand that, but I still need the information I asked for if I'm going to try to help.

Thanks :)

What version of Ubuntu?

Ubuntu server updated at latest version

What version of OpenSSL?

How check this ?

How did you install OpenSSL (compiled from source, using apt-get, etc.)?

I have use apt-get ;)

Do you have libssl-dev installed?

Yes

Link to comment
Share on other sites

Is this patch help?

diff --git a/m4/ax_check_openssl.m4 b/m4/ax_check_openssl.m4
index 7f5c319..cf5bfff 100644
--- a/m4/ax_check_openssl.m4
+++ b/m4/ax_check_openssl.m4
@@ -31,6 +31,10 @@
#   permitted in any medium without royalty provided the copyright notice
#   and this notice are preserved. This file is offered as-is, without any
#   warranty.
+#
+# MaNGOS local changes: OPENSSL_INCLUDES replaced by OPENSSL_CPPFLAGS for better
+# compatibility with PKG_CONFIG way work
+#

AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
AC_DEFUN([AX_CHECK_OPENSSL], [
@@ -54,7 +58,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
                if test $? = 0; then
                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
-                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
+                    OPENSSL_CPPFLAGS=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
                    found=true
                fi
            fi
@@ -71,11 +75,11 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
    # an 'openssl' subdirectory

    if ! $found; then
-        OPENSSL_INCLUDES=
+        OPENSSL_CPPFLAGS=
        for ssldir in $ssldirs; do
            AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
            if test -f "$ssldir/include/openssl/ssl.h"; then
-                OPENSSL_INCLUDES="-I$ssldir/include"
+                OPENSSL_CPPFLAGS="-I$ssldir/include"
                OPENSSL_LDFLAGS="-L $ssldir/lib"
                OPENSSL_LIBS="-lssl -lcrypto"
                found=true
@@ -95,14 +99,14 @@ AC_DEFUN([AX_CHECK_OPENSSL], [

    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \\
-        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
+        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_CPPFLAGS=$OPENSSL_CPPFLAGS" >&AS_MESSAGE_LOG_FD

    save_LIBS="$LIBS"
    save_LDFLAGS="$LDFLAGS"
    save_CPPFLAGS="$CPPFLAGS"
    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
    LIBS="$OPENSSL_LIBS $LIBS"
-    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+    CPPFLAGS="$OPENSSL_CPPFLAGS $CPPFLAGS"
    AC_LINK_IFELSE(
        AC_LANG_PROGRAM([#include <openssl/ssl.h>], [sSL_new(NULL)]),
        [
@@ -116,7 +120,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
    LDFLAGS="$save_LDFLAGS"
    LIBS="$save_LIBS"

-    AC_SUBST([OPENSSL_INCLUDES])
+    AC_SUBST([OPENSSL_CPPFLAGS])
    AC_SUBST([OPENSSL_LIBS])
    AC_SUBST([OPENSSL_LDFLAGS])
])

Can someone with problems build mangos after SSL detection chnages check this?

Link to comment
Share on other sites

Is this patch help?

diff --git a/m4/ax_check_openssl.m4 b/m4/ax_check_openssl.m4
index 7f5c319..cf5bfff 100644
--- a/m4/ax_check_openssl.m4
+++ b/m4/ax_check_openssl.m4
@@ -31,6 +31,10 @@
#   permitted in any medium without royalty provided the copyright notice
#   and this notice are preserved. This file is offered as-is, without any
#   warranty.
+#
+# MaNGOS local changes: OPENSSL_INCLUDES replaced by OPENSSL_CPPFLAGS for better
+# compatibility with PKG_CONFIG way work
+#

AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
AC_DEFUN([AX_CHECK_OPENSSL], [
@@ -54,7 +58,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
                if test $? = 0; then
                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
-                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
+                    OPENSSL_CPPFLAGS=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
                    found=true
                fi
            fi
@@ -71,11 +75,11 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
    # an 'openssl' subdirectory

    if ! $found; then
-        OPENSSL_INCLUDES=
+        OPENSSL_CPPFLAGS=
        for ssldir in $ssldirs; do
            AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
            if test -f "$ssldir/include/openssl/ssl.h"; then
-                OPENSSL_INCLUDES="-I$ssldir/include"
+                OPENSSL_CPPFLAGS="-I$ssldir/include"
                OPENSSL_LDFLAGS="-L $ssldir/lib"
                OPENSSL_LIBS="-lssl -lcrypto"
                found=true
@@ -95,14 +99,14 @@ AC_DEFUN([AX_CHECK_OPENSSL], [

    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \\
-        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
+        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_CPPFLAGS=$OPENSSL_CPPFLAGS" >&AS_MESSAGE_LOG_FD

    save_LIBS="$LIBS"
    save_LDFLAGS="$LDFLAGS"
    save_CPPFLAGS="$CPPFLAGS"
    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
    LIBS="$OPENSSL_LIBS $LIBS"
-    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+    CPPFLAGS="$OPENSSL_CPPFLAGS $CPPFLAGS"
    AC_LINK_IFELSE(
        AC_LANG_PROGRAM([#include <openssl/ssl.h>], [sSL_new(NULL)]),
        [
@@ -116,7 +120,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
    LDFLAGS="$save_LDFLAGS"
    LIBS="$save_LIBS"

-    AC_SUBST([OPENSSL_INCLUDES])
+    AC_SUBST([OPENSSL_CPPFLAGS])
    AC_SUBST([OPENSSL_LIBS])
    AC_SUBST([OPENSSL_LDFLAGS])
])

Can someone with problems build mangos after SSL detection chnages check this?

It seems to be working , styl "making"

Link to comment
Share on other sites

Is this patch help?

Can someone with problems build mangos after SSL detection chnages check this?

I was looking at this more over the weekend and came up with something similar. But why did you change OPENSSL_INCLUDES to OPENSSL_CPPFLAGS? I was going to change it to OPENSSL_CFLAGS as that is what it looked like was being set previously. My alternate patch also changes the pkg-config commands a little bit, and adds an error message if the OpenSSL check fails (which should have been there all along, but I was hurrying to try to fix people's issues).

diff --git a/configure.ac b/configure.ac
index 57cf30e..cdc3ce1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,7 +97,7 @@ AC_CHECK_LIB( pthread, pthread_create, [],
    ])
AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] )
AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] )
-AX_CHECK_OPENSSL()
+AX_CHECK_OPENSSL([], [AC_MSG_ERROR([Missing OpenSSL])])

AC_ARG_WITH(postgresql,
[  --with-postgresql       Use PostgreSQL as a backend (default: no)],
diff --git a/m4/ax_check_openssl.m4 b/m4/ax_check_openssl.m4
index 7f5c319..3b5ed9c 100644
--- a/m4/ax_check_openssl.m4
+++ b/m4/ax_check_openssl.m4
@@ -31,6 +31,9 @@
#   permitted in any medium without royalty provided the copyright notice
#   and this notice are preserved. This file is offered as-is, without any
#   warranty.
+#
+# MaNGOS local changes: OPENSSL_INCLUDES replaced by OPENSSL_CFLAGS for
+# better compatibility with the way PKG_CONFIG previously worked.

AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
AC_DEFUN([AX_CHECK_OPENSSL], [
@@ -53,8 +56,8 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
            if test x"$PKG_CONFIG" != x""; then
                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
                if test $? = 0; then
-                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
-                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
+                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs 2>/dev/null`
+                    OPENSSL_CFLAGS=`$PKG_CONFIG openssl --cflags 2>/dev/null`
                    found=true
                fi
            fi
@@ -71,11 +74,11 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
    # an 'openssl' subdirectory

    if ! $found; then
-        OPENSSL_INCLUDES=
+        OPENSSL_CFLAGS=
        for ssldir in $ssldirs; do
            AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
            if test -f "$ssldir/include/openssl/ssl.h"; then
-                OPENSSL_INCLUDES="-I$ssldir/include"
+                OPENSSL_CFLAGS="-I$ssldir/include"
                OPENSSL_LDFLAGS="-L $ssldir/lib"
                OPENSSL_LIBS="-lssl -lcrypto"
                found=true
@@ -95,14 +98,14 @@ AC_DEFUN([AX_CHECK_OPENSSL], [

    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \\
-        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
+        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_CFLAGS=$OPENSSL_CFLAGS" >&AS_MESSAGE_LOG_FD

    save_LIBS="$LIBS"
    save_LDFLAGS="$LDFLAGS"
    save_CPPFLAGS="$CPPFLAGS"
    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
    LIBS="$OPENSSL_LIBS $LIBS"
-    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+    CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
    AC_LINK_IFELSE(
        AC_LANG_PROGRAM([#include <openssl/ssl.h>], [sSL_new(NULL)]),
        [
@@ -116,7 +119,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
    LDFLAGS="$save_LDFLAGS"
    LIBS="$save_LIBS"

-    AC_SUBST([OPENSSL_INCLUDES])
+    AC_SUBST([OPENSSL_CFLAGS])
    AC_SUBST([OPENSSL_LIBS])
    AC_SUBST([OPENSSL_LDFLAGS])
])

I'm testing this as I post this on Ubuntu Server 8.04.3, but since I didn't have problems before, it won't really mean much unless some other folks out there test it.

Link to comment
Share on other sites

I applied you patch and i'm now trying to autoreconf but it doesn't seems to work...

I get another error at the autoconf step :

configure.ac:35: error: possibly undefined macro: AC_MSG_ERROR
     If this token and others are legitimate, please use m4_pattern_allow.
     See the Autoconf documentation.

Configure.ac file, line 35:

AC_MSG_ERROR(
    [
     Please configure and build in a directory other than the
     top-level source directory. This is needed because a lot
     of maintainers tend to break parallel build trees
     (a.k.a. VPATH builds). This is kinda real ensurance they
     will not do it (by enforcing everybody to do VPATH builds).

     For example, try the following from the top-level source
     directory:

         mkdir objdir
         cd objdir
         ../configure
         make

     This will create a build space in the directory 'objdir' and
     start a build in that directory.

     If however you realy want to disable this error,
     use --enable-maintainer-mode switch.
    ])

I already had this error, first time i compiled mangos. I had just to install pkg-info package to resolve it by the way... but now that i've the latest pkg-config i got this error once again :/

EDIT:

If i try to configure in the ../objdir directory, i get another error :

appending configuration tag "F77" to libtool
checking for a BSD-compatible install... /usr/bin/install -c
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for pthread_create in -lpthread... yes
checking for compress in -lz... yes
checking for ftime in -lcompat... no
../configure: line 20610: syntax error near unexpected token `,'
../configure: line 20610: `AX_CHECK_OPENSSL(, AC_MSG_ERROR([Missing OpenSSL]))'

Link to comment
Share on other sites

Base at previous provided configure.status i see that you not use --with-openssl option and configure can't find openssl, that is source of you specific case.

Also maybe you not run autoreconf after provided patch apply...

I always do-> svn , patch , configure , make,

is there anything wrong with this ? it has worked before 3.3.0a,

config.log

http://srot.jeremy.sk/samir/config.log

Link to comment
Share on other sites

@Snake_Plissken:

It looks like maybe the patch didn't apply cleanly.

@Samuell.Sk:

There's no indication at all that OpenSSL was even looked for in that log, I'd expect to at least see an attempt and a failure with the OpenSSL check. Also make sure the patch is applying cleanly for you.

@ALL:

When testing this stuff it is best to start with a clean clone of the repository and do everything from scratch, the idea being to eliminate as many variables as possible. I've tested this stuff on Ubuntu Desktop 9.10, Ubunter Server 8.04.3, Debian 5.03, and OpenBSD-current (all i386, 32-bit) and the only time I've been able to reproduce the compile errors is when I remove the libssl-dev package. I'm having a hell of a time figuring out what is different on the systems people are having issues on. This is frustrating for me too, my whole goal with this was to get MaNGOS compiling on more systems.

I appreciate all of your feedback :).

Link to comment
Share on other sites

Are there linux distros that don't have pkg-config available ?

I don't know about Linux distros, but pkg-config doesn't work on OpenBSD (and I think FreeBSD too).

And can't we just check for SSL headers in a few predefined locations ?

That's exactly what this stuff is trying to do if pkg-config is either unavailable or doesn't give us what we need.

Link to comment
Share on other sites

YES! In like configure affected changes this meaning you NOT use patch. For sure you need do: autoreconf --install --force before configure for recreate configure with changes

oh, now i remember :D i have a patch folder, i was applying this manual without autoreconf :D :D ok, my bad, sry, i wasn't helpful, testing newest rev now.

edit:

no still the same,

....

.....

Sha1.cpp:60: undefined reference to `SHA1_Init'

../shared/Auth/libmangosauth.a(Sha1.o): In function `~Sha1Hash':

/home/sam43ll/MaNGOS/sources/objdir/src/shared/Auth/../../../../src/shared/Auth/Sha1.cpp:30: undefined reference to `SHA1_Init'

/home/sam43ll/MaNGOS/sources/objdir/src/shared/Auth/../../../../src/shared/Auth/Sha1.cpp:30: undefined reference to `SHA1_Init'

../shared/Auth/libmangosauth.a(Sha1.o): In function `Sha1Hash':

/home/sam43ll/MaNGOS/sources/objdir/src/shared/Auth/../../../../src/shared/Auth/Sha1.cpp:25: undefined reference to `SHA1_Init'

/home/sam43ll/MaNGOS/sources/objdir/src/shared/Auth/../../../../src/shared/Auth/Sha1.cpp:25: undefined reference to `SHA1_Init'

../shared/Auth/libmangosauth.a(Sha1.o): In function `Sha1Hash::UpdateData(unsigned char const*, int)':

/home/sam43ll/MaNGOS/sources/objdir/src/shared/Auth/../../../../src/shared/Auth/Sha1.cpp:35: undefined reference to `SHA1_Update'

collect2: ld returned 1 exit status

make[3]: *** [mangos-realmd] Error 1

make[3]: Leaving directory `/home/sam43ll/MaNGOS/sources/objdir/src/realmd'

make[2]: *** [all-recursive] Error 1

make[2]: Leaving directory `/home/sam43ll/MaNGOS/sources/objdir/src'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/home/sam43ll/MaNGOS/sources/objdir'

make: *** [all] Error 2

new config.status

http://srot.jeremy.sk/samir/config/status

edit button finaly works : )

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use