NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Update libsqlite3-dev on OPKG

Solved!
Go to solution

I'm using SQLite in my LVRT application and that's been working fine, but I need a feature only available in v3.8.2 or greater. The version distributed by opkg is 3.7.15.2. How can I get the latest version onto my cRIO?

Message 1 of 15
(8,139 Views)

It's odd that they would put some functionality into a maintainence release (or is this actually just the first release that fixed an issue with existing functionality?).

In any case, this is probably a reasonable case for building the code on the target itself. There are a couple of documents on this forum to give you pointers, what version of the OS are you using? (run uname -a)

0 Kudos
Message 2 of 15
(6,024 Views)

uname -a returns

Linux NI-cRIO-9066-03082d01 3.2.35-rt52-2.10.0f0 #1 SMP PREEMPT RT Mon Dec 8 14:50:27 CST 2014 armv7l GNU/Linux

I'm a LV programmer, not a C programmer. I'll see if a teammate can help me build it.

Actually, that raises another question: How frequently do you maintain your server's package library to keep up to date with all the projects you're distributing to your end users? Providing bugfix updates is even more important than providing new features.

0 Kudos
Message 3 of 15
(6,024 Views)

Okay, we tried building it on a loaner cRIO-9066 that NI gave me to use.

Here's the script we ran:

#get the sqlite tarball

wget --no-check-certificate https://www.sqlite.org/2015/sqlite-autoconf-3081002.tar.gz

#untar it

tar -C /home/admin/ -xf sqlite-autoconf-3081002.tar.gz


#remove the tarball

rm ~/sqlite-autoconf-3081002.tar.gz
cd ~/sqlite-autoconf-3081002


#compile sqlite

./configure

make

make install
cd ~rm -r ~/sqlite-autoconf-3081002

It failed on make. Here's the output up to the failure:

libtool: compile:  gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.8.10.2\" "-DPACKAGE_STRING=\"sqlite 3.8.10.2\"" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.8.10.2\" -D_FILE_OFFSET_BITS=64 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -c sqlite3.c  -fPIC -DPIC -o .libs/sqlite3.o
cc1: out of memory allocating 952 bytes after a total of 22294528 bytes

So I might not be able to build it on the target. Going to remove all "NI software" options using MAX and retry.

0 Kudos
Message 4 of 15
(6,024 Views)

Actually, what you can do (just to get over the hump of building the thing) would be

  1. Plug in a USB stick
  2. Create a file to use for VM swapping
    1. dd if=/dev/zero of=/media/sda/pagefile bs=1G count=2
      • This will create a 2GB swapfile, adjust as needed. It will also take some time, be patient
    2. mkswap /media/sda/pagefile
  3. Add the swap to your system
    1. swapon /media/sda/pagefile
    2. Check with free that you have swap listed as a non-zero value

This is what that sequence looks like on my laptop

[root@quartz brad]# free

              total        used        free      shared  buff/cache   available

Mem:        8067812     1470564     1463956      228256     5133292     6082976

Swap:             0           0           0

[root@quartz brad]# dd if=/dev/zero of=/media/sda/pagefile bs=1G count=2

2+0 records in

2+0 records out

2147483648 bytes (2.1 GB) copied, 540.91 s, 4.0 MB/s

[root@quartz brad]#

[root@quartz brad]# mkswap /media/sda/pagefile

Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)

no label, UUID=ec111dee-8212-4c1b-8d1c-30347b2acbca

[root@quartz brad]# swapon /media/sda/pagefile

swapon: /media/sda/pagefile: insecure permissions 0644, 0600 suggested.

swapon: /media/sda/pagefile: insecure file owner 1000, 0 (root) suggested.

[root@quartz brad]# free

              total        used        free      shared  buff/cache   available

Mem:        8067812     1598624     1319760      273620     5149428     5908988

Swap:       2097144           0     2097144

[root@quartz brad]#

Message 5 of 15
(6,024 Views)

Still failed again:

libtool: compile:  gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.8.10.2\" "-DPACKAGE_STRING=\"sqlite 3.8.10.2\"" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.8.10.2\" -D_FILE_OFFSET_BITS=64 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -c sqlite3.c -o sqlite3.o >/dev/null 2>&1

mv -f .deps/sqlite3.Tpo .deps/sqlite3.Plo

/bin/sh ./libtool --tag=CC   --mode=link gcc -D_REENTRANT=1 -DSQLITE_THREADSAFE=1  -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -no-undefined -version-info 8:6:8  -o libsqlite3.la -rpath /usr/local/lib sqlite3.lo  -ldl -lpthread

libtool: link: gcc -shared  -fPIC -DPIC  .libs/sqlite3.o   -ldl -lpthread  -O2   -Wl,-soname -Wl,libsqlite3.so.0 -o .libs/libsqlite3.so.0.8.6

libtool: link: (cd ".libs" && rm -f "libsqlite3.so.0" && ln -s "libsqlite3.so.0.8.6" "libsqlite3.so.0")

libtool: link: (cd ".libs" && rm -f "libsqlite3.so" && ln -s "libsqlite3.so.0.8.6" "libsqlite3.so")

libtool: link: ar cru .libs/libsqlite3.a  sqlite3.o

In this case we're getting the error 'ar: invalid option: 'r'

ar: invalid option -- 'r'

BusyBox v1.20.2 (2014-12-08 18:04:17 CST) multi-call binary.

Usage: ar [-o] [-v] [-p] [-t] [-x] ARCHIVE FILES

Extract or list FILES from an ar archive

       -o      Preserve original dates

       -p      Extract to stdout

       -t      List

       -x      Extract

       -v      Verbose

All the documentation we can find online suggests that "r" is a perfectly valid option for ar. We tried installing the other busybox opkg modules, but nothing seems to be working. Is there a package that includes the full version of the ar command?

0 Kudos
Message 6 of 15
(6,024 Views)

BradM wrote:

Actually, what you can do (just to get over the hump of building the thing) would be...

Appreciate the tutorial, but removing all the NI software options using MAX freed up enough RAM to get through the build. Now we're running into other issues unrelated to available memory. See below.

0 Kudos
Message 7 of 15
(6,024 Views)

Install the proper binutils component (this will give you the full ar)

opkg list | grep binutils

if there's a -symlinks package, install that as well

Message 8 of 15
(6,024 Views)

Alternatively to what BradM said install:

   opkg install packagegroup-core-buildessential

That should give you all the build dependencies you need (including binutils which has the full ar).

Message 9 of 15
(6,024 Views)

Before this question gets lost in the thread:

Actually, that raises another question: How frequently do you maintain your server's package library to keep up to date with all the projects you're distributing to your end users? Providing bugfix updates is even more important than providing new features.

Annually, with critical fixes applied as available, see for example https://decibel.ni.com/content/thread/24727

0 Kudos
Message 10 of 15
(6,024 Views)