Package check was not found in the pkg-config search path - c

I am using check package in netbeans for C programming, But I receive this error from netbeans:
Package check was not found in the pkg-config search path.
Perhaps you should add the directory containing `check.pc'
to the PKG_CONFIG_PATH environment variable
No package 'check' found
In the terminal if I insert this line:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
and then
pkg-config --modversion check
it can find the check package, but in netbeans I still get the same error.
What should I do?
Thanks in advance

If you use OS X Mavericks,
Then download packages "check", "valgrind", "gcc" and "pkg-config" through the HomeBrew.
then edit /etc/launchd.conf and add there setenv PATH <your $PATH> Substitute with your real path. In this file no $HOME or such can't be used. This path should include gcc, check and valgrind. For this to take effect you need to restart your computer.
For me this worked:
$ cat /etc/launchd.conf
setenv PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Related

how to add directory to search path in msys2?

I am trying to install GTK 3 for C using this tutorial
after following the full install instructions and trying to build a simple program using this I was met with
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk+-3.0', required by 'virtual:world', not found
error. So I re did all the steps and noticed
Plus after installing the toolchain base-devel for C,C++ I checked if the old problem stayed using pkg-config --modversion gtk+3.0 I found this command here
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk+-3.0', required by 'virtual:world', not found
same issue. So my question is, Is there a way to add C:/msys64/mingw64/share/ to search path?
Use this command:
$ export PATH=$PATH:/c/msys64/mingw64/share

Where do the pkg-config targets get defined?

When I perform the command
pkg-config --variable pc_path pkg-config
The output is
/usr/lib64/pkgconfig:/usr/share/pkgconfig
However, there are two other pkgconfig directories on my system: /usr/lib/pkgconfig and /usr/local/lib/pkgconfig
If I try
echo $PKG_CONFIG_PATH
the result is
Undefined variable
I also tried to
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
but the response was
export: Command not found.
Now, I have built Gstreamer on multiple occasions and it will put the
metadata files (gstreamer-1.0.pc) into the other pkgconfig folder (usr/local/lib/pkgconfig). (I have been able to overcome this issue by modifying the configure file, changing lib to lib64 at the libdir definition.) But I would rather understand my system rather than try work-arounds.
So two questions: where does the pkg-config program get its target directories?
And why and how do the metadata files get put into a directory that is not apparently indicated by the pkg-config program?
Since the command is not working because that variable was not present
first check that variable is there or not for to do this
execute command
env
root#localhost:/etc/apt# env
if the path is not declare in env
then do something like
root#localhost:/etc/apt# PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
root#localhost:/etc/apt# export PKG_CONFIG_PATH
root#localhost:/etc/apt# echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig
root#localhost:/etc/apt# env
Hope this will work for you
for any further help please post the queries with error
When you install a foo package, foo package has an appropriate foo.pc that gets installed in the default pkgconfig directories. If a package puts its *.pc file in a custom location, as you already know, you should set your PKG_CONFIG_PATH accordingly. So, the pkg-config will not only look in the default directories, but also in the custom path you specified in PKG_CONFIG_PATH. This guide explains it well:
pkg-config guide

Where is my "stdio.h" in Mac?

I know that Mac OS X is a Unix-based system. And I heard that C standard library such as stdio.h, is located in /usr/local/include or /usr/include. But there is not any kind of library in this directory. I use Terminal to search this directory and I also use command like find ./ -iname "stdio.h", but nothing comes out. However, strangely enough, gcc -test.c -o test command works out. How did it happen? I want to know where my C library is located.
p.s I also use Xcode, too. Is it related with this application? help me!
And I have AWS EC2 linux server, and it has both libraries that i refereed above.
If you have Xcode but have not installed the optional Command Line Tools package then the standard includes and libraries may not be found in the usual place. Try:
$ find /Applications/Xcode.app -name stdio.h
and you'll probably see something like:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sys/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sys/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/stdio.h
However you might want to install the Command Line Tools package if you plan on doing any non-Xcode (i.e. command line) programming. You will then see the usual headers and libraries in /usr/include and /usr/lib.
If you don't have Command Line Tools installed you can run:
xcode-select --install
A dialogue box opens for you to accept the license agreement and so on.
(This was missing from the above responses.)
create/update a symlink for /usr/include to have the libs detected:
sudo ln -sf /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include /usr/include
The above path can be found by searching for stdio.h
find /Applications/Xcode.app -path '*/usr/include/stdio.h'
I have to do this with every XCode/MacOS SDK update, Faced this today with the XCode 7 upgrade.
Once the command line tools are installed, they cannot be re-installed with xcode-select, so the path may not be updated with a Mac AppStore upgrade.
Uninstalling & Reinstalling XCode and then running xcode-select --install might update the path, but is an overkill.
Some posts also mention xcode-select --switch /Application/Xcode.app, but I didn't have much luck with it.
The root reason is missing the /usr/include folder, installing command-line tools sometimes will not automatically add it.
Install the package at
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
In my laptop it appears in many locations like /usr/include/stdio.h and /usr/include/sys/stdio.h and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h.
If you already built your locate database, you can use
locate stdio.h
If you haven't already, build it. The locate command is awesome!
Due to Apple's new System Integrity Protection (SIP), you will run into this error when attempting the solution of creating/updating a symlink to /usr/include
ln: /usr/include: Operation not permitted
Instead of disabling SIP, the better way to do it is to create symlinks in /usr/local/include instead, e.g.
ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/* /usr/local/include/
This works for people who have already installed CommandLineTools and was unable to find stdio.h inside /usr/include
In the folder
Applications/Xcode/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include
or similar.
I have installed "CommandLineTools", and the "stdio.h" file exist in both Xcode and CommandLineTools diretory.
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h
This is my path for C/C++ library in M1 Mac 2022
/Library/Developer/CommandLineTools/usr/include/c++/v1

"-bash: gcc: command not found" using cygwin when compiling c?

I just installed the latest version of Cygwin ans for some reason when I try to compile code, it always flashes me this error:
-bash: gcc: command not
I also don't seem to have the gcc.exe that people are referring to and when I try installing stuff like mingw as suggested by other forum answers, it always gives me this error that ti couldn't install the repository.txt.... Looking for help on this matter!
You can install gcc by running setup-x86.exe or setup-x86_64.exe again. The gcc package is in the Devel category:
Then you must go to System properties, System variables, and append the path to "C:\cygwin64\bin" in PATH
If you have already added the gcc package you want you may also need to setup a symbolic link to a different gcc.exe binary. For example:
$cd /usr/bin/
$ln -s i686-pc-cygwin-gcc.exe gcc
$which gcc
$/usr/bin/gcc
You can add the gcc package through the 'Add Package' batch file.
Related issue.
I received below error:
'g++' is not recognized as an internal or external command,
Did the below to resolve:
Downloaded & installed setup-x86_64.exe from https://cygwin.com/install.html
selected below:
gcc-g++: GNU Compiler Collection (C++)
make: The GNU version of the 'make' utility
gdb: The GNU Debugger
Appended ';C:\cygwin64\bin' to PATH environment variable
All errors are gone.
when selecting packages at installation or update search for 'gcc' in searchbox and select the boxes showing 'gcc' mostly found in devel package.
Try installing cygwin from a mirror you did not use earlier(preferably the first one). Some of the servers hold older versions of cygwin which have many problems. Also, search for gcc and install the devel package.
I had the same problem when I installed cygwin from the iitm mirror(closest to my home), and it got resolved when I reinstalled the whole thing from the cygwin mirror.

C Socket Programming with CygWin

Hi
I'm trying to write a little server / client program in C using CygWin, problem is, the gcc compiler in Cygwin doesn't seem to contain the standard headers assosiated with socket-programming. When trying to compile my server program, i get:
netinet/in.h: No such file or directory
sys/socket.h: No such file or directory
netdb.h: No such file or directory
Are these three headers located elsewhere in the CygWin-enviorment?
I also had same problem.. i was googling for hours and finally found this... thanks to ralph...
https://ralphexe.wordpress.com/2015/09/09/run-unix-socket-program-in-windows-using-cygwin/
For socket commands you have to include some of the packages in cygwin while installing...
(If you have installed try reinstalling ...)
During the installation :
In "SELECT PACKAGES " phase of installation.
Expand DEVEL
select GNU compilers for c and c++
4.And click next and complete the installation.
NOW, try with a socket program involving sys/socket.h ...
I HOPE IT WILL WORK ... :-)..
Try using the -I compiler command line option to specify a path to the header files.
My local reference states
-I dir
Add the directory dir to the list of directories to be searched for
header files. Directories named by -I are searched before the
standard system include directories. If the directory dir is a
standard system include directory, the option is ignored to ensure
that the default search order for system directories and the
special treatment of system headers are not defeated .
At least on my cygwim they are in
/usr/include/sys and /usr/include/netinet
I also had the same problem.
I've resolved to review the compile options.
NG:
$ gcc -mno-cygwin -o echo_server.exe echo_server.c
echo_server.c:12:43: sys/socket.h: No such file or directory
echo_server.c:13:24: netinet/in.h: No such file or directory
OK:
$ gcc -o echo_server.exe echo_server.c
I had this problem for days with the library apophenia .
so make sure the libraries you've installed have first been configured with a simple command
./configure
once configured use the following commands to build , Install and check the libraries
all- Builds libraries
install- installs libraries
check-tests the libraries
doc- generate documentation via doxygen
Hope it helps. :)

Resources