NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Compile inotify-tools (for sbRIO-9627) with Eclipse

Hi all,

I would like to install inotify-tools on a sbRIO-9627 controller.

 

I have attempted to install with opkg, only to get this result:

admin@sbRIO-9627:~# opkg install inotify-tools
Unknown package 'inotify-tools'.
Collected errors:
 * opkg_install_cmd: Cannot install package inotify-tools.

 

 

After following the instructions found here, I am now stuck at this point: 

./configure --prefix=/usr && make && su -c 'make install'
checking for a BSD-compatible install... ./install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make sets $(MAKE)... (cached) yes
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: in `/usr/src/inotify-tools/inotify-tools-3.14':
configure: error: C compiler cannot create executables
See `config.log' for more details.

config.log:

 

Spoiler

 

admin@sbRIO-9627:/usr/src/inotify-tools/inotify-tools-3.14# cat config.log 
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by inotify-tools configure 3.14, which was
generated by GNU Autoconf 2.64.  Invocation command line was

  $ ./configure --prefix=/usr

## --------- ##
## Platform. ##
## --------- ##

hostname = sbRIO-9627-kontor
uname -m = armv7l
uname -r = 3.14.46-rt46-ni-3.5.0f0
uname -s = Linux
uname -v = #1 SMP PREEMPT RT Tue Jan 19 21:49:05 CST 2016

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/local/sbin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/natinst/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2344: checking for a BSD-compatible install
configure:2412: result: ./install-sh -c
configure:2423: checking whether build environment is sane
configure:2473: result: yes
configure:2614: checking for a thread-safe mkdir -p
configure:2653: result: ./install-sh -c -d
configure:2666: checking for gawk
configure:2682: found /usr/bin/gawk
configure:2693: result: gawk
configure:2704: checking whether make sets $(MAKE)
configure:2726: result: yes
configure:2815: checking whether make sets $(MAKE)
configure:2837: result: yes
configure:2896: checking for gcc
configure:2912: found /usr/bin/gcc
configure:2923: result: gcc
configure:3152: checking for C compiler version
configure:3161: gcc --version >&5
gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3172: $? = 0
configure:3161: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/gcc/arm-nilrt-linux-gnueabi/4.8.2/lto-wrapper
Target: arm-nilrt-linux-gnueabi
Configured with: /builds/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/3.5/objects/targettools/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-glibc/work-shared/gcc-4.8.2-r0/gcc-4.8.2/configure --build=x86_64-linux --host=arm-nilrt-linux-gnueabi --target=arm-nilrt-linux-gnueabi --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib/gcc --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/builds/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/3.5/objects/targettools/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-glibc/sysroots/xilinx-zynq --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-nilrt-linux-gnueabi- --without-local-prefix --enable-target-optspace --enable-lto --enable-libssp --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --with-sysroot=/ --with-build-sysroot=/builds/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/3.5/objects/targettools/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-glibc/sysroots/xilinx-zynq --with-native-system-header-dir=/builds/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/3.5/objects/targettools/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-glibc/sysroots/xilinx-zynq/usr/include --with-gxx-include-dir=/usr/include/c++/4.8.2 --enable-nls --with-arch=armv7-a --with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3 --with-tune=cortex-a9
Thread model: posix
gcc version 4.8.2 (GCC) 
configure:3172: $? = 0
configure:3161: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3172: $? = 1
configure:3161: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3172: $? = 1
configure:3194: checking for C compiler default output file name
configure:3216: gcc    conftest.c  >&5
/usr/lib/gcc/arm-nilrt-linux-gnueabi/4.8.2/../../../../arm-nilrt-linux-gnueabi/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/lib/gcc/arm-nilrt-linux-gnueabi/4.8.2/../../../../arm-nilrt-linux-gnueabi/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
configure:3220: $? = 1
configure:3257: result: 
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "inotify-tools"
| #define PACKAGE_TARNAME "inotify-tools"
| #define PACKAGE_VERSION "3.14"
| #define PACKAGE_STRING "inotify-tools 3.14"
| #define PACKAGE_BUGREPORT "radu.voicilas@gmail.com"
| #define PACKAGE_URL ""
| #define PACKAGE "inotify-tools"
| #define VERSION "3.14"
| #define _GNU_SOURCE /**/
| /* end confdefs.h.  */
| #include <stdio.h>
| int
| main ()
| {
| FILE *f = fopen ("conftest.out", "w");
|  return ferror (f) || fclose (f) != 0;
| 
|   ;
|   return 0;
| }
configure:3263: error: in `/usr/src/inotify-tools/inotify-tools-3.14':
configure:3267: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_prog_AWK=gawk
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_make_make_set=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} /usr/src/inotify-tools/inotify-tools-3.14/missing --run aclocal-1.11'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='${SHELL} /usr/src/inotify-tools/inotify-tools-3.14/missing --run tar'
AR=''
AUTOCONF='${SHELL} /usr/src/inotify-tools/inotify-tools-3.14/missing --run autoconf'
AUTOHEADER='${SHELL} /usr/src/inotify-tools/inotify-tools-3.14/missing --run autoheader'
AUTOMAKE='${SHELL} /usr/src/inotify-tools/inotify-tools-3.14/missing --run automake-1.11'
AWK='gawk'
CC='gcc'
CCDEPMODE=''
CFLAGS=''
CPP=''
CPPFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR=''
DOXYGEN=''
DOXYGEN_ENABLE_FALSE=''
DOXYGEN_ENABLE_TRUE=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GREP=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
MAKEINFO='${SHELL} /usr/src/inotify-tools/inotify-tools-3.14/missing --run makeinfo'
MKDIR_P='./install-sh -c -d'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='inotify-tools'
PACKAGE_BUGREPORT='radu.voicilas@gmail.com'
PACKAGE_NAME='inotify-tools'
PACKAGE_STRING='inotify-tools 3.14'
PACKAGE_TARNAME='inotify-tools'
PACKAGE_URL=''
PACKAGE_VERSION='3.14'
PATH_SEPARATOR=':'
RANLIB=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
VERSION='3.14'
ac_ct_CC='gcc'
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include=''
am__isrc=''
am__leading_dot='.'
am__quote=''
am__tar='${AMTAR} chof - "$$tardir"'
am__untar='${AMTAR} xf -'
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /usr/src/inotify-tools/inotify-tools-3.14/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
lt_ECHO='echo'
mandir='${datarootdir}/man'
mkdir_p='$(top_builddir)/./install-sh -c -d'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "inotify-tools"
#define PACKAGE_TARNAME "inotify-tools"
#define PACKAGE_VERSION "3.14"
#define PACKAGE_STRING "inotify-tools 3.14"
#define PACKAGE_BUGREPORT "radu.voicilas@gmail.com"
#define PACKAGE_URL ""
#define PACKAGE "inotify-tools"
#define VERSION "3.14"
#define _GNU_SOURCE /**/

configure: exit 77 

 

I also tried Getting Started C/C++ Dev Eclipse Edition - but is stuck with:

sh -c /C/Users/USER/eclipse-workspace/inotify-tools/autogen.sh 
Cannot run program "sh": Launching failed

Error: Program "sh" not found in PATH

 

 

 

Now, I wrote this so far, and then found these two:

  1. https://forums.ni.com/t5/NI-Linux-Real-Time-Discussions/Finding-an-ARM-compatible-package-for-instal...
  2. https://forums.ni.com/t5/NI-Linux-Real-Time-Discussions/can-t-install-compile-tools-on-cRIO-9034/m-p...

which basically says

opkg install packagegroup-core-buildessential

and compiling works! Smiley Happy

 

 

 

Only have to clean up the sbRIO-9627, which leads me to ask, how may I use Eclipse to compile?

What changes is necessary to overcome the error posted above?

In simple terms please Smiley Wink

 

 

EDIT: Attached tarball with compiled binaries.

Also included our script that requires inotifywait:

 

Spoiler
Source (corfilnam.sh😞
#!/usr/bin/env bash
# corfilnam - Correct File Name

WANTED="$1"
# https://askubuntu.com/questions/385333/how-do-i-get-the-filename-from-inotifywait-events
inotifywait -m -q -e close --format '%f' "$2" | while read FILE
do
  # https://stackoverflow.com/questions/1728683/case-insensitive-comparison-of-strings-in-shell-script
  if [[ "$FILE" != "$WANTED" ]] && [[ "${FILE,,}" = "${WANTED,,}" ]]; then
    FULLPATH="$2/$FILE"
    if [ -f "$FULLPATH" ]; then
      echo "$(date) mv $FILE $WANTED"
      TARGET="$2/$WANTED"
      mv "$FULLPATH" "$TARGET"
      [ ! -z "$3" ] && chmod "$3" "$TARGET"
      [ ! -z "$4" ] && chown "$4" "$TARGET"
    fi
  fi
done

Usage:
corfilnam.sh <wanted filename> <path> <chmod MODE> <chown [OWNER][:[GROUP]]>

Example:
./corfilnam.sh config.ini "/home/lvuser/natinst/Config" g+w lvuser:ni

Why:
On Linux, the file system is case sensitive. This means that you could have files named file, File, and FILE in the same folder. Each file would have different contents – Linux treats capitalized letters and lower-case letters as different characters.  When dealing with file transfers from windows users this can create confusion, for instance if the user sends over a new configuration named CONFIG.INI, while the LabVIEW software is looking for config.ini, the new configuration will not be loaded.
corfilnam.sh makes the system case insensitive for <wanted filename> in <path>.
The script monitors <path>, looking for any file close event, checks if the lowercase filename of closed file matches the lowercase of <wanted filename>, then checks if the file exists (the file may have been closed and then delete), and then moves the recently closed file to <wanted filename>.  Also, if set as arguments, it fixes access permissions and ownership.

 

0 Kudos
Message 1 of 7
(3,640 Views)

I'm a little unclear on what you're trying to do. If you are able to compile on the target, why do you need to build inotify-tools using Eclipse? 

0 Kudos
Message 2 of 7
(3,604 Views)

My apologies for not making this explicitly clear.

I would like to compile with Eclipse to:

  1. Avoid installing necessary compiling-tools on target, and thus the need for cleaning up on target.  We have had cases where we almost, by mistake, sent systems to client with unwanted installed software.
  2. Generally I think building on target, which is an embedded system, is a bad idea.  Supported by this answer.
  3. Learning.  This is, I believe, the third time in life I have successfully compiled Linux software.  Compiling on Linux, is for me, usually something that stops me from doing what I want.  So, I would like to learn how to setup a cross compiler in order to learn more about the process of configuring a compiler and compiling software for Linux.

 

0 Kudos
Message 3 of 7
(3,594 Views)

Those are all great reasons! I saw you mentioned the Getting Started guide above. Were you able to successfully build and deploy the Hello World example to your target? What step along the document did you get stuck?

0 Kudos
Message 4 of 7
(3,588 Views)

Sorry.

Yet another key detail I forgot to mention.  Yes, I was able to successfully build and deploy the Hello World example to target.  Meaning I did not got stuck at any step along the document.

 

Basically I think my question boils down to: Given that I have successfully completed the Hello World example, what changes and tweaks do I need to do in order to cross compile other software (than Hello World example) with Eclipse, in this case inotify-tools?

Hoping that an answer will help me (and other readers) learn how to build and deploy just about any software on sbRIO-9627 (and other targets).

 

I guess it has a lot to do with understanding the files:

Makefile.am
autogen.sh
configure.ac

and what the information in there means, and how that is transferred to Eclipse.

0 Kudos
Message 5 of 7
(3,582 Views)

@bhpa

I guess it has a lot to do with understanding the files:

Makefile.am
autogen.sh
configure.ac

and what the information in there means, and how that is transferred to Eclipse. 

That's one part of the story. These files are inputs for autotools (autoconf, automake, ...). 

Looks like you're trying it under Windoze. I doubt that would really work. 

 

Take a Linux box, set up the cross proper toolchain for your target and run crosscompiling / packaging through the bitbake machiney. Throw away the eclipse cruft - it doesn't help here.

 

(yes, you'll have to make yourself confident w/ crosscompiling and linux embedded development)

 

Linux Embedded / Kernel Hacker / BSP / Driver development / Systems engineering
0 Kudos
Message 6 of 7
(3,527 Views)

Do you happen to have the .so files for your binaries? I am trying to use the same package on a 9627, but it seems to need the .so files for the binaries.

Thanks!

0 Kudos
Message 7 of 7
(1,462 Views)