GKlib icon indicating copy to clipboard operation
GKlib copied to clipboard

unknown type name 'siginfo_t'

Open VictorEijkhout opened this issue 2 years ago • 13 comments
trafficstars

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.

VictorEijkhout avatar Mar 29 '23 20:03 VictorEijkhout

Hi Same issue here: CentOS7, gnu8 or gnu12, make 4.4, cmake 3.25.2.

afalaize avatar Apr 19 '23 11:04 afalaize

add config in GKlibSystem.cmake: set(GKlib_COPTIONS "${GKlib_COPTIONS} -D_POSIX_C_SOURCE=199309L") it works on CentOS7

longmingg avatar May 08 '23 11:05 longmingg

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.

tyyjoanna avatar May 28 '23 11:05 tyyjoanna

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 \

VictorEijkhout avatar May 28 '23 13:05 VictorEijkhout

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: @.***>

tyyjoanna avatar May 29 '23 07:05 tyyjoanna

No, these lines are to be executed at the shell level. I have them in a makefile.

VictorEijkhout avatar May 30 '23 12:05 VictorEijkhout

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!

tyyjoanna avatar May 31 '23 14:05 tyyjoanna

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.

VictorEijkhout avatar May 31 '23 15:05 VictorEijkhout

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.

CaoZPLQ avatar Jul 15 '23 08:07 CaoZPLQ

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.

bowmnath avatar Jul 17 '23 19:07 bowmnath

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"

Xie-ry avatar Jan 08 '24 12:01 Xie-ry