Opened 10 years ago

Last modified 7 years ago

#1198 closed defect (Fixed)

Solaris 10 compile error "RLIMIT_MEMLOCK undeclared"

Reported by: otto Owned by:
Priority: Low Milestone:
Component: Core Tor/Tor Version: 0.2.2.6-alpha
Severity: Keywords:
Cc: otto, Sebastian, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

When trying to compile tor-0.2.2.6-alpha I get the following error:

gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/common -I/opt/csw/include -I/usr/local/ssl/include -g -O2 -Wall -g -O2 -fno-strict-aliasing -MT compat.o -MD -MP -MF .deps/compat.Tpo -c -o compat.o compat.c
compat.c: In function `tor_set_max_memlock':
compat.c:2224: error: `RLIMIT_MEMLOCK' undeclared (first use in this function)
compat.c:2224: error: (Each undeclared identifier is reported only once
compat.c:2224: error: for each function it appears in.)
gmake[3]: * [compat.o] Error 1
gmake[3]: Leaving directory `/usr/local/lib/tor-0.2.2.6-alpha/src/common'

This is not an issue with tor-0.2.1.21, I have compiled and running tor-0.2.1.21.

The Solaris 10 is the latest release "5.10 Generic_127112-10 i86pc i386 i86pc" (Nov. 2009) with all recommended
patches.

The details for configure and compiling are as follows:

usmine:/usr/local/lib/tor-0.2.2.6-alpha>
usmine:/usr/local/lib/tor-0.2.2.6-alpha> ./configure --with-libevent-dir=/opt/csw \

--with-tor-user=tor \
--with-tor-group=guest \
--enable-eventdn \
--sysconfdir=/home/tor

checking for a BSD-compatible install... /opt/sfw/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/sfw/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i386-pc-solaris2.10
checking host system type... i386-pc-solaris2.10
configure: You are running Solaris; Sometimes threading makes
cpu workers lock up here, so I will disable threads.
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
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 how to run the C preprocessor... gcc -E
checking whether make sets $(MAKE)... (cached) yes
checking for ranlib... ranlib
checking for sed... sed
checking for sha1sum... /opt/sfw/bin/sha1sum
checking for openssl... /usr/local/ssl/bin/openssl
checking for win32... no
checking for MIPSpro compiler... no
checking for grep that handles long lines and -e... /usr/sfw/bin/ggrep
checking for egrep... /usr/sfw/bin/ggrep -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 whether byte ordering is bigendian... no
checking for library containing socket... -lsocket
checking for library containing gethostbyname... -lnsl
checking for library containing dlopen... none required
checking for library containing inet_aton... -lresolv
checking for gettimeofday... yes
checking for ftime... yes
checking for socketpair... yes
checking for uname... yes
checking for inet_aton... yes
checking for strptime... yes
checking for getrlimit... yes
checking for strlcat... yes
checking for strlcpy... yes
checking for strtoull... yes
checking for getaddrinfo... yes
checking for localtime_r... yes
checking for gmtime_r... yes
checking for memmem... no
checking for strtok_r... yes
checking for writev... yes
checking for readv... yes
checking for flock... no
checking for prctl... no
checking for mallinfo... no
checking for malloc_good_size... no
checking for malloc_usable_size... no
checking for sys/types.h... (cached) yes
checking for u_int64_t... no
checking for u_int32_t... no
checking for u_int16_t... no
checking for u_int8_t... no
checking for libevent directory... /opt/csw
checking whether we need extra options to link libevent... (none)
checking for event_get_version... yes
checking for event_get_version_number... no
checking for event_get_method... yes
checking for event_set_log_callback... yes
checking for evdns_set_outgoing_bind_address... no
checking for event_base_loopexit... yes
checking for struct event.min_heap_idx... no
checking event2/event.h usability... no
checking event2/event.h presence... no
checking for event2/event.h... no
checking event2/dns.h usability... no
checking event2/dns.h presence... no
checking for event2/dns.h... no
checking for openssl directory... /usr/local/ssl
checking whether we need extra options to link openssl... (none)
checking for zlib directory... (system)
checking whether we need extra options to link zlib... (none)
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for unistd.h... (cached) yes
checking for string.h... (cached) yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for sys/stat.h... (cached) yes
checking for sys/types.h... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking sys/fcntl.h usability... yes
checking sys/fcntl.h presence... yes
checking for sys/fcntl.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking assert.h usability... yes
checking assert.h presence... yes
checking for assert.h... yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking grp.h usability... yes
checking grp.h presence... yes
checking for grp.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking for stdint.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for inttypes.h... (cached) yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking sys/limits.h usability... no
checking sys/limits.h presence... no
checking for sys/limits.h... no
checking for netinet/in.h... (cached) yes
checking for arpa/inet.h... (cached) yes
checking machine/limits.h usability... no
checking machine/limits.h presence... no
checking for machine/limits.h... no
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for sys/time.h... (cached) yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking for inttypes.h... (cached) yes
checking utime.h usability... yes
checking utime.h presence... yes
checking for utime.h... yes
checking sys/utime.h usability... yes
checking sys/utime.h presence... yes
checking for sys/utime.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking netinet/in6.h usability... no
checking netinet/in6.h presence... no
checking for netinet/in6.h... no
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking sys/syslimits.h usability... no
checking sys/syslimits.h presence... no
checking for sys/syslimits.h... no
checking malloc/malloc.h usability... no
checking malloc/malloc.h presence... no
checking for malloc/malloc.h... no
checking linux/types.h usability... no
checking linux/types.h presence... no
checking for linux/types.h... no
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking malloc_np.h usability... no
checking malloc_np.h presence... no
checking for malloc_np.h... no
checking sys/prctl.h usability... no
checking sys/prctl.h presence... no
checking for sys/prctl.h... no
checking for declaration of malloc_good_size... no
checking for net/if.h... yes
checking for net/pfvar.h... no
checking for linux/netfilter_ipv4.h... no
configure: Transparent proxy support enabled, but missing headers.
checking for struct timeval.tv_sec... yes
checking for int8_t... yes
checking size of int8_t... 1
checking for int16_t... yes
checking size of int16_t... 2
checking for int32_t... yes
checking size of int32_t... 4
checking for int64_t... yes
checking size of int64_t... 8
checking for uint8_t... yes
checking size of uint8_t... 1
checking for uint16_t... yes
checking size of uint16_t... 2
checking for uint32_t... yes
checking size of uint32_t... 4
checking for uint64_t... yes
checking size of uint64_t... 8
checking for intptr_t... yes
checking size of intptr_t... 4
checking for uintptr_t... yes
checking size of uintptr_t... 4
checking for char... yes
checking size of char... 1
checking for short... yes
checking size of short... 2
checking for int... yes
checking size of int... 4
checking for long... yes
checking size of long... 4
checking for long long... yes
checking size of long long... 8
checking for int64... no
checking size of
int64... 0
checking for void *... yes
checking size of void *... 4
checking for time_t... yes
checking size of time_t... 4
checking for size_t... yes
checking size of size_t... 4
checking for uint... yes
checking for u_char... yes
checking for ssize_t... yes
checking for struct in6_addr... yes
checking for struct sockaddr_in6... yes
checking for sa_family_t... yes
checking for struct in6_addr.s6_addr32... no
checking for struct in6_addr.s6_addr16... no
checking for struct sockaddr_in.sin_len... no
checking for struct sockaddr_in6.sin6_len... no
checking for rlim_t... yes
checking whether time_t is signed... yes
checking for socklen_t... yes
checking size of socklen_t... 4
checking for cell_t... no
checking size of cell_t... 0
checking whether memset(0) sets pointers to NULL... yes
checking whether we can malloc(0) safely.... yes
checking whether we are using 2s-complement arithmetic... yes
checking whether to use dmalloc (debug memory allocation library)... no
checking for mlockall... yes
checking for getresuid... no
checking for getresgid... no
checking for gethostbyname_r... yes
checking how many arguments gethostbyname_r() wants... 5
checking whether the C compiler supports func... yes
checking whether the C compiler supports FUNC... no
checking whether the C compiler supports FUNCTION... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating tor.spec
config.status: creating Doxyfile
config.status: creating contrib/tor.sh
config.status: creating contrib/torctl
config.status: creating contrib/torify
config.status: creating contrib/tor.logrotate
config.status: creating contrib/Makefile
config.status: creating contrib/osx/Makefile
config.status: creating contrib/osx/TorBundleDesc.plist
config.status: creating contrib/osx/TorBundleInfo.plist
config.status: creating contrib/osx/TorDesc.plist
config.status: creating contrib/osx/TorInfo.plist
config.status: creating contrib/osx/TorStartupDesc.plist
config.status: creating src/config/torrc.sample
config.status: creating doc/tor.1
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating doc/design-paper/Makefile
config.status: creating doc/spec/Makefile
config.status: creating src/config/Makefile
config.status: creating src/common/Makefile
config.status: creating src/or/Makefile
config.status: creating src/test/Makefile
config.status: creating src/win32/Makefile
config.status: creating src/tools/Makefile
config.status: creating contrib/suse/Makefile
config.status: creating contrib/suse/tor.sh
config.status: creating orconfig.h
config.status: executing depfiles commands
usmine:/usr/local/lib/tor-0.2.2.6-alpha> gmake
gmake all-recursive
gmake[1]: Entering directory `/usr/local/lib/tor-0.2.2.6-alpha'
Making all in src
gmake[2]: Entering directory `/usr/local/lib/tor-0.2.2.6-alpha/src'
Making all in common
gmake[3]: Entering directory `/usr/local/lib/tor-0.2.2.6-alpha/src/common'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/common -I/opt/csw/include -I/usr/local/ssl/include -g -O2 -Wall -g -O2 -fno-strict-aliasing -MT address.o -MD -MP -MF .deps/address.Tpo -c -o address.o address.c
mv -f .deps/address.Tpo .deps/address.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/common -I/opt/csw/include -I/usr/local/ssl/include -g -O2 -Wall -g -O2 -fno-strict-aliasing -MT log.o -MD -MP -MF .deps/log.Tpo -c -o log.o log.c
log.c:95: warning: 'log_mutex' defined but not used
mv -f .deps/log.Tpo .deps/log.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/common -I/opt/csw/include -I/usr/local/ssl/include -g -O2 -Wall -g -O2 -fno-strict-aliasing -MT util.o -MD -MP -MF .deps/util.Tpo -c -o util.o util.c
mv -f .deps/util.Tpo .deps/util.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/common -I/opt/csw/include -I/usr/local/ssl/include -g -O2 -Wall -g -O2 -fno-strict-aliasing -MT compat.o -MD -MP -MF .deps/compat.Tpo -c -o compat.o compat.c
compat.c: In function `tor_set_max_memlock':
compat.c:2224: error: `RLIMIT_MEMLOCK' undeclared (first use in this function)
compat.c:2224: error: (Each undeclared identifier is reported only once
compat.c:2224: error: for each function it appears in.)
gmake[3]: * [compat.o] Error 1
gmake[3]: Leaving directory `/usr/local/lib/tor-0.2.2.6-alpha/src/common'
gmake[2]:
* [all-recursive] Error 1
gmake[2]: Leaving directory `/usr/local/lib/tor-0.2.2.6-alpha/src'
gmake[1]: * [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/local/lib/tor-0.2.2.6-alpha'
gmake:
* [all] Error 2
usmine:/usr/local/lib/tor-0.2.2.6-alpha>

[Automatically added by flyspray2trac: Operating System: Solaris]

Child Tickets

Attachments (2)

0001-Remove-the-request-for-current-memlock-limits.patch (2.3 KB) - added by Sebastian 10 years ago.
compat.c (69.3 KB) - added by otto 10 years ago.
the compat.c file from the tor-0.2.2.6-alpha archive

Download all attachments as: .zip

Change History (13)

comment:1 Changed 10 years ago by Sebastian

Can you try if the attached patch fixes this for you?

Thanks!

comment:2 Changed 10 years ago by nickm

Sebastian: If the problem is that RLIMIT_MEMLOCK isn't defined, then the setrlimit(RLIMIT_MEMLOCK,...) can't work either.

Perhaps the whole body of tor_set_max_memlock should be #ifdef RLIMIT_MEMLOCK in addition to whatever it's
currently conditioned on.

comment:3 Changed 10 years ago by Sebastian

oh hey. wow, I totally missed that. While my patch obviously doesn't fix the issue,
it might still be useful, since we're not actually using the getrlimit results?

comment:4 Changed 10 years ago by otto

I tried to run the patch utility without succsess, can you give me a hint how to run it?
I did in the top directory of the distribution:

usmine:/usr/local/lib/tor-0.2.2.6-alpha> patch -i 0001-Remove-the-request-for-current-memlock-limits.patch

Looks like a unified context diff.

File to patch: src/common/compat.c

I can't seem to find a patch in there anywhere.

usmine:/usr/local/lib/tor-0.2.2.6-alpha>

Thanks.

comment:5 Changed 10 years ago by Sebastian

New try, with a much simpler patch just trying to fix your compile issue:

diff --git a/src/common/compat.c b/src/common/compat.c
index 87dedc5..fbd65fc 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2208,7 +2208,7 @@ tor_threads_init(void)

}
#endif


