Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Fichier d'en tête C] fsnotify.h absent (Résolu)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
jaypeche
Apprentice
Apprentice


Joined: 13 Jun 2007
Posts: 161
Location: France

PostPosted: Wed Dec 17, 2014 6:15 pm    Post subject: [Fichier d'en tête C] fsnotify.h absent (Résolu) Reply with quote

Bonjour a tous,

J'ai besoin du fichier d'en tête fsnotify.h pour compiler une application :

Code:
 /*
* This program (which doesn't works as expected because of inotify), is a sample use of inotify,
* which get's notifications from a recursive directory
*/
#define __KERNEL_STRICT_NAMES
#define _GNU_SOURCE
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
#include <linux/unistd.h>
#include <linux/fsnotify.h>
#include <linux/inotify.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#ifndef O_DIRECTORY
#define O_DIRECTORY 0200000
#endif


Code:
dbox2 inotify # gcc -Wall inotify_recursive.c
inotify_recursive.c:14:28: erreur fatale: linux/fsnotify.h : Aucun fichier ou dossier de ce type
 #include <linux/fsnotify.h>
                            ^
compilation terminée.


Ce fichier est présent dans les sources de mon noyau sous /usr/src/include/linux/fsnotify.h. Le module fsnotify est compilé en dur :

Code:
dbox2 linux # cat /etc/kernels/kernel-config-x86_64-3.16.5-gentoo | grep -i fsnotify
CONFIG_FSNOTIFY=y


Je ne comprends pas pourquoi je ne dispose pas de ce fichier d'en tête sous /usr/include/linux alors que celui-çi est compilé.

Si quelqu'un peut m'expliquer le "pourquoi" ce serait vraiment sympa.

Par avance merçi.
_________________
:-) Gentoo Linux Rullez !


Last edited by jaypeche on Thu Dec 18, 2014 1:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
xaviermiller
Administrator
Administrator


Joined: 23 Jul 2004
Posts: 8003
Location: ~Brussels - Belgique

PostPosted: Wed Dec 17, 2014 10:08 pm    Post subject: Reply with quote

/usr/include/linux provient du paquet linux-headers ; et en effet, je ne le retrouve pas non plus dans mon linux-headers-3.17-r1
Mon noyau est le 3.18

Quel est le tien ?
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
jaypeche
Apprentice
Apprentice


Joined: 13 Jun 2007
Posts: 161
Location: France

PostPosted: Wed Dec 17, 2014 10:37 pm    Post subject: Reply with quote

Bonsoir,

J'utilise le dernier kernel stable 3.16.5-gentoo, et j'ai bien linux-headers-3.16 d'installé.

fsnotify.h est présent dans les sources du kernel mais pas sous /usr/include/linux.

Je me demande si il ne faut pas ajouté une option lors de la compil kernel pour disposer de ce genre de fichier d'en tête.


Code:
dbox2 clamav-realtime-0.0.3 # equery b fsnotify.h
 * Searching for fsnotify.h ...
sys-kernel/gentoo-sources-3.16.5 (/usr/src/linux-3.16.5-gentoo/fs/notify/fsnotify.h)
sys-kernel/gentoo-sources-3.16.5 (/usr/src/linux-3.16.5-gentoo/include/linux/fsnotify.h)


