Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unknown type name 'siginfo_t' #24

Open
VictorEijkhout opened this issue Mar 29, 2023 · 11 comments
Open

unknown type name 'siginfo_t' #24

VictorEijkhout opened this issue Mar 29, 2023 · 11 comments

Comments

@VictorEijkhout
Copy link

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.

@afalaize
Copy link

afalaize commented Apr 19, 2023

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

@longmingg
Copy link

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

@tyyjoanna
Copy link

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.

@VictorEijkhout
Copy link
Author

VictorEijkhout commented May 28, 2023

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 \

@tyyjoanna
Copy link

tyyjoanna commented May 29, 2023 via email

@VictorEijkhout
Copy link
Author

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

@tyyjoanna
Copy link

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!

@VictorEijkhout
Copy link
Author

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.

@CaoZPLQ
Copy link

CaoZPLQ commented Jul 15, 2023

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.

@bowmnath
Copy link

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.

bilke added a commit to ufz/ogs that referenced this issue Oct 30, 2023
@Xie-ry
Copy link

Xie-ry commented Jan 8, 2024

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants