LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Difficulty finding c header in Slackware. (https://www.linuxquestions.org/questions/slackware-14/difficulty-finding-c-header-in-slackware-4175657020/)

brokenshakles 07-07-2019 05:37 PM

Difficulty finding c header in Slackware.
 
I have Slackware-Current installed with multilib, and I'm trying to compile a personal C project with Meson + gcc that uses the header #include <stdatomic.h>, but my compiler doesnt seem to find it. My code checker throws a warning about not finding the file, so I presume I'm having linking issues, but I'm not sure if Slackware contains this file by default. I have used other linux distributions before, and not have had a problem of this sort, does anyone have any ideas/direction on how to resolve this?

BW-userx 07-07-2019 06:11 PM

Code:

$ whereis include
include: /usr/local/include /usr/src/linux-4.19.57/include

I am not sure about 32 or what file you're speaking of but that is where your header files are at and how to locate the dir for them.

i do not know why
Code:

/usr/include
did not show up in that.
Code:

$ locate stdatomic.h
/usr/include/isc/stdatomic.h
/usr/lib64/clang/8.0.0/include/stdatomic.h
/usr/lib64/gcc/x86_64-slackware-linux/9.1.0/include/stdatomic.h

should find it if it is on your system.
Code:

sudo updatedb
to update locate.

mod:
is it written
Code:

#include /isc/stdatomic.h
or
#include stdatomic.h

I think that is how it should be written if it is in a sub dir /SubDir/file.h

Didier Spaier 07-07-2019 06:21 PM

This file is shipped in llvm and gcc packages in Slackware. Maybe something missing in your multilib installation?

brokenshakles 07-07-2019 07:21 PM

That's what I thought, I contacted Alienbob here on his website about it, he told me to come to you:

https://alien.slackbook.org/blog/you...#comment-36006

Edit: Results of locate stdatomic.h :

/usr/include/isc/stdatomic.h
/usr/lib/clang/8.0.0/include/stdatomic.h
/usr/lib64/clang/8.0.0/include/stdatomic.h
/usr/lib64/gcc/x86_64-slackware-linux/9.1.0/include/stdatomic.h

Edit 2: #include <isc/stdatomic.h> seems to be found, but attempting to use the functions included returns "implicit declaration invalid in c99". I thought I was using c11? And it should be included at this point, so why is it not finding the symbol?

philanc 07-07-2019 07:59 PM

To find out whether the issue is with your gcc install, you may try to compile the following:

test.c:
Code:

#include <stdatomic.h>
atomic_int i = 1;
int main() { return i; }

run
Code:

gcc test.c
If it generates a a.out file and doesn't complain about missing stdatomic.h, you may consider your gcc install is ok. Then the issue may be with the Meson magic...

philanc 07-07-2019 08:04 PM

Quote:

Originally Posted by brokenshakles (Post 6012936)

Edit 2: #include <isc/stdatomic.h> seems to be found, but the functions included are "invalid in c99". I thought I was using c11?

If you are building with gcc as you said in your first post, it shouldn't matter. stdatomic.h is part of C11, but with gcc it is found also with -std=c99, even with -std=c89 (as you can check with the small test.c in my previous post)

brokenshakles 07-07-2019 08:41 PM

Quote:

Originally Posted by philanc (Post 6012939)
To find out whether the issue is with your gcc install, you may try to compile the following:

test.c:
Code:

#include <stdatomic.h>
atomic_int i = 1;
int main() { return i; }

run
Code:

gcc test.c
If it generates a a.out file and doesn't complain about missing stdatomic.h, you may consider your gcc install is ok. Then the issue may be with the Meson magic...

It appears that my install passes this test. The compile completes with no complaints.

philanc 07-07-2019 11:54 PM

Quote:

Originally Posted by brokenshakles (Post 6012946)
It appears that my install passes this test. The compile completes with no complaints.

So at least, the header file is there and a minimal program using it can be built. Now, I don't know how Meson work, and why it cannot find the header.

Maybe the include directory /usr/lib64/gcc/x86_64-slackware-linux/X.Y.Z/include (adjust to your gcc version) should be somehow added to the list of include paths in your project config file?

I'm afraid I can't help you further here.


All times are GMT -5. The time now is 10:50 PM.