Code:
Portage 2.2.14 (python 3.3.5-final-0, default/linux/amd64/13.0/desktop/gnome/systemd, gcc-4.8.3, glibc-2.19-r1, 3.16.5-gentoo x86_64)
=================================================================
System uname: Linux-3.16.5-gentoo-x86_64-Intel-R-_Pentium-R-_4_CPU_3.00GHz-with-gentoo-2.2
KiB Mem: 1537056 total, 253836 free
KiB Swap: 3156768 total, 2305192 free
Timestamp of tree: Wed, 17 Dec 2014 01:45:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash: 4.2_p53
dev-java/java-config: 2.2.0
dev-lang/perl: 5.18.2-r2
dev-lang/python: 2.7.7, 3.3.5-r1, 3.4.1
dev-util/cmake: 2.8.12.2-r1
dev-util/pkgconfig: 0.28-r1
sys-apps/baselayout: 2.2
sys-apps/openrc: 0.12.4
sys-apps/sandbox: 2.6-r1
sys-devel/autoconf: 2.13, 2.69
sys-devel/automake: 1.11.6, 1.12.6, 1.13.4
sys-devel/binutils: 2.24-r3
sys-devel/gcc: 4.7.3-r1, 4.8.3
sys-devel/gcc-config: 1.7.3
sys-devel/libtool: 2.4.2-r1
sys-devel/make: 4.0-r1
sys-kernel/linux-headers: 3.16 (virtual/os-headers)
sys-libs/glibc: 2.19-r1
Repositories: gentoo x-portage
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* skype-eula"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=nocona -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-march=nocona -O2 -pipe -fomit-frame-pointer"
GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org http://mirror.switch.ch/ftp/mirror/gentoo/ http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="fr_FR.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cli colord cracklib crypt cups cxx dbus dri dts dvb dvd dvdr eds emboss encode evo exif fam firefox flac fortran gdbm gif glamor gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk iconv introspection ipv6 jpeg lcms ldap libnotify libsecret mad mmx mng modules mp3 mp4 mpeg mtp multilib nautilus ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qt3support qt4 readline sdl session socialweb spell sse sse2 ssl startup-notification svg systemd tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xcb xinerama xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="via82xx" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DVB_CARDS="usb-dib0700 b2c2-flexcop-pci" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="fr" LIRC_DEVICES="serial" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON


@Xavier: je pense que tu peux trouver ce fichier sous /usr/src/KERNEL/include/linux.
_________________
:-) Gentoo Linux Rullez !
Back to top
View user's profile Send private message
xaviermiller
Administrator
Administrator


Joined: 23 Jul 2004
Posts: 8003
Location: ~Brussels - Belgique

PostPosted: Thu Dec 18, 2014 8:13 am    Post subject: Reply with quote

Certes, mais il n'est pas dans /usr/include
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
boozo
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 3193

PostPosted: Thu Dec 18, 2014 8:21 am    Post subject: Reply with quote

'alute

doc/Documentation/kbuild/headers_install.txt wrote:
#make headers_install (ou variantes en fonction ?)

n.b. untested :wink:
_________________
" Un psychotique, c'est quelqu'un qui croit dur comme fer que 2 et 2 font 5, et qui en est pleinement satisfait.
Un névrosé, c'est quelqu'un qui sait pertinemment que 2 et 2 font 4, et ça le rend malade ! "
Back to top
View user's profile Send private message
xaviermiller
Administrator
Administrator


Joined: 23 Jul 2004
Posts: 8003
Location: ~Brussels - Belgique

PostPosted: Thu Dec 18, 2014 8:44 am    Post subject: Reply with quote

@bozoo, ça ne risque pas d'entrer en conflit avec linux-headers ?
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
boozo
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 3193

PostPosted: Thu Dec 18, 2014 9:07 am    Post subject: Reply with quote

Sais pas... c'est pourquoi j'ai mis des réserves mais c'est ce qui semble préconisé non ? ou j'ai p'tèt mal compris l'besoin

// Pis les "vrais" gentooistes n'ont pas peur de tester non ? :mrgreen:
_________________
" Un psychotique, c'est quelqu'un qui croit dur comme fer que 2 et 2 font 5, et qui en est pleinement satisfait.
Un névrosé, c'est quelqu'un qui sait pertinemment que 2 et 2 font 4, et ça le rend malade ! "
Back to top
View user's profile Send private message
xaviermiller
Administrator
Administrator


Joined: 23 Jul 2004
Posts: 8003
Location: ~Brussels - Belgique

PostPosted: Thu Dec 18, 2014 9:36 am    Post subject: Reply with quote

Que veux-tu faire au juste ? Si c'est un module de kernel, ne dois pas tu simplement définir -I /usr/src/linux ?
Va jeter aux ebuilds de modules, comme vmware-modules, acerhdf, nvidia, ...
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
jaypeche
Apprentice
Apprentice


Joined: 13 Jun 2007
Posts: 161
Location: France

PostPosted: Thu Dec 18, 2014 11:49 am    Post subject: Reply with quote

Tout d'abord; Merçi a vous deux d'essayer de trouver le pourquoi du comment ?

@boozo: Je pense que ta solution est peut etre envisageable bien que j'ai un serieux doute sur le comment faire, je pense que ça se passe à la compilation des modules kernels.

@Xavier: En fait pour mon application, je souhaitais utilisé du code déja ecrit et fonctionnel et l'adapter a mes besoins, la directive #include <linux/fsnotify.h> est nécessaire.

