> It seems that gcc doesn't include standard include paths

I would suggest you add `--verbose` to your CFLAGS so you will see explicitly 
what is in the search path for that one invocation that fails.

Giulio

PS: note that the weird line wrapping of your message (possibly due to your 
email client or termianl or both?) makes your message and the error log 
difficult to parse


________________________________________
From: Xenomai <[email protected]> on behalf of Simone Zucchi 
<[email protected]>
Sent: 26 July 2017 11:49
To: [email protected]
Subject: [Xenomai] Xenomai 2->3: gcc/makefile wrong include paths

Hello everybody,
thanks to your previous hints I've succesfully got Cobalt working.
I'm trying to compile some (previously coded for Xenomai 2) code.
I'm facing an odd issue which I don't think is related to Xenomai but
rather to
the way my Makefile is built.
I'd be real grateful to anybody out there willing to help me because I'm
no make
file expert at all.

It seems that gcc doesn't include standard include paths for no reasons
apperant
ly through my makefile.
I'm working on Debian 9.
Here's the include paths of gcc:

     gcc -xc -E -v -
     Using built-in specs.
     COLLECT_GCC=gcc
     Target: x86_64-linux-gnu
     Configured with: ../src/configure -v --with-pkgversion='Debian
6.3.0-18' --w
ith-bugurl=file:///usr/share/doc/gcc-6/README.Bugs
--enable-languages=c,ada,c++,
java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6
--program-prefi
x=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/l
ib --without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-
nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libs
tdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --dis
able-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-s
ystem-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --w
ith-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home
--with-
jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64
--with-jvm-jar-dir=/usr/lib/jvm
-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64
--with-ecj-jar=/usr/
share/java/eclipse-ecj.jar --with-target-system-zlib
--enable-objc-gc=auto --ena
ble-multiarch --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx
32 --enable-multilib --with-tune=generic --enable-checking=release
--build=x86_6
4-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
     Thread model: posix
     gcc version 6.3.0 20170516 (Debian 6.3.0-18)
     COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
      /usr/lib/gcc/x86_64-linux-gnu/6/cc1 -E -quiet -v -imultiarch
x86_64-linux-g
nu - -mtune=generic -march=x86-64
     ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
     ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/6/../../../../
x86_64-linux-gnu/include"
     #include "..." search starts here:
     #include <...> search starts here:
      /usr/lib/gcc/x86_64-linux-gnu/6/include
      /usr/local/include
      /usr/lib/gcc/x86_64-linux-gnu/6/include-fixed
      /usr/include/x86_64-linux-gnu
      /usr/include
     End of search list.
     # 1 "<stdin>"
     # 1 "<built-in>"
     # 1 "<command-line>"
     # 31 "<command-line>"
     # 1 "/usr/include/stdc-predef.h" 1 3 4
     # 32 "<command-line>" 2
     # 1 "<stdin>"
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu
/6/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc
/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/
6/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/:/l
ib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/u
sr/lib/gcc/x86_64-linux-gnu/6/../../../:/lib/:/usr/lib/
     COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'


My Makefile is:

     ###### CONFIGURATION ######

     ### List of applications to be build
     APPLICATIONS =

     ### Note: to override the search path for the xeno-config script,
use "make
XENO=..."


     ### List of modules to be build
     MODULES = myRtModule

     ### Note: to override the kernel source path, use "make KSRC=..."



     ###### USER SPACE BUILD (no change required normally) ######
     ifeq ($(KERNELRELEASE),)
     ifneq ($(APPLICATIONS),)

     ### Default Xenomai installation path
     XENO ?= /usr/local/xenomai

     XENOCONFIG=$(shell PATH=$(XENO):$(XENO)/bin:$(PATH) which
xeno-config 2>/dev
/null)

     ### Sanity check
     ifeq ($(XENOCONFIG),)
     all::
         @echo ">>> Invoke make like this: \"make
XENO=/path/to/xeno-config\" <<<
"
         @echo
     endif


     CC=$(shell $(XENOCONFIG) --cc)

     CFLAGS=$(shell $(XENOCONFIG) --alchemy --cflags) $(MY_CFLAGS) -I
/usr/local/
src/mySource/include

     LDFLAGS=$(shell $(XENOCONFIG) --alchemy --ldflags) $(MY_LDFLAGS)
-lalchemy

     # This includes the library path of given Xenomai into the binary
to make li
ve
     # easier for beginners if Xenomai's libs are not in any default
