#1 2021-11-22 13:10:07
- shako
- Member
- Registered: 2021-11-16
- Posts: 39
glib.h: no such file or directory
Hi everyone!
I am trying to compile the surf browser, which I downloaded directly from the suckless website. However, trying to install it via «sudo make clean install» gives me:
fatal error: glib.h: no such file or directory
How do I overcome this? I installed glib2 but it didn’t help. I also have the glib.h file in /usr/include/glib-2.0/, maybe it is not found by the surf Makefile since it is not in its «standard» location?
Thanks in advance
Last edited by shako (2021-11-22 13:12:14)
#2 2021-11-22 13:14:09
- V1del
- Forum Moderator
- Registered: 2012-10-16
- Posts: 18,296
Re: glib.h: no such file or directory
You’d normally run a make without install at first to actually do the build, and this is unlikely to be the entire output. Post the entire output. In any case, any particular reason you are trying to do this that way instead of using the AUR package: https://aur.archlinux.org/packages/surf ?
Last edited by V1del (2021-11-22 13:16:27)
#3 2021-11-22 13:19:12
- shako
- Member
- Registered: 2021-11-16
- Posts: 39
Re: glib.h: no such file or directory
Here is the output of make:
surf build options:
CC = c99
Package webkit2gtk-4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `webkit2gtk-4.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'webkit2gtk-4.0', required by 'virtual:world', not found
CFLAGS = -fPIC -DVERSION="2.1" -DGCR_API_SUBJECT_TO_CHANGE -DLIBPREFIX="/usr/local/lib" -DWEBEXTDIR="/usr/local/lib/surf" -D_DEFAULT_SOURCE -O1
Package webkit2gtk-4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `webkit2gtk-4.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'webkit2gtk-4.0', required by 'virtual:world', not found
Package 'webkit2gtk-web-extension-4.0', required by 'virtual:world', not found
WEBEXTCFLAGS = -fPIC -O1
LDFLAGS =
c99 -fPIC `pkg-config --cflags x11` `pkg-config --cflags gtk+-3.0 gcr-3 webkit2gtk-4.0` -DVERSION="2.1" -DGCR_API_SUBJECT_TO_CHANGE -DLIBPREFIX="/usr/local/lib" -DWEBEXTDIR="/usr/local/lib/surf" -D_DEFAULT_SOURCE -O1 -c surf.c
Package webkit2gtk-4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `webkit2gtk-4.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'webkit2gtk-4.0', required by 'virtual:world', not found
surf.c:9:10: fatal error: glib.h: No such file or directory
9 | #include <glib.h>
| ^~~~~~~~
compilation terminated.
make: *** [Makefile:31: surf.o] Error 1
Also, here is the output of «pkg-config —cflags —libs glib2.0»:
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0
I generally keep dwm, surf, slock and dmenu in a folder in my home directory just because I find it easier to patch them and sync them with my forks on GitHub. I find it convenient and «clean», but I am still a newbie so I might be wrong!
Last edited by shako (2021-11-22 13:44:41)
#4 2021-11-22 14:38:10
- seth
- Member
- Registered: 2012-09-03
- Posts: 35,310
Re: glib.h: no such file or directory
Sanity check:
pacman -Qikk glib2
stat /usr/include/glib-2.0/glib.h
Also
Package webkit2gtk-4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `webkit2gtk-4.0.pc’
to the PKG_CONFIG_PATH environment variable
Package ‘webkit2gtk-4.0’, required by ‘virtual:world’, not found
#5 2021-11-22 14:46:02
- arojas
- Developer
- From: Spain
- Registered: 2011-10-09
- Posts: 1,975
Re: glib.h: no such file or directory
shako wrote:
Package webkit2gtk-4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `webkit2gtk-4.0.pc’
to the PKG_CONFIG_PATH environment variable
Package ‘webkit2gtk-4.0’, required by ‘virtual:world’, not found
That’s the actual issue, it makes the whole
pkg-config --cflags gtk+-3.0 gcr-3 webkit2gtk-4.0
command fail. The output of
pkg-config --cflags --libs glib2.0
is irrelevant, that is nowhere used in the compiler command.
#6 2021-11-22 14:56:11
- shako
- Member
- Registered: 2021-11-16
- Posts: 39
Re: glib.h: no such file or directory
arojas wrote:
That’s the actual issue, it makes the whole
pkg-config --cflags gtk+-3.0 gcr-3 webkit2gtk-4.0command fail.
That was it! It was sufficient to install the webkit2gtk package to fix everything. Thanks a lot @arojas
Содержание
- Arch Linux
- #1 2021-11-22 13:10:07
- glib.h: no such file or directory
- #2 2021-11-22 13:14:09
- Re: glib.h: no such file or directory
- #3 2021-11-22 13:19:12
- Re: glib.h: no such file or directory
- Linux : Glib was not found
- 2 Answers 2
- Arch Linux
- #1 2012-09-21 16:01:27
- [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #2 2012-09-21 18:15:18
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #3 2012-09-21 18:27:36
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #4 2012-09-21 18:43:17
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #5 2012-09-21 18:47:49
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #6 2012-09-21 18:50:10
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #7 2012-09-21 19:24:26
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #8 2012-09-21 19:30:22
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #9 2012-09-21 19:46:24
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #10 2012-09-21 19:53:52
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #11 2012-09-21 20:07:17
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- #12 2012-09-21 20:13:41
- Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
- Installation Failed on Ubuntu 20, fatal error: glib-object.h: No such file or directory #3158
- Comments
- Possible install-time or require-time problem
- Are you using the latest version of sharp?
- Is this a problem with filesystem permissions?
- What is the complete output of running npm install —verbose sharp ?
- What is the output of running npx envinfo —binaries —system —npmPackages=sharp —npmGlobalPackages=sharp ?
- ‘glib.h’ file not found. #42930
- Comments
Arch Linux
You are not logged in.
#1 2021-11-22 13:10:07
glib.h: no such file or directory
I am trying to compile the surf browser, which I downloaded directly from the suckless website. However, trying to install it via «sudo make clean install» gives me:
How do I overcome this? I installed glib2 but it didn’t help. I also have the glib.h file in /usr/include/glib-2.0/, maybe it is not found by the surf Makefile since it is not in its «standard» location?
Thanks in advance
Last edited by shako (2021-11-22 13:12:14)
#2 2021-11-22 13:14:09
Re: glib.h: no such file or directory
You’d normally run a make without install at first to actually do the build, and this is unlikely to be the entire output. Post the entire output. In any case, any particular reason you are trying to do this that way instead of using the AUR package: https://aur.archlinux.org/packages/surf ?
Last edited by V1del (2021-11-22 13:16:27)
#3 2021-11-22 13:19:12
Re: glib.h: no such file or directory
Here is the output of make:
Also, here is the output of «pkg-config —cflags —libs glib2.0»:
any particular reason you are trying to do this that way instead of using the AUR package: https://aur.archlinux.org/packages/surf ?
I generally keep dwm, surf, slock and dmenu in a folder in my home directory just because I find it easier to patch them and sync them with my forks on GitHub. I find it convenient and «clean», but I am still a newbie so I might be wrong!
Last edited by shako (2021-11-22 13:44:41)
Источник
Linux : Glib was not found
I have a sample C project that use GLib Library. In that source code, it use :
When I compile, I found this error : «Glib.h : no such file or folder». I have google and find out that I should install this lib. So I use those command:
After that, I have checked and see already exist this header file in my system: usr/include/glib-2.0/glib.h But when I compile, I still meet problem above.
So I have change include line to :
So, after that, when I compile, I meet error inside glib.h header :
glib/galloca.h : no such file or directory. Because this error is inside system header file, I cannot modify anymore and still cannot compile.
I don’t know how to fix this. I have read some post, that they change makefile. But, because my project is compiled automatically by IDE (CodeBlock) and I cannot really write a makefile, so that method doesn’t suitable for me.
Please tell me a way to fix this.
2 Answers 2
There must be some problem with how you build. To compile C programs that use GLib, you need package libglib2.0-dev . You can either install it directly, or install libgtk2.0-dev , which pulls it in as a dependency. So you have the packages you need.
The correct way to compile a GLib program is to use -I with the path to the GLib include files. An example (from How to compile a helloworld GLib program? on askubuntu):
This should let you compile this program:
The errors you are getting indicate that you are not setting the include path ( -I ) correctly. How to do this depends on your build system/IDE.
In Code::Blocks, you must set the include path and the linker options in the appropriate configuration dialog. Run pkg-config —cflags —libs glib-2.0 , which will output something like
The directories after -I must be set in the compiler options of your project (should be under Project -> Build Options -> Search Directories), and the names after -l must be set in the linker settings. Another option is to create a Makefile, and let Code::Blocks use that.
Источник
Arch Linux
You are not logged in.
#1 2012-09-21 16:01:27
[SOLVED] Suddenly can’t compile program, glib.h can’t be found.
I’m in the process of refining the code of my first project and whilst doing so, making a basic Makefile so people using other distro’s can use it as well. I haven’t change any of the code, just removed some empty lines and fixed the outlining, so the error can’t be in the code itself (confirmed by using the old version that’s still on GitHub).
I have made a basic Makefile:
But when running make, I get the following error message:
I have declared the following in my program:
Why is this suddenly happening? It built fine before on 30-08-2012
Last edited by Unia (2012-09-21 20:13:56)
If you can’t sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. —Carlos Torres
#2 2012-09-21 18:15:18
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
I have done some more research and discovered that the glib.h file belongs to glib2. I do have the file (in /usr/include/glib-2.0/glib.h) and reinstalling glib2 didn’t help.
What is wrong with my system?
If you can’t sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. —Carlos Torres
#3 2012-09-21 18:27:36
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
I don’t know why it was working but now it isn’t. I am skeptical that you had «/usr/include/glib-2.0» in your default path of included files before it broke though. The «pkg-config» command helps with that.
#4 2012-09-21 18:43:17
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
I don’t know why it was working but now it isn’t. I am skeptical that you had «/usr/include/glib-2.0» in your default path of included files before it broke though. The «pkg-config» command helps with that.
Hm, that does seem to help. I then get a missing dep of gdk-pixbuf, which in turn requires gtk (yes, gtk 1!). I guess something is wrong with the notify part. I don’t know why though, it’s the same as it was.
Here’s the part of the PKGBUILD that I’m trying to make into a Makefile:
If you can’t sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. —Carlos Torres
#5 2012-09-21 18:47:49
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
Waaait a minute. Are you trying to convert a working PKGBUILD file into a Makefile?
If that’s the case, just copy what’s in the PKGBUILD file but replace any variables (anything inside «$<____>«).
#6 2012-09-21 18:50:10
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
Waaait a minute. Are you trying to convert a working PKGBUILD file into a Makefile?
If that’s the case, just copy what’s in the PKGBUILD file but replace any variables (anything inside «$<____>«).
But AFAIK, this: `pkg-config —cflags —libs libnotify` isn’t supposed to be in a Makefile. I thought I could do like this too: -lnotify.
If you can’t sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. —Carlos Torres
#7 2012-09-21 19:24:26
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
Oh, «pkg-config» is wonderful in a Makefile! For an example, here’s one of mine: http://qogreatness.git.sourceforge.net/ … 4d;hb=HEAD
«pkg-config» allows a compiler to find files even if they’re installed in non-standard locations. This way, you don’t have to «hard code» your Makefile.
#8 2012-09-21 19:30:22
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
Oh, «pkg-config» is wonderful in a Makefile! For an example, here’s one of mine: http://qogreatness.git.sourceforge.net/ … 4d;hb=HEAD
«pkg-config» allows a compiler to find files even if they’re installed in non-standard locations. This way, you don’t have to «hard code» your Makefile.
Okay. It indeed works when using pkg-config, but just for reference; what would be the correct way to do this, without using pkg-config?
If you can’t sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. —Carlos Torres
#9 2012-09-21 19:46:24
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
It indeed works when using pkg-config, but just for reference; what would be the correct way to do this, without using pkg-config?
Well, the «correct» way is to use pkg-config.
Do you understand what the «pkg-config» command is doing? Just copy it into a terminal window. For example:
In your Makefile, just delete the entire «pkg-config» command and replace it with the output from the terminal window and it will compile.
. But I still recommend using «pkg-config» in the Makefile!
#10 2012-09-21 19:53:52
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
So I could better use one pkg-config string, instead of specifying some statically (-lX11) and some with pkg-config?
(I just tried X11 with pkg-config but it couldn’t find it. Does this mean I have to define some static and some with pkg-config? EDIT: Also, iw doesn’t get found either. These come from -lX11 and -liw)
Is there some sort of README I can see which explains all this?
Last edited by Unia (2012-09-21 19:56:40)
If you can’t sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. —Carlos Torres
#11 2012-09-21 20:07:17
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
The Wikipedia article on pkg-config is fine. The simple rule is to use pkg-config if the library has a «.pc» file in «/usr/lib/pkgconfig», otherwise just add the library to your «gcc» command by hand. Even X11 (your example) can be used with pkg-build.
#12 2012-09-21 20:13:41
Re: [SOLVED] Suddenly can’t compile program, glib.h can’t be found.
The Wikipedia article on pkg-config is fine. The simple rule is to use pkg-config if the library has a «.pc» file in «/usr/lib/pkgconfig», otherwise just add the library to your «gcc» command by hand. Even X11 (your example) can be used with pkg-build.
Got it! I will read the article and think I’m good to go then. For now, the Makefiles I need are simple
If you can’t sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. —Carlos Torres
Источник
Installation Failed on Ubuntu 20, fatal error: glib-object.h: No such file or directory #3158
Possible install-time or require-time problem
- I have read the documentation relating to installation.
- I have ensured that the architecture and platform of Node.js used for npm install is the same as the architecture and platform of Node.js used at runtime.
Are you using the latest version of sharp?
- I am using the latest version of sharp as reported by npm view sharp dist-tags.latest .
If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.
Is this a problem with filesystem permissions?
No
If you are using npm v6 or earlier and installing as a root or sudo user, have you tried with the npm install —unsafe-perm flag?
Yes
If you are using npm v7 or later, does the user running npm install own the directory it is run in?
yes
If you are using the ignore-scripts feature of npm , have you tried with the npm install —ignore-scripts=false flag?
n/a
What is the complete output of running npm install —verbose sharp ?
What is the output of running npx envinfo —binaries —system —npmPackages=sharp —npmGlobalPackages=sharp ?
System:
OS: Linux 5.4 Ubuntu 20.04.4 LTS (Focal Fossa)
CPU: (2) x64 Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
Memory: 1.45 GB / 3.84 GB
Container: Yes
Shell: 5.0.17 — /bin/bash
Binaries:
Node: 17.3.0 —
/.nvm/versions/node/v17.3.0/bin/node
npm: 8.3.0 —
The text was updated successfully, but these errors were encountered:
Источник
‘glib.h’ file not found. #42930
- are reporting a bug others will be able to reproduce and not asking a question or requesting software. If you’re not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh. To get software added or changed in Homebrew please file a Pull Request
- have a problem with brew install (or upgrade , reinstall ) a single, Homebrew/homebrew-core formula (not cask) on macOS? If it’s a general brew problem please file this issue at Homebrew/brew: https://github.com/Homebrew/brew/issues/new/choose. If it’s a Linux problem please file this issue at https://github.com/Homebrew/linuxbrew-core/issues/new/choose. If it’s a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it’s a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
- ran brew update and can still reproduce the problem?
- ran brew doctor , fixed all issues and can still reproduce the problem?
- ran brew gist-logs
Whoops, it looks like you created an issue without filling out the checklist and providing all the needed information from one of the issue templates: https://github.com/Homebrew/homebrew-core/issues/new/choose
As we need all this information to help you we’re closing this issue. If you add the necessary information to this issue (don’t create a new or duplicate issue, please) and comment to let us know, a Homebrew maintainer will check it out when they get the chance. If it’s deemed to be a valid issue then this issue may be reopened.
Источник
Looks like the error is in linuxbrew/xorg/libxt:
==> make check
Last 15 lines from /home/thackl/.cache/Homebrew/Logs/libxt/03.make:
gcc-5 -DHAVE_CONFIG_H -I. -I.. -I../include -I../include -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=missing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -fno-strict-aliasing -I/home/thackl/.linuxbrew/Cellar/libice/1.0.9/include -I/home/thackl/.linuxbrew/Cellar/libsm/1.2.2/include -I/home/thackl/.linuxbrew/Cellar/libxau/1.0.8/include -I/home/thackl/.linuxbrew/Cellar/libxdmcp/1.1.2/include -I/home/thackl/.linuxbrew/Cellar/libxcb/1.13/include -I/home/thackl/.linuxbrew/Cellar/libx11/1.6.6/include -I/home/thackl/.linuxbrew/Cellar/xorgproto/2018.4/include -I/home/thackl/.linuxbrew/Cellar/glib/2.58.1/include/glib-2.0 -I/home/thackl/.linuxbrew/Cellar/glib/2.58.1/lib/glib-2.0/include -I/home/thackl/.linuxbrew/Cellar/pcre/8.42/include -g -O2 -c -o Event.o Event.c
Alloc.c:25:18: fatal error: glib.h: No such file or directory
compilation terminated.
https://gist.github.com/thackl/15b1d65065d99bce703b107d7f4913d1#file-install-L13-L17
I can not reproduce this.
Could you provide the full logs, with brew gist-logs libxt?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
@Martingales Could you please try
- Updating
Linuxbrewto the latest version and buildinglibxtagain? - If (1) does not work, try building
libxtwithout compile-time tests like so
brew install --without-test libxt
I was not able to reproduce the bug in a Linuxbrew container based on Ubuntu system (see the link below). I’ll try to see if it is reproducible in a different container.
https://gist.github.com/59575ae114d7791dc6878099ba5b4920
40-core 64-bit haswell
woo-hoo!
This bit is for @sjackman again:
At the moment I think there is a problem somewhere in Linuxbrew/brew. For some reason, Linuxbrew in CentOS detects /bin/sh as its SHELL (search for SHELL= in gist-logs) — it is /bin/bash in linuxbrew/linuxbrew. INSTALL file says about /bin/bash issue in Defining Variables section:
Unfortunately, this technique does not work for `CONFIG_SHELL’ due to
an Autoconf bug. Until the bug is fixed you can use this workaround:CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
but switching to bash alone does not help, and one has to replace @@HOMEBREW_CELLAR@@ with its actual values in all Makefiles like so (please ignore commented out lines):
diff --git a/Formula/libxt.rb b/Formula/libxt.rb index 2dc8ad0..3ecf063 100644 --- a/Formula/libxt.rb +++ b/Formula/libxt.rb @@ -47,7 +47,11 @@ class Libxt < Formula --enable-specs=#{build.with?("specs") ? "yes" : "no"} ] - system "./configure", *args + ENV["CONFIG_SHELL"] = "/bin/bash" + system "/bin/bash", "./configure", "CONFIG_SHELL=/bin/bash", *args + inreplace Dir["../**/Makefile"].each do |s| + s.gsub! "@@HOMEBREW_CELLAR@@", HOMEBREW_CELLAR.to_s + end system "make" system "make", "check" if build.with? "test" system "make", "install"
After the above fix libxt can be built in CentOS7: https://gist.github.com/65783ae5b649f0555cb8c8f7825eefa1
@Martingales, could you please try reproducing your error in a Linuxbrew Docker container that is closest to your actual environment? You can find those at https://github.com/Linuxbrew/docker
Quick note: to make libxt work, it is sufficient to do the inreplace block only (without the CONFIG_SHELL bit).
@iMichka, at least in CentOS 7, r requires perl at build time (because there is no system perl)
And pcre2 is an undeclared dependency with linkage
@thackl, could you please do two things:
- Add the following line:
depends_on "perl" => :build
below
depends_on "cairo" => :recommended
- and then try installing
ragain? Please post gist-logs here in case of a failure.
@@HOMEBREW_CELLAR@@ is found in the bottle tarball, and it should be changed to the value of brew --cellar when the bottle is poured. The string @@HOMEBREW_CELLAR@@ should not occur in any keg after it is poured. My best guess is that file is not installed. Ensure that file is installed with which file; file --version. If that’s the problem, then a better error message is warranted when file is not installed.
Your best guess is actually right — there is no file in our CentOS 7 image. There is no check for that in Linuxbrew at the moment.
I’ve encountered the same error message in an attempt to install tcl-tk. Here’s my brew gist-logs libxt full output, with the same glib.h error). But there may be something else happening, because I actually have both file and xargs (although on RHEL 6 these might be very old):
$ which file; file --version
/usr/bin/file
file-5.04
magic file from /etc/magic:/usr/share/misc/magic
$ which xargs; xargs --version
/usr/bin/xargs
xargs (GNU findutils) 4.4.2
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Built using GNU gnulib version e5573b1bad88bfabcda181b9e0125fb0c52b7d3b
Yeah, you hit the nail on the head.
$ xargs -0 file --no-dereference --print0 </dev/null
Usage: file [-bchikLNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
[-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...
file -C [-m magicfiles]
file [--help]
Is there a brewed version of file I can use to remedy this? I found xargs in findutils, installing that now.
The brewed version is in brew install file-formula. Brew may still prefer to use the copy in /usr/bin (which is a bug if the /usr/bin/ version is too old). You may need to use export HOMEBREW_NO_ENV_FILTERING=1 to work around that.
@sjackman Thanks for those suggestions. Unfortunately, updated xargs and file didn’t fix this error, even with HOMEBREW_NO_ENV_FILTERING=1.
$ export HOMEBREW_NO_ENV_FILTERING=1
$ which xargs
~/.linuxbrew/bin/xargs
$ which file
~/.linuxbrew/bin/file
$ brew install libxt
==> Installing libxt from linuxbrew/xorg
==> Downloading https://ftp.x.org/pub/individual/lib/libXt-1.1.5.tar.bz2
Already downloaded: /home/friesner/jms2435/.cache/Homebrew/downloads/21e8533dbc80c2b2d7e1ec38692b719246c04423b5ce75fd88ec8c23868463a7--libXt-1.1.5.tar.bz2
==> Downloading https://raw.githubusercontent.com/Linuxbrew/homebrew-xorg/master/Patches/patch_configure.diff
Already downloaded: /home/friesner/jms2435/.cache/Homebrew/downloads/5f01ae626182ebedababa1fa15c7f0dde334169ab0f5e985758de424f6203d7e--patch_configure.diff
==> Patching
==> Applying patch_configure.diff
patching file configure
Hunk #1 succeeded at 18224 (offset -423 lines).
==> ./configure --prefix=/home/friesner/jms2435/.linuxbrew/Cellar/libxt/1.1.5 --sysconfdir=/home/friesner/jms2435/.linuxbrew/etc --localstatedir=/home/friesner/jms2435/.linuxbrew
==> make
==> make check
Last 15 lines from /home/friesner/jms2435/.cache/Homebrew/Logs/libxt/03.make:
gcc-5 -DHAVE_CONFIG_H -I. -I.. -I../include -I../include -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=missing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -fno-strict-aliasing -I/home/friesner/jms2435/.linuxbrew/Cellar/libice/1.0.9/include -I/home/friesner/jms2435/.linuxbrew/Cellar/libsm/1.2.2/include -I/home/friesner/jms2435/.linuxbrew/Cellar/libxau/1.0.8/include -I/home/friesner/jms2435/.linuxbrew/Cellar/libxdmcp/1.1.2/include -I/home/friesner/jms2435/.linuxbrew/Cellar/libxcb/1.13/include -I/home/friesner/jms2435/.linuxbrew/Cellar/libx11/1.6.6/include -I/home/friesner/jms2435/.linuxbrew/Cellar/xorgproto/2018.4/include -I/home/friesner/jms2435/.linuxbrew/Cellar/glib/2.58.2/include/glib-2.0 -I/home/friesner/jms2435/.linuxbrew/Cellar/glib/2.58.2/lib/glib-2.0/include -I/home/friesner/jms2435/.linuxbrew/Cellar/pcre/8.42/include -g -O2 -c -o Event.o Event.c
Event.c:25:18: fatal error: glib.h: No such file or directory
Converters.c:25:18: fatal error: glib.h: No such file or directory
compilation terminated.
compilation terminated.
make[2]: *** [Makefile:628: Event.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile:628: Converters.o] Error 1
Alloc.c:25:18: fatal error: glib.h: No such file or directory
compilation terminated.
make[2]: *** [Makefile:628: Alloc.o] Error 1
make[2]: Leaving directory '/home/friesner/jms2435/tmp/libxt-20190117-24175-nu4j2d/libXt-1.1.5/test'
make[1]: *** [Makefile:910: check-am] Error 2
make[1]: Leaving directory '/home/friesner/jms2435/tmp/libxt-20190117-24175-nu4j2d/libXt-1.1.5/test'
make: *** [Makefile:515: check-recursive] Error 1
READ THIS: https://github.com/Linuxbrew/brew/wiki/troubleshooting
Please do not report this issue to Homebrew/brew or Homebrew/core,
which support macOS only."
Try…
cat $(brew --prefix glib)/lib/pkgconfig/glib-2.0.pc HOMEBREW_NO_ENV_FILTERING=1 brew reinstall glib cat $(brew --prefix glib)/lib/pkgconfig/glib-2.0.pc HOMEBREW_NO_ENV_FILTERING=1 brew install libxt
@jaredsampson, to use file installed by Homebrew, you can use a hack similar to what I had to employ for CentOS 5 instructions:
- Install
file-formula - Create a symbolic link to
filein/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/superfor it to be used during the installation in super environment.
I have the same error while installing r on a CentOS 7, I tried all the above solutions and none of them worked. At the end, I have to force installing a bottle.
brew install libxt --force-bottle
From libxt
option "without-test", "Skip compile-time tests" option "with-glib", "Build with glib (for unit testing)" depends_on "glib" => [:build, :optional] … system "make", "check" if build.with? "test"
Unit tests are enabled by default. From the comment it, as though the unit tests require glib. The dependency on glib however is not enabled by default.
Could someone please try this patch?
diff --git a/Formula/libxt.rb b/Formula/libxt.rb index 2dc8ad0..3317b11 100644 --- a/Formula/libxt.rb +++ b/Formula/libxt.rb @@ -13,9 +13,8 @@ class Libxt < Formula option "without-test", "Skip compile-time tests" option "with-static", "Build static libraries (not recommended)" option "with-specs", "Build specifications" - option "with-glib", "Build with glib (for unit testing)" - depends_on "glib" => [:build, :optional] + depends_on "glib" => [:build, :recommended] depends_on "pkg-config" => :build depends_on "linuxbrew/xorg/libice" depends_on "linuxbrew/xorg/libsm" @@ -49,7 +48,7 @@ class Libxt < Formula system "./configure", *args system "make" - system "make", "check" if build.with? "test" + system "make", "check" if build.with?("glib") && build.with?("test") system "make", "install" end end
Alternatively, make check could be disabled by default.
In Homebrew/core I see only 100 occurrences of "make", "check". Perhaps they’re moving away from running the unit tests.
sjackman
changed the title
r: fatal error: glib.h: No such file or directory
libxt: fatal error: glib.h: No such file or directory
Feb 21, 2019
sjackman
transferred this issue from Homebrew/linuxbrew-core
Feb 21, 2019
I’ve opened PR #461 to hopefully address this issue.
@maxim-belkin @sjackman After the homebrew 2.0 migration, and I suspect due to the fix in #461, yes, I have been able to install libxt successfully with a simple brew install. Thanks again!
Thanks for following up, Jared!
Apropos of nothing, a colleague of mine is named Jared Simpson https://github.com/jts
- Forum
- The Ubuntu Forum Community
- Ubuntu Official Flavours Support
- General Help
- GLIB in C programming: No such file or directory
-
GLIB in C programming: No such file or directory
I a have C file where the
where when I execute it via terminal:
I get the error
fatal error: glib-object.h: No such file or directoryI also triedCode:
gcc -O2 $(pkg-config --cflags glib-2.0) -o test test.c $(pkg-config --libs glib-2.0)
The headers of the C file
Code:
#include <stdlib.h> #include <stdio.h> #include <glib-object.h> #include <json-glib/json-glib.h>
-
Re: GLIB in C programming: No such file or directory
Do you have the developers package for glib 2.0 (libglib2.0-dev) installed ? Just having the library does not give you the headers, they are in the *-dev packages.
Also, ‘pkg-config —libs’ outputs the ‘-l’ option for the linker-part of the gcc toolchain, it doesn’t produce the ‘-I’ option for the preprocessor which gives paths for the headers. You probably want ‘pkg-config —cflags —libs glib-2.0’ which does both.Holger
-
Re: GLIB in C programming: No such file or directory
How do I install the developers package for glib 2.0?
-
Re: GLIB in C programming: No such file or directory
Code:
sudo apt install libglib2.0-dev
in a terminal or with synaptic.
Holger
-
Re: GLIB in C programming: No such file or directory
After I installed:
Code:
sudo apt install libglib2.0-dev
And I execute
The first error:
fatal error: glib-object.h: No such file or directory
Changes in to:
fatal error: json-glib/json-glib.h: No such file or directory
-
Re: GLIB in C programming: No such file or directory
Did you install json-glib dev package?
-
Re: GLIB in C programming: No such file or directory
According to https://packages.ubuntu.com json-glib.h is in the package ‘libjson-glib-dev’.
Holger
-
Re: GLIB in C programming: No such file or directory
After I installed
Code:
sudo apt-get install libjson-glib-dev
When I try
gcc test.c -o testThe first error came back:
fatal error: glib-object.h: No such file or directoryWhen I tryCode:
gcc -O2 $(pkg-config --cflags glib-2.0) -o test test.c $(pkg-config --libs glib-2.0)
Changes in to:
fatal error: json-glib/json-glib.h: No such file or directoryLast edited by jenniferruurs; September 19th, 2019 at 08:49 AM.
-
Re: GLIB in C programming: No such file or directory
Originally Posted by jenniferruurs
After I installed
Code:
sudo apt-get install libjson-glib-dev
When I try
gcc test.c -o testThe first error came back:
fatal error: glib-object.h: No such file or directoryWhen I tryCode:
gcc -O2 $(pkg-config --cflags glib-2.0) -o test test.c $(pkg-config --libs glib-2.0)
Changes in to:
fatal error: json-glib/json-glib.h: No such file or directoryYou need to tell the compiler where to find the necessary from your newly added package.
Code:
gcc -O2 $(pkg-config --cflags glib-2.0 json-glib-1.0) -o test test.c $(pkg-config --libs glib-2.0 json-glib-1.0)
-
Re: GLIB in C programming: No such file or directory
Thank you this did worked!
Is there a way how I can added these files to gcc so that
Would also work?
Or isn’t that possible?
Bookmarks
Bookmarks

Posting Permissions
| View previous topic :: View next topic | |||||||||
| Author | Message | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| KatsuoRyuu n00b
Joined: 08 Nov 2016 |
|
||||||||
| Back to top |
|
||||||||
| KatsuoRyuu n00b
Joined: 08 Nov 2016 |
|
||||||||
| Back to top |
|
||||||||
| KatsuoRyuu n00b
Joined: 08 Nov 2016 |
|
||||||||
| Back to top |
|
||||||||
| Hu Moderator
Joined: 06 Mar 2007 |
|
||||||||
| Back to top |
|
||||||||
| KatsuoRyuu n00b
Joined: 08 Nov 2016 |
|
||||||||
| Back to top |
|
||||||||
| Hu Moderator
Joined: 06 Mar 2007 |
|
||||||||
| Back to top |
|
||||||||
| KatsuoRyuu n00b
Joined: 08 Nov 2016 |
|
||||||||
| Back to top |
|
||||||||
| KatsuoRyuu n00b
Joined: 08 Nov 2016 |
|
||||||||
| Back to top |
|
||||||||
| Hu Moderator
Joined: 06 Mar 2007 |
|
||||||||
| Back to top |
|
||||||||
| KatsuoRyuu n00b
Joined: 08 Nov 2016 |
|
||||||||
| Back to top |
|
||||||||
|
|
You cannot post new topics in this forum |
- Печать
Страницы: [1] Вниз
Тема: #include <glib.h> почемуто не подключаэтса билд есенс есть а штоже делать? (Прочитано 5635 раз)
0 Пользователей и 1 Гость просматривают эту тему.

merl

ziv
Думаю, что нужно установить libglib-dev.

merl
щ попробуэм …. 

merl
почти получилось 
и щяс вот такая ситуацыя….. я пока новичьок в линуксе и темболиэ в програмировании может хто подскажыт как ево заставить работать
root@akva:/home/andriy/Desktop# locate glib.h
/usr/include/glib-1.2/glib.h
/usr/share/doc/libglib1.2-dev/glib.html
root@akva:/home/andriy/Desktop# g++ b.c -o b
b.c:4:18: error: glib.h: No such file or directory
b.c: In function ‘int main()’:
b.c:261: error: ‘guint32’ was not declared in this scope
b.c:261: error: ‘g_rand_new_with_seed’ was not declared in this scope

S.Tokarev
g++ -c b.c -o b -I/usr/include/glib-1.2
Или лучьше в самом файле b.c
#include <glib-1.2/glib.h>
« Последнее редактирование: 15 Июля 2008, 21:29:50 от S.Tokarev »

Yurror
Есть вариант из учебника по glib
g++ -c b.c -o b.o `pkg-config —cflags glib-2.0`
Естественно это только компиляция. для линковки потребуется что-то вроде
g++ -o b b.o `pkg-config —libs glib-2.0`
P.S. конечно 2.0 надо заменить на вашу версию

merl
ну всьо я полностью запутался файл который я щя компилю содержит только фактичиски
#include <glib.h>
когда я прошу систему найти glib она ево видит, когда в сишном файле или при компиляции я прописую к нему путь
root@akva:/home/andriy/Desktop# g++ b.c -o b.o -I/usr/include/glib-1.2
или в файле
#include <glib-1.2/glib.h>
получаю вот штото такоэ непонятное:
root@akva:/home/andriy/Desktop# g++ b.c -o b.o -I/usr/include/glib-1.2
У файлі включеному з b.c:4:
/usr/include/glib-1.2/glib.h:66:24: error: glibconfig.h: No such file or directory
In file included from b.c:4:
/usr/include/glib-1.2/glib.h:502: error: ‘gint32’ does not name a type
/usr/include/glib-1.2/glib.h:503: error: ‘guint32’ does not name a type
/usr/include/glib-1.2/glib.h:504: error: ‘guint32’ does not name a type
/usr/include/glib-1.2/glib.h:505: error: ‘gint32’ does not name a type
/usr/include/glib-1.2/glib.h:769: error: typedef ‘GDataForeachFunc’ is initialised (use __typeof__ instead)
/usr/include/glib-1.2/glib.h:769: error: ‘GQuark’ was not declared in this scope
/usr/include/glib-1.2/glib.h:770: error: expected primary-expression before ‘data’
/usr/include/glib-1.2/glib.h:771: error: expected primary-expression before ‘user_data’
/usr/include/glib-1.2/glib.h:840: error: ISO C++ forbids declaration of ‘guint8’ with no type
/usr/include/glib-1.2/glib.h:840: error: expected ‘;’ before ‘*’ token
/usr/include/glib-1.2/glib.h:1573: warning: ‘g_bit_nth_lsf’ initialised and declared ‘extern’
/usr/include/glib-1.2/glib.h:1573: error: ‘guint32’ was not declared in this scope
/usr/include/glib-1.2/glib.h:1574: error: expected primary-expression before ‘nth_bit’
/usr/include/glib-1.2/glib.h:1574: error: initializer expression list treated as compound expression
/usr/include/glib-1.2/glib.h:1591: warning: ‘g_bit_nth_msf’ initialised and declared ‘extern’
/usr/include/glib-1.2/glib.h:1591: error: ‘guint32’ was not declared in this scope
/usr/include/glib-1.2/glib.h:1592: error: expected primary-expression before ‘nth_bit’
/usr/include/glib-1.2/glib.h:1592: error: initializer expression list treated as compound expression
/usr/include/glib-1.2/glib.h:1737: error: expected ‘,’ or ‘…’ before ‘*’ token
/usr/include/glib-1.2/glib.h:1738: error: ISO C++ forbids declaration of ‘guint8’ with no type
/usr/include/glib-1.2/glib.h:1740: error: expected ‘,’ or ‘…’ before ‘*’ token
/usr/include/glib-1.2/glib.h:1741: error: ISO C++ forbids declaration of ‘guint8’ with no type
/usr/include/glib-1.2/glib.h:1773: error: ‘GQuark’ does not name a type
/usr/include/glib-1.2/glib.h:1774: error: ‘GQuark’ does not name a type
/usr/include/glib-1.2/glib.h:1775: error: ‘GQuark’ does not name a type
/usr/include/glib-1.2/glib.h:1776: error: ‘GQuark’ was not declared in this scope
/usr/include/glib-1.2/glib.h:1785: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1787: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1791: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1793: error: ‘GDataForeachFunc’ has not been declared
/usr/include/glib-1.2/glib.h:1816: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1818: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1822: error: ‘GQuark’ has not been declared
/usr/include/glib-1.2/glib.h:1824: error: ‘GDataForeachFunc’ has not been declared
/usr/include/glib-1.2/glib.h:2094: error: ‘guint16’ does not name a type
/usr/include/glib-1.2/glib.h:2095: error: ‘guint8’ does not name a type
/usr/include/glib-1.2/glib.h:2168: error: ‘GDateDay’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2169: error: expected primary-expression before ‘month’
/usr/include/glib-1.2/glib.h:2170: error: ‘GDateYear’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2170: error: initializer expression list treated as compound expression
/usr/include/glib-1.2/glib.h:2171: error: ‘guint32’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2180: error: ‘GDateDay’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2182: error: ‘GDateYear’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2184: error: ‘guint32’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2185: error: ‘GDateDay’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2186: error: expected primary-expression before ‘month’
/usr/include/glib-1.2/glib.h:2187: error: ‘GDateYear’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2187: error: initializer expression list treated as compound expression
/usr/include/glib-1.2/glib.h:2191: error: ‘GDateYear’ does not name a type
/usr/include/glib-1.2/glib.h:2192: error: ‘GDateDay’ does not name a type
/usr/include/glib-1.2/glib.h:2193: error: ‘guint32’ does not name a type
/usr/include/glib-1.2/glib.h:2219: error: ‘GTime’ has not been declared
/usr/include/glib-1.2/glib.h:2223: error: ‘GDateDay’ has not been declared
/usr/include/glib-1.2/glib.h:2225: error: ‘GDateYear’ has not been declared
/usr/include/glib-1.2/glib.h:2227: error: ‘GDateDay’ has not been declared
/usr/include/glib-1.2/glib.h:2229: error: ‘GDateYear’ has not been declared
/usr/include/glib-1.2/glib.h:2231: error: ‘guint32’ has not been declared
/usr/include/glib-1.2/glib.h:2252: error: ‘GDateYear’ was not declared in this scope
/usr/include/glib-1.2/glib.h:2253: error: ‘guint8’ does not name a type
/usr/include/glib-1.2/glib.h:2255: error: ‘guint8’ does not name a type
/usr/include/glib-1.2/glib.h:2256: error: ‘guint8’ does not name a type
/usr/include/glib-1.2/glib.h:2267: error: ‘gsize’ does not name a type
/usr/include/glib-1.2/glib.h:2354: error: expected `}’ before ‘GLIB_SYSDEF_POLLIN’
/usr/include/glib-1.2/glib.h:2355: error: expected initializer before ‘GLIB_SYSDEF_POLLOUT’
/usr/include/glib-1.2/glib.h:2360: error: expected constructor, destructor, or type conversion before ‘;’ token
/usr/include/glib-1.2/glib.h:2370: error: ‘GIOCondition’ has not been declared
/usr/include/glib-1.2/glib.h:2388: error: ‘GIOCondition’ has not been declared
/usr/include/glib-1.2/glib.h:2412: error: ‘GIOCondition’ has not been declared
/usr/include/glib-1.2/glib.h:2417: error: ‘GIOCondition’ has not been declared
/usr/include/glib-1.2/glib.h:2823: error: expected declaration before ‘}’ token
или когда я делаю вот так то ето меня воще выбивает из понимания слова «почему»
root@akva:/home/andriy/Desktop# g++ -c b.c -o b.o ‘pkg-config —cflags glib1-2’
g++: pkg-config —cflags glib1-2: No such file or directory
b.c:4:18: error: glib.h: No such file or directory








Kwah
Сдаётся мне, что библиотека, которую ты поставил старовата.
$ aptitude search libglib | grep dev
v libglib-dev —
p libglib-java-dev — GLib bindings for Java (development files)
p libglib1.2-dev — The GLib library of C routines (developmen
p libglib2.0-dev — Development files for the GLib library
p libglibmm-2.4-dev — C++ wrapper for the GLib toolkit (developm
А под рутом сидеть — это теперь такой экстремальный вид спорта?

S.Tokarev
или когда я делаю вот так то ето меня воще выбивает из понимания слова «почему»
root@akva:/home/andriy/Desktop# g++ -c b.c -o b.o ‘pkg-config —cflags glib1-2’
Апострофы не в ту сторону. Надо не ‘ , а `
Но правильно будет
g++ -c b.c -o b.o `glib-config —cflags`
g++ b.o -o b.exe `glib-config —libs`
« Последнее редактирование: 16 Июля 2008, 13:56:55 от S.Tokarev »

Yurror
Дожились… люди «копипастить» не умеют.
Скоро реально на прилавках появятся книжки типа «Клавиатура для идиотов» или «Мышка для даунов»
нужный апостроф находится на букве Ё, прямо под клавишей Esc, слева от 1, над клавишей Tab. Набирается легко и просто без всяких шифтов и прочей лабуды в английской раскладке
- Печать
Страницы: [1] Вверх