Il ne s'agit pas de compiler un module kernel; mais de compiler du code exploitant fsnotify.

Je veux ecrire une application qui soit simple et fonctionnelle, pas de fioritures !
Si l'utilisateur lambda doit recompiler son kernel pour utiliser mon application ce n'est franchement pas une bonne idée. Je vais donc me tourner vers un autre code pour monitorer le FS.

Quote:
Si c'est un module de kernel, ne dois pas tu simplement définir -I /usr/src/linux ?


:?: Ca peut etre une solution, question bête je dois passer cette option à la compilation ?
_________________
:-) Gentoo Linux Rullez !


Last edited by jaypeche on Thu Dec 18, 2014 11:52 am; edited 1 time in total
Back to top
View user's profile Send private message
xaviermiller
Administrator
Administrator


Joined: 23 Jul 2004
Posts: 8003
Location: ~Brussels - Belgique

PostPosted: Thu Dec 18, 2014 11:51 am    Post subject: Reply with quote

oui, c'est une option à ajouter lors de l'appel de $(CC) dans ton makefile
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
jaypeche
Apprentice
Apprentice


Joined: 13 Jun 2007
Posts: 161
Location: France

PostPosted: Thu Dec 18, 2014 12:12 pm    Post subject: Reply with quote

Merçi Xavier, j'ai bien essayer de compiler en indiquant -I /usr/src/linux mais la compilation échoue bien que le compilateur le prenne en compte. C etait effectivement la solution !

Mais la je crois que c'est au niveau du code qu'il faut chercher, je vais creuser un peu plus :

Code:
dbox2 inotify # gcc -I /usr/src/linux/include/ inotify_recursive.c -o inotify-rec
In file included from /usr/src/linux/include/uapi/linux/capability.h:16:0,
                 from /usr/src/linux/include/linux/capability.h:15,
                 from /usr/src/linux/include/linux/sched.h:15,
                 from /usr/src/linux/include/linux/audit.h:26,
                 from /usr/src/linux/include/linux/fsnotify.h:15,
                 from inotify_recursive.c:14:
/usr/src/linux/include/linux/types.h:14:26: erreur: conflicting types for ‘fd_set’
 typedef __kernel_fd_set  fd_set;
                          ^
In file included from /usr/include/sys/types.h:219:0,
                 from /usr/include/stdlib.h:314,
                 from inotify_recursive.c:10:
/usr/include/sys/select.h:75:5: note: previous declaration of ‘fd_set’ was here
   } fd_set;
     ^
In file included from /usr/src/linux/include/uapi/linux/capability.h:16:0,
                 from /usr/src/linux/include/linux/capability.h:15,
                 from /usr/src/linux/include/linux/sched.h:15,
                 from /usr/src/linux/include/linux/audit.h:26,
                 from /usr/src/linux/include/linux/fsnotify.h:15,
                 from inotify_recursive.c:14:
/usr/src/linux/include/linux/types.h:15:25: erreur: conflicting types for ‘dev_t’
 typedef __kernel_dev_t  dev_t;
                         ^
In file included from /usr/include/stdlib.h:314:0,
                 from inotify_recursive.c:10:
/usr/include/sys/types.h:60:17: note: previous declaration of ‘dev_t’ was here
 typedef __dev_t dev_t;
                 ^
In file included from /usr/src/linux/include/uapi/linux/capability.h:16:0,
                 from /usr/src/linux/include/linux/capability.h:15,
                 from /usr/src/linux/include/linux/sched.h:15,
                 from /usr/src/linux/include/linux/audit.h:26,
                 from /usr/src/linux/include/linux/fsnotify.h:15,
                 from inotify_recursive.c:14:
/usr/src/linux/include/linux/types.h:19:17: erreur: conflicting types for ‘nlink_t’
 typedef __u32   nlink_t;
                 ^
In file included from /usr/include/stdlib.h:314:0,
                 from inotify_recursive.c:10:
/usr/include/sys/types.h:75:19: note: previous declaration of ‘nlink_t’ was here
 typedef __nlink_t nlink_t;
                   ^
