brgl / libgpiod

This is a mirror of the original repository over at kernel.org. This github page is for discussions and issue reporting only. PRs can be discussed here but the patches need to go through the linux-gpio mailing list.
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
Other
307 stars 106 forks source link

Compiling on Ubuntu #22

Closed chaoticmachinery closed 6 years ago

chaoticmachinery commented 6 years ago

When I try configuring this under Ubuntu I get the following:

checking linux/gpio.h usability... no checking linux/gpio.h presence... no checking for linux/gpio.h... no configure: error: linux/gpio.h header not found (needed to build the library)

I have confirmed that the linux headers are installed. /usr/src/linux-headers-4.10.0-40/include/linux/gpio.h

Is there something else I need to give configure?

Thank you, CM

brgl commented 6 years ago

This file should be in /usr/include/linux/gpio,h. On my debian 9 system it's provided by linux-libc-dev. Alternatively you can pass CFLAGS="-I/usr/src/linux-headers-4.10.0-40/include" to the configure script to let it know the location of the header.

timur-tabi commented 6 years ago

Still doesn't work:

$ ls -l /usr/src/linux-headers-`uname -r`/include/linux/gpio.h
-rw-r--r-- 1 root root 5769 Sep  3  2017 /usr/src/linux-headers-4.13.0-36-generic/include/linux/gpio.h

$ ./autogen.sh CFLAGS="-I/usr/src/linux-headers-`uname -r`/include"
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'autostuff'.
libtoolize: copying file 'autostuff/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:33: installing 'autostuff/compile'
configure.ac:21: installing 'autostuff/missing'
bindings/cxx/Makefile.am: installing 'autostuff/depcomp'
autoreconf: Leaving directory `.'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking whether make supports nested variables... (cached) no
checking for style of include used by make... none
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... none
checking for ar... ar
checking the archiver (ar) interface... ar
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) none
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking dependency style of g++... none
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert aarch64-unknown-linux-gnu file names to aarch64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert aarch64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for ANSI C header files... (cached) yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for ioctl... yes
checking for asprintf... yes
checking for scandir... yes
checking for alphasort... yes
checking for ppoll... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking dirent.h usability... yes
checking dirent.h presence... yes
checking for dirent.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking linux/gpio.h usability... no
checking linux/gpio.h presence... no
checking for linux/gpio.h... no
configure: error: linux/gpio.h header not found (needed to build the library)
ddB0515 commented 6 years ago

try this

git clone https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git cd libgpiod mkdir -p include/linux cp /usr/src/linux-headers-$(uname -r)/include/linux/compiler_types.h include/linux/. ./autogen.sh --enable-tools=yes --prefix=/usr/local CFLAGS="-I/usr/src/linux-headers-$(uname -r)/include/uapi -Iinclude" make sudo make install sudo ldconfig

let me know if works for you as work for me on Mint 18.3

romainreignier commented 6 years ago

@InvalidExcepti0n It works for me with warnings because I was using kernel headers. Thanks.

I was Ubuntu 16.04 with kernel 4.10 and the compiler_types.h file was not there so I have copied compiler* files.

gustavojcorrea commented 6 years ago

@romainreignier I also don't have the compiler_types.h file. Could you please provide a bit more information on your process to solve this issue? Thank you

romainreignier commented 6 years ago

@gustavojcorrea I have followed @InvalidExcepti0n instructions except that I replaced this line:

cp /usr/src/linux-headers-$(uname -r)/include/linux/compiler_types.h include/linux/.

by this one

cp /usr/src/linux-headers-$(uname -r)/include/linux/compiler* include/linux/.
gustavojcorrea commented 6 years ago

@romainreignier When I use cp /usr/src/linux-headers-$(uname -r)/include/linux/compiler* include/linux/. I get the following cp: cannot stat '/usr/src/linux-headers-4.9.54-ti-r68/include/linux/compiler*': No such file or directory

brgl commented 6 years ago

@chaoticmachinery can I close this? I can't really help you, I don't use ubuntu. I think this question belongs on a ubuntu support forum.