GKlib
GKlib copied to clipboard
unknown type name 'siginfo_t'
On my laptop GKlib installs fine, but on two linux clusters (stampede2 & frontera, in case you have access to them) I get:
In file included from /work2/00434/eijkhout/gklib/gklib-git/./GKlib.h:41,
from /work2/00434/eijkhout/gklib/gklib-git/string.c:21:
/usr/include/signal.h:156:29: error: unknown type name ‘siginfo_t’
extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
^~~~~~~~~
during compilation. My laptop has clang12, frontera has intel19 & gcc12.
Hi Same issue here: CentOS7, gnu8 or gnu12, make 4.4, cmake 3.25.2.
add config in GKlibSystem.cmake: set(GKlib_COPTIONS "${GKlib_COPTIONS} -D_POSIX_C_SOURCE=199309L") it works on CentOS7
Hi, I have same issue, I have attempted to add set(GKlib_COPTIONS "${GKlib_COPTIONS} -D_POSIX_C_SOURCE=199309L") in GKlibSystem.cmake, but I don't know add to which position, so I attempt to add the front and back, but I don't slove the issue.
This works for me. Note that this refers to a couple of internal variables of my private scripts.
&& make BUILDDIR=$${builddir} \
CONFIG_FLAGS="\
-DCMAKE_VERBOSE_MAKEFILE=1 \
-D CMAKE_INSTALL_PREFIX=$${installdir} \
-D CMAKE_C_COMPILER=$${CC} \
-D OPENMP=$${ompflag} \
-D CMAKE_C_FLAGS=\"-D_POSIX_C_SOURCE=200809L $${nox86}\" \
-D CMAKE_POSITION_INDEPENDENT_CODE=ON \
" \
config \
(where nox86="-D NO_X86" for my Macbook)
And then I make with
&& make V=1 BUILDDIR=$${builddir} \
&& make BUILDDIR=$${builddir} install \
Hi, I would like to ask if these commands need to be added to the GlibSystem.cmake file? Thank you very much.
---- Replied Message ---- | From | Victor @.> | | Date | 05/28/2023 22:00 | | To | @.> | | Cc | @.>@.> | | Subject | Re: [KarypisLab/GKlib] unknown type name 'siginfo_t' (Issue #24) |
This works for me. Note that this refers to a couple of internal variables of my private scripts.
&& make BUILDDIR=$${builddir} \
CONFIG_FLAGS="\
-DCMAKE_VERBOSE_MAKEFILE=1 \
-D CMAKE_INSTALL_PREFIX=$${installdir} \
-D CMAKE_C_COMPILER=$${CC} \
-D OPENMP=$${ompflag} \
-D CMAKE_C_FLAGS=\"-D_POSIX_C_SOURCE=200809L $${nox86}\" \
-D CMAKE_POSITION_INDEPENDENT_CODE=ON \
" \
config \
And then I make with
&& make V=1 BUILDDIR=$${builddir} \
&& make BUILDDIR=$${builddir} install \
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
No, these lines are to be executed at the shell level. I have them in a makefile.
Hi, I used the statement you gave to try to modify the Makefile, but it still seems to be wrong, I can't run the make command after modification, is it that I added the wrong location? Please ask where these commands should be added? THANKS!
Those commands are not added anywhere. You can issue them interactively or put them in your own script. You need to substitute some variables, and may the quotes need special treatment.
1set(GKlib_COPTIONS "${GKlib_COPTIONS} -D_POSIX_C_SOURCE=199309L") It is not work for me. And when I execute this shell,
make BUILDDIR="build"
CONFIG_FLAGS=
-d CMAKE_VERBOSE_MAKEFILE=1
-d CMAKE_INSTALL_PREFIX="~/GKlib_install"
-d CMAKE_C_COMPILER="/usr/local/gcc-9.3.0/gcc/"
-d _POSIX_C_SOURCE=200809L
-d CMAKE_POSITION_INDEPENDENT_CODE=ON
config
It is still not working for me. It Is something wrong with my command line. Thanks.
Thanks to @longmingg and @VictorEijkhout for the fix. Also, this is related to Issue #13, where @tormentliang describes why this fix is needed. Because there is still some confusion, I'm going to summarize a bit.
The important thing is that your compiler sees the flag -D_POSIX_C_SOURCE=199309L. This is what lets the compiler know that it should allow you to use siginfo_t. This thread describes two ways to accomplish that: (1) using Make or (2) using CMake. Either way will work fine, though I think the CMake way might be easier for some folks.
(1) If you want to use Make as @VictorEijkhout did, then copy their make command and be careful about quotes. They set _POSIX_C_SOURCE to 200809L instead of 199309L, but that is fine too.
(2) If you are not sure what you are doing, I recommend using CMake here as @longmingg did. Edit the file GKlibSystem.cmake. You need to add exactly the line
set(GKlib_COPTIONS "${GKlib_COPTIONS} -D_POSIX_C_SOURCE=199309L")
but the location matters. For simplicity, put it directly above the line
set(CMAKE_C_FLAGS [...truncated text...])
which is around line 147 in my version of the file. If you add the line earlier, it might get overwritten, and if you add it later, then it will have no effect.
The simplest method is to add the following information to the cmake command line: -DCMAKE_C_FLAGS="-D_POSIX_C_SOURCE=199309L"
Complete cmake command line, like: cmake -DCMAKE_C_FLAGS="-D_POSIX_C_SOURCE=199309L" -DBUILD_SHARED_LIBS=OFF ../
if use make config, like: make config cc=gcc prefix=/data CFLAGS="-D_POSIX_C_SOURCE=199309L"