MantisBT - CMake
View Issue Details
0011110CMakeCMakepublic2010-08-11 10:122015-07-08 08:57
Mihai 
Bill Hoffman 
normalmajoralways
closedno change required 
CMake-2-8 
 
0011110: CMake cannot be compiled on OpenBSD 3.9
It seems, that the missing function,getpwuid_r, which causes the compilation of CMake on
OpenBSD to fail, is not available on OpenBSD 3.9.
According to the OpenBSD Manual pages, getpwuid_r was added in OpenBSD 4.4.
make fails:

# LDLAGS="${LDFLAGS} -lpthread" CC=gcc-42 CXX="g++-42" ./configure --no-qt-gui
\
      --prefix=/opt/cmake-2.8.2
# make
[...]
/opt/gcc-4.2.4/lib/gcc/i386-unknown-openbsd3.9/4.2.4/../../../libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vRKPiPciPKcz+0x70):
In function `std::__convert_from_v(int* const&, char*, int, char const*, ...)':
/root/gcc/build-gcc/i386-unknown-openbsd3.9/libstdc++-v3/include/bits/locale_facets.h:2992:
warning: vsprintf() is often misused, please use vsnprintf()
../Utilities/cmlibarchive/libarchive/libcmlibarchive.a(archive_entry.c.o)(.text+0xe9):
In function `aes_copy':
: warning: wcscpy() is almost always misused, please use wcslcpy()
CMakeFiles/ccmake.dir/CursesDialog/cmCursesLongMessageForm.o(.text+0x825): In
function `cmCursesLongMessageForm::UpdateStatusBar()':
: warning: strcpy() is almost always misused, please use strlcpy()
CMakeFiles/ccmake.dir/CursesDialog/cmCursesLongMessageForm.o(.text+0x29c): In
function `cmCursesLongMessageForm::HandleInput()':
: warning: sprintf() is often misused, please use snprintf()
libCMakeLib.a(cmCommandArgumentParserHelper.o)(.text+0xf60): In function
`cmCommandArgumentParserHelper::CombineUnions(char*, char*)':
: warning: strcat() is almost always misused, please use strlcat()
../Utilities/cmlibarchive/libarchive/libcmlibarchive.a(archive_read_disk_set_standard_lookup.c.o)(.text+0x343):
In function `lookup_uname_helper':
: undefined reference to `getpwuid_r'
collect2: ld returned 1 exit status
make[2]: *** [bin/ccmake] Error 1
make[1]: *** [Source/CMakeFiles/ccmake.dir/all] Error 2
make: *** [all] Error 2
#

using gcc-3.3.5 by configuring with
# ./configure --no-qt-gui --prefix=/opt/cmake-2.8.2
produces the same error
No tags attached.
patch cmlibarchive_without_getNNN_r.patch (4,468) 2010-09-02 09:52
https://public.kitware.com/Bug/file/3355/cmlibarchive_without_getNNN_r.patch
patch cmlibarchive_without_getNNN_r-2.patch (5,579) 2010-09-03 01:56
https://public.kitware.com/Bug/file/3356/cmlibarchive_without_getNNN_r-2.patch
Issue History
2010-08-11 10:12MihaiNew Issue
2010-08-11 10:41Bill HoffmanNote Added: 0021708
2010-08-11 10:41Bill HoffmanStatusnew => assigned
2010-08-11 10:41Bill HoffmanAssigned To => Bill Hoffman
2010-08-12 03:29MihaiNote Added: 0021726
2010-08-12 08:07Bill HoffmanNote Added: 0021727
2010-08-13 07:16MatthiasNote Added: 0021740
2010-08-16 10:23Bill HoffmanNote Added: 0021773
2010-08-23 08:02MihaiNote Added: 0021890
2010-08-23 10:46Bill HoffmanNote Added: 0021893
2010-09-02 09:52MatthiasNote Added: 0022073
2010-09-02 09:52MatthiasFile Added: cmlibarchive_without_getNNN_r.patch
2010-09-02 12:39Bill HoffmanNote Added: 0022074
2010-09-03 01:56MatthiasFile Added: cmlibarchive_without_getNNN_r-2.patch
2010-09-03 02:12MatthiasNote Added: 0022080
2010-10-12 04:03MihaiNote Added: 0022475
2010-10-12 10:08Bill HoffmanNote Added: 0022477
2010-10-14 03:55MatthiasNote Added: 0022491
2010-10-14 09:44Bill HoffmanNote Added: 0022492
2012-12-11 14:48Amit KulkarniNote Added: 0031867
2015-02-26 16:23Stephen KellyStatusassigned => resolved
2015-02-26 16:23Stephen KellyResolutionopen => no change required
2015-07-08 08:57Robert MaynardNote Added: 0039081
2015-07-08 08:57Robert MaynardStatusresolved => closed

Notes
(0021708)
Bill Hoffman   
2010-08-11 10:41   
Please try git master or next of CMake. We now have a dashboard for OpenBSD, and have done the porting work. What version of CMake are you using?
(0021726)
Mihai   
2010-08-12 03:29   
version of cmake that I tried to install is 2.8.2. Should I try with git master?
(0021727)
Bill Hoffman   
2010-08-12 08:07   
Yes, try git master or git next.
(0021740)
Matthias   
2010-08-13 07:16   
Tried to compile git master of CMake on OpenBSD 3.9, but make failed with the same error. OpenBSD does not provide getpwuid_r until Version 4.4.
Is there maybe a configure switch to CMake? Version 2.6.4 compiles just fine.
(0021773)
Bill Hoffman   
2010-08-16 10:23   
OK, we are only nightly testing on OpenBSD 4.6 (i386)-gcc 4.2.4-gmake. If you want to provide a patch that would be good. We don't have access to a 3.9 machine.
(0021890)
Mihai   
2010-08-23 08:02   
And how can I help?
(0021893)
Bill Hoffman   
2010-08-23 10:46   
Create a patch and run a nightly dashboard.
(0022073)
Matthias   
2010-09-02 09:52   
Comparing the included Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c (where the error seems to happen) to the same file in the standalone libarchive, I found that some preprocessor instructions and code for handling systems without getpwuid_r (and similar functions) had been removed, together with the corresponding instructions in CMakeLists.txt.

Patching the lines from the standalone libarchive into cmlibarchive seems to solve the problem. But I'm no C-programmer and so I cannot tell for what reason this code had been removed or if reinserting it will have some side effects.

I attached a patch against the 2.8.2-release.
(0022074)
Bill Hoffman   
2010-09-02 12:39   
the new try-compile results need to be referenced in
build/cmake/config.h.in so that they are visible in the source. Can you add that part to the patch and attach a new patch?
(0022080)
Matthias   
2010-09-03 02:12   
Hmm, I'm not sure, what you mean, but I took a diff between libarchive-2.8.4/build/cmake/config.h.in and cmake-2.8.2/Utilities/cmlibarchive/build/cmake/config.h.in. Then I copied the lines, which seemed relevant.

Attached new patch cmlibarchive_without_getNNN_r-2.patch

(As you can see, this is really not my area of expertise and I'm heavily relying on the Frankenstein-approach.)
(0022475)
Mihai   
2010-10-12 04:03   
The patch provided by Matthias is working very well.
(0022477)
Bill Hoffman   
2010-10-12 10:08   
Can either of you run a nightly dashboard on this system? I would like to make sure it keeps on working.

Thanks.
(0022491)
Matthias   
2010-10-14 03:55   
Ok. I'm still not sure what exactly a "nightly dashboard" is, but looking into the wiki I figured it may have to do something with the nightly and/or dashboard branches of the git-tree. So I did the following:

# # unfortunately there is no git available on the system in question:
# cvs -d :pserver:anonymous@cmake.org:/cmake.git co -d CMake nightly
# cd CMake
# patch -p1 cmlibarchive_without_getNNN_r-2.patch
# CXXFLAGS="${CXXFLAGS} -pthread" \
> CC=/opt/gcc-4.2.4/bin/gcc \
> CXX="/opt/gcc-4.2.4/bin/g++" \
> ./configure --no-qt-gui --prefix=/tmp/test/cm-n-gcc42
# make
# make install

Everything worked like intended: The patch applied without even a warning. Configure and make also completed successfully

# /tmp/test/cm-n-gcc42/bin/cmake --version
cmake version 2.8.2.20101012-cvs-nightly

For testing I built the (also patched) 2.8.2 realease of cmake

# tar xfz cmake-2.8.2.tar.gz
# cd cmake-2.8.2
# patch -p1 cmlibarchive_without_getNNN_r-2.patch
# CXXFLAGS="${CXXFLAGS} -pthread" \
> CC=/opt/gcc-4.2.4/bin/gcc \
> CXX="/opt/gcc-4.2.4/bin/g++" \
> /tmp/test/cm-n-gcc42/bin/cmake .
# make
# bin/cmake --version
cmake verison 2.8.2

So it seems to be working just fine.
I hope this is what you asked for.

Thanks.
(0022492)
Bill Hoffman   
2010-10-14 09:44   
by nightly dashboard, I mean a cronjob on your machine that builds CMake from git next once a day. For instructions see here:

http://www.cmake.org/cmake/resources/testing.html [^]

I want to make sure that your work is not "undone" by someone in the future.
(0031867)
Amit Kulkarni   
2012-12-11 14:48   
can you close this? openbsd 3.9 was released may 1, 2006, cmake since then works on openbsd...

won't fix
(0039081)
Robert Maynard   
2015-07-08 08:57   
Closing resolved issues that have not been updated in more than 4 months.