search path.

     LDFLAGS+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)

     all:: $(APPLICATIONS)

     clean::
         $(RM) $(APPLICATIONS) *.o

     endif
     endif



     ###### KERNEL MODULE BUILD (no change required normally) ######
     ifneq ($(MODULES),)

     ### Default to sources of currently running kernel
     KSRC ?= /lib/modules/$(shell uname -r)/build

     OBJS     := ${patsubst %, %.o, $(MODULES)}
     CLEANMOD := ${patsubst %, .%*, $(MODULES)}
     PWD      := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else
pwd; fi)

     obj-m        := $(OBJS)
     EXTRA_CFLAGS := -I$(KSRC)/include/xenomai
-I$(KSRC)/include/xenomai/posix $(
ADD_CFLAGS) -I/usr/local/src/mySource/include

     all::
         $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules

     clean::
         $(RM) $(CLEANMOD) *.o *.ko *.mod.c Module.markers modules.order
         $(RM) -R .tmp*

     endif


When I run make this is what happens:

     make -C /lib/modules/4.9.24-ipipe-xenomai-3.0.5-cobalt/build
SUBDIRS=/usr/lo
cal/src/my/source/rt_control modules
     make[1]: Entering directory
'/usr/local/src/linux-4.9.24-ipipe-xenomai-3.0.5
-cobalt'
       CC [M] /usr/local/src/mySource/source/rt_control/myRtModule.o
     In file included from /usr/local/src/mySource/include/common.h:10:0,
                      from
/usr/local/src/mySource/source/rt_control/myRtModule.c
:33:
     include/xenomai/alchemy/task.h:21:23: fatal error: sys/types.h: No
such file
  or directory
      #include <sys/types.h>
                            ^
     compilation terminated.
     scripts/Makefile.build:299: recipe for target
'/usr/local/src/mySource/sourc
e/rt_control/myRtModule.o' failed
     make[2]: ***
[/usr/local/src/mySource/source/rt_control/myRtModule.o] Error
1
     Makefile:1490: recipe for target
'_module_/usr/local/src/mySource/source/rt_
control' failed
     make[1]: *** [_module_/usr/local/src/mySource/source/rt_control]
Error 2
     make[1]: Leaving directory
'/usr/local/src/linux-4.9.24-ipipe-xenomai-3.0.5-
cobalt'
     Makefile:67: recipe for target 'all' failed
     make: *** [all] Error 2

If I explicit the (standard?) include path over gcc into make, adding
"-I/usr/in
clude/x86_64-linux-gnu" at the end of EXTRA_CFLAGS, I get this behaviour:

     make -C /lib/modules/4.9.24-ipipe-xenomai-3.0.5-cobalt/build
SUBDIRS=/usr/lo
cal/src/mySource/source/rt_control modules
     make[1]: Entering directory
'/usr/local/src/linux-4.9.24-ipipe-xenomai-3.0.5
-cobalt'
       CC [M] /usr/local/src/mySource/source/rt_control/myRtModule.o
     In file included from include/xenomai/alchemy/task.h:21:0,
                      from /usr/local/src/mySource/include/common.h:10,
                      from
/usr/local/src/mySource/source/rt_control/myRtModule.c
:33:
     /usr/include/x86_64-linux-gnu/sys/types.h:25:22: fatal error:
features.h: No
  such file or directory
      #include <features.h>
                           ^
     compilation terminated.
     scripts/Makefile.build:299: recipe for target
'/usr/local/src/mySource/sourc
e/rt_control/myRtModule.o' failed
     make[2]: ***
[/usr/local/src/mySource/source/rt_control/myRtModule.o] Error
1
     Makefile:1490: recipe for target
'_module_/usr/local/src/mySource/source/rt_
control' failed
     make[1]: *** [_module_/usr/local/src/mySource/source/rt_control]
Error 2
     make[1]: Leaving directory
'/usr/local/src/linux-4.9.24-ipipe-xenomai-3.0.5-
cobalt'
     Makefile:67: recipe for target 'all' failed
     make: *** [all] Error 2


Of course I do have libcv-dev installed and everything is in the right
place:

     ls -l /usr/include/x86_64-linux-gnu/sys/types.h
     -rw-r--r-- 1 root root 6687 Jun 15 21:17
/usr/include/x86_64-linux-gnu/sys/t
ypes.h

     ls -l /usr/include/features.h
     -rw-r--r-- 1 root root 13069 Jun 15 21:17 /usr/include/features.h

Hope anybody out there could/will help me :)
Thanks,

Simone
_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai

_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai

Reply via email to