In file included from /usr/src/linux/include/uapi/linux/capability.h:16:0,
                 from /usr/src/linux/include/linux/capability.h:15,
                 from /usr/src/linux/include/linux/sched.h:15,
                 from /usr/src/linux/include/linux/audit.h:26,
                 from /usr/src/linux/include/linux/fsnotify.h:15,
                 from inotify_recursive.c:14:
/usr/src/linux/include/linux/types.h:25:26: erreur: conflicting types for ‘timer_t’
 typedef __kernel_timer_t timer_t;
                          ^
In file included from inotify_recursive.c:8:0:
/usr/include/time.h:103:19: note: previous declaration of ‘timer_t’ was here
 typedef __timer_t timer_t;
                   ^
In file included from /usr/src/linux/include/uapi/linux/capability.h:16:0,
                 from /usr/src/linux/include/linux/capability.h:15,
                 from /usr/src/linux/include/linux/sched.h:15,
                 from /usr/src/linux/include/linux/audit.h:26,
                 from /usr/src/linux/include/linux/fsnotify.h:15,
                 from inotify_recursive.c:14:
/usr/src/linux/include/linux/types.h:45:26: erreur: conflicting types for ‘loff_t’
 typedef __kernel_loff_t  loff_t;
                          ^
In file included from /usr/include/stdlib.h:314:0,
                 from inotify_recursive.c:10:
/usr/include/sys/types.h:44:18: note: previous declaration of ‘loff_t’ was here
 typedef __loff_t loff_t;
                  ^
In file included from /usr/src/linux/include/uapi/linux/capability.h:16:0,
                 from /usr/src/linux/include/linux/capability.h:15,
                 from /usr/src/linux/include/linux/sched.h:15,
                 from /usr/src/linux/include/linux/audit.h:26,
                 from /usr/src/linux/include/linux/fsnotify.h:15,
                 from inotify_recursive.c:14:
/usr/src/linux/include/linux/types.h:112:17: erreur: conflicting types for ‘u_int64_t’
 typedef  __u64  u_int64_t;
                 ^
In file included from /usr/include/stdlib.h:314:0,
                 from inotify_recursive.c:10:
/usr/include/sys/types.h:203:1: note: previous declaration of ‘u_int64_t’ was here
 __u_intN_t (64, __DI__);
 ^
In file included from /usr/src/linux/include/uapi/linux/capability.h:16:0,
                 from /usr/src/linux/include/linux/capability.h:15,
                 from /usr/src/linux/include/linux/sched.h:15,
                 from /usr/src/linux/include/linux/audit.h:26,
                 from /usr/src/linux/include/linux/fsnotify.h:15,
                 from inotify_recursive.c:14:
/usr/src/linux/include/linux/types.h:113:17: erreur: conflicting types for ‘int64_t’
 typedef  __s64  int64_t;
                 ^
In file included from /usr/include/stdlib.h:314:0,
                 from inotify_recursive.c:10:
/usr/include/sys/types.h:197:1: note: previous declaration of ‘int64_t’ was here
 __intN_t (64, __DI__);
 ^
In file included from /usr/src/linux/include/uapi/linux/capability.h:16:0,
                 from /usr/src/linux/include/linux/capability.h:15,
                 from /usr/src/linux/include/linux/sched.h:15,
                 from /usr/src/linux/include/linux/audit.h:26,
                 from /usr/src/linux/include/linux/fsnotify.h:15,
                 from inotify_recursive.c:14:
/usr/src/linux/include/linux/types.h:134:23: erreur: conflicting types for ‘blkcnt_t’
 typedef unsigned long blkcnt_t;
                       ^
In file included from /usr/include/stdlib.h:314:0,
                 from inotify_recursive.c:10:
/usr/include/sys/types.h:235:20: note: previous declaration of ‘blkcnt_t’ was here
 typedef __blkcnt_t blkcnt_t;  /* Type to count number of disk blocks.  */
                    ^
In file included from /usr/src/linux/include/linux/kernel.h:6:0,
                 from /usr/src/linux/include/linux/sched.h:17,
                 from /usr/src/linux/include/linux/audit.h:26,
                 from /usr/src/linux/include/linux/fsnotify.h:15,
                 from inotify_recursive.c:14:
/usr/src/linux/include/linux/linkage.h:7:25: erreur fatale: asm/linkage.h : Aucun fichier ou dossier de ce type
 #include <asm/linkage.h>
                         ^
compilation terminée.

_________________
:-) Gentoo Linux Rullez !
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum