[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Undefined symbol "zx_attr2tok" when compiling mod_auth_saml.so with FreeBSD 10.2



Hello,

FreeBSD has moved on to using clang instead of gcc at it's version 10. A port of ZXID is available without the module to Apache httpd, mod_auth_saml.so .

After compiling the module and trying to start httpd, an error appears:

httpd: Syntax error on line 73 of /usr/local/etc/apache24/httpd.conf: Cannot load 
libexec/apache24/mod_auth_saml.so into server:
/usr/local/libexec/apache24/mod_auth_saml.so: Undefined symbol "zx_attr2tok"


After searching with nm and from files was found that "zx_attr2tok" is defined in "./c/zx-data.h", implemented in "./c/zx-attrs.c" and used in "./zxlibdec.c". I tried to add a line to 
zx-attrs.c as follows:

$ diff c/zx-attrs.c ../../zxid-1.22/c/zx-attrs.c
37a38
> #include "c/zx-data.h"
976,977c977,978
< struct zx_at_tok *
< zx_attr2tok (str, len)
---
> 
> struct zx_at_tok * zx_attr2tok (str, len)


And after adding, the module loaded correctly to httpd.

Question: Should this include be added to the zx-attrs.c permanently ?

Another problem is using the --export-all-symbols. It does not exist in gcc or in clang.


I havent yet tried to use the module. Just as soon I still remember these commands and header files, I just send the email. Apache 2.4 maby can be used, am I correct? It would be nice if after TAS3 project, the ZXID would still be maintained. Is it possible to make a prognosis about it?


The environment description follows. If includes are difficult with swig for example, Linux and FreeBSD have defines like the following to recognize the operating system. I haven't read enough about the package to recommend these.


With best regards,

Jouni L.


Operating system is: FreeBSD 10.2-RELEASE #9


I made an environment like this:
zxid@ ~/src/zxid-1.22]$ ld --version
GNU ld 2.17.50 [FreeBSD] 2007-07-03
[root@ ]# pkg install gcc      # not necessary
[root@ ]# pkg install gmake  # needed
[root@ ]# pkg install swig   # needed

alias swig=/usr/local/bin/swig2.0
alias make=/usr/local/bin/gmake
CC=" clang "; export C

and added missing headerlines:

[zxid@ ~/src/zxid-1.22]$ diff platform.h platform.h_orig
11,14d10
< #ifdef __FreeBSD__
< #include <unistd.h>
< #endif
< 
[zxid@ ~/src/zxid-1.22]$ diff zxidconf.c zxidconf.c_orig 
36d35
< #ifndef __FreeBSD__
38,40d36
< #else
< #include <stdlib.h>
< #endif

Makefile had these changes (some of them useless):

[zxid@ ~/src/tmp/zxid-1.22]$ diff Makefile ~/src/zxid-1.22/Makefile 
99,101c99,102
< APACHE_INC ?= -I/usr/include/apache2
< APR_INC    ?= -I/usr/include/apr-1.0
< APACHE_MODULES ?= /usr/lib/apache2/modules
---
> #APACHE_INC ?= -I/usr/include/apache2
> APACHE_INC ?= -I/usr/local/include/apache24
> APR_INC    ?= -I/usr/local/include/apr-1
> APACHE_MODULES ?= /usr/local/libexec/apache24
134c135
< CINC+=-I. -I$(TOP)
---
> CINC+=-I. -I$(TOP) -I/usr/local/include
147c148
< LIBS+= -lcurl -lssl -lcrypto -lz $(POSTLIBS)
---
> LIBS+= -lcurl -lssl -lcrypto -lz $(POSTLIBS) -lc -L/usr/local/lib
180c181
< SHARED_FLAGS=-shared -Wl,--export-dynamic -Wl,--whole-archive -Wl,--allow-multiple-definition
---
> SHARED_FLAGS=-shared -Wl,--export-dynamic -Wl,--whole-archive -Wl,--allow-multiple-definition 
345c346,347
< CDEF+= -DUSE_PTHREAD -pthread
---
> #CDEF+= -DUSE_PTHREAD -pthread
> CDEF+= -DUSE_PTHREAD -lpthread

Commands used was these:

make TARGET=freebsd apachezxid
make TARGET=freebsd apachezxid_install
make dir