-#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL
+#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL && defined(RLIMIT_MEMLOCK)

/ Attempt to raise the current and max rlimit to infinity for our process.

  • This only needs to be done once and can probably only be done when we have
  • not already dropped privileges.

@@ -2276,7 +2276,7 @@ tor_mlockall(void)


-#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL
+#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL && defined(RLIMIT_MEMLOCK)

if (tor_set_max_memlock() == 0) {

/* Perhaps we only want to log this if we're in a verbose mode? */
log_notice(LD_GENERAL, "RLIMIT_MEMLOCK is now set to RLIM_INFINITY.");

If you still cannot apply that, find the following line (two occurences)

#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL

in src/common/compat.c and change them to:

#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL && defined(RLIMIT_MEMLOCK)

Changed 10 years ago by otto

Attachment: compat.c added

the compat.c file from the tor-0.2.2.6-alpha archive

comment:6 Changed 10 years ago by otto

Seems not to be my day, I could not find any line like:
"#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL"

the only occurrence of "HAVE_MLOCKALL" looks like this:
...
#ifdef HAVE_MLOCKALL

ret = tor_set_max_memlock();

...

I have attache the compat.c file from the downloaded tor-0.2.2.6-alpha archive.
Any idea?
Thanks.

comment:7 Changed 10 years ago by Sebastian

Looks like it isn't my week, either. The patch I made is against
current git master, not against 0.2.2.6-alpha.

Try fetching a tarball of the current master from
http://gitweb.torproject.org/tor/tor.git/snapshot and then try again, please?

comment:8 Changed 10 years ago by otto

Downloading the snapshot (tor-8cba62cc2afc661f75b519f0b4ddf7c8892f15a0.tar.gz) and
modifying src/common/compat.c as recommendet by substituting:

"#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL"

with

"#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL && defined(RLIMIT_MEMLOCK)"

did the trick.
Tor (0.2.2.6-alpha-dev) is up and running on Solaris.

Thanks!

Best Regards
Otto

comment:9 Changed 10 years ago by Sebastian

hah, awesome. Will make a commit with this fix once our git is back up.

Thanks for your report and keeping us updated!

comment:10 Changed 10 years ago by Sebastian

flyspray2trac: bug closed.
Fix is due to be merged to master.

comment:11 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.