Project

General

Profile

[Solved] activate mod_cgi failed with error dlopen() failed for mod_cgi.so: undefined symbol: pipe2

Added by xiaoxiyin over 7 years ago

hi guys,
i use lighttpd with 1.4.42 and unix os.
and i want to load mod_cgi but failed.
could you help to look if anything wrong?

1/modify mod cgi.conf as below:
server.modules += ( "mod_cgi" )

cgi.assign = ( ".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl",
".rb" => "/usr/bin/ruby",
".erb" => "/usr/bin/eruby",
".py" => "/usr/bin/python" )

alias.url += ( "/cgi-bin" => server_root + "/cgi-bin" )
$HTTP["url"] =~ "^/cgi-bin" {
cgi.assign = ( "" => "" )
}

2/modify modules.conf as
server.modules = (
"mod_access",
"mod_proxy",
"mod_alias",
"mod_cgi",

)
include "conf.d/cgi.conf"

3/start lighttpd service, and get error:
2016-11-02 13:35:06: (plugin.c.227) dlopen() failed for: /home/xiaoxiyi/lighttpd-1.4.42/lib/mod_cgi.so /home/xiaoxiyi/lighttpd-1.4.42/lib/mod_cgi.so: undefined symbol: pipe2
2016-11-02 13:35:06: (server.c.912) loading plugins finally failed

looking forward your reply and best regards.


Replies (1)

RE: activate mod_cgi failed with error dlopen() failed for mod_cgi.so: undefined symbol: pipe2 - Added by gstrauss over 7 years ago

I am guessing that you're running FreeBSD 9.3. Did you know that it's scheduled for end-of-life less than two months from now?
https://www.freebsd.org/security/security.html#sup

See more details at https://www.lighttpd.net/2016/10/31/1.4.43/
A subsequent patch is needed for this to work on FreeBSD 9.3 using lighttpd 1.4.43

--- a/src/mod_cgi.c
+++ b/src/mod_cgi.c
@@ -36,7 +36,7 @@
 #include <stdio.h>
 #include <fcntl.h>

-#if defined(O_CLOEXEC) && (!defined(__FreeBSD__) || defined(F_DUPFD_CLOEXEC))
+#if defined(O_CLOEXEC) && (!defined(__FreeBSD__) || defined(SOCK_CLOEXEC))
 #define pipe_cloexec(pipefd) pipe2((pipefd), O_CLOEXEC)
 #elif defined FD_CLOEXEC
 #define pipe_cloexec(pipefd) \
    (1-1/1)