/usr/bin/ld: cannot find -lruby - c

I hope build ruby c extension with cmake, but I get /usr/bin/ld: cannot find -llibruby in console, here is my code:
CMakeLists.txt
cmake_minimum_required(VERSION 3.3)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
file(GLOB cs *.c)
include_directories($ENV{HOME}/.rbenv/versions/2.2.3/include/ruby-2.2.0/x86_64-linux
$ENV{HOME}/.rbenv/versions/2.2.3/include/ruby-2.2.0)
foreach (c ${cs})
get_filename_component(exe ${c} NAME_WE)
add_executable(${exe} ${cs})
endforeach ()
add_library(mytest SHARED MyTest.c)
link_directories($ENV{HOME}/.rbenv/versions/2.2.3/lib)
find_library(ruby NAMES ruby)
target_link_libraries(mytest ruby)
and here is ruby lib:
roroco#roroco-Zhaoyang-K49 ~/Dropbox/rbs/ro_plans $ lsa ~/.rbenv/versions/2.2.3/lib
total 61424
drwxr-xr-x 4 roroco roroco 4096 Nov 21 23:49 .
drwxr-xr-x 6 roroco roroco 4096 Oct 13 22:10 ..
lrwxrwxrwx 1 roroco roroco 16 Nov 21 23:49 libruby.so -> libruby.so.2.2.0
lrwxrwxrwx 1 roroco roroco 16 Nov 21 23:49 libruby.so.2.2 -> libruby.so.2.2.0
-rwxr-xr-x 1 roroco roroco 13573794 Nov 21 23:49 libruby.so.2.2.0
-rw-r--r-- 1 roroco roroco 49306632 Nov 21 23:47 libruby-static.a
drwxr-xr-x 2 roroco roroco 4096 Nov 21 23:49 pkgconfig
drwxr-xr-x 6 roroco roroco 4096 Oct 13 22:10 ruby

Related

Сreating Bash array

Create array: array=($(ls -l))
Show full an array: echo ${array[#]}
Result: total 0 -rw-r--r-- 1 root root 0 Jul 14 05:54 1 -rw-r--r-- 1 root root 0 Jul 14 05:54 2 -rw-r--r-- 1 root root 0 Jul 14 05:54 3 -rw-r--r-- 1 root root 0 Jul 14 05:54 4 -rw-r--r-- 1 root root 0 Jul 14 05:54 5
Show part of an array: echo ${array[#]:0:11}
Result: total 0 -rw-r--r-- 1 root root 0 Jul 14 05:54 1
Show other part of an array: echo ${array[#]:11:20}
Result: -rw-r--r-- 1 root root 0 Jul 14 05:54 2 -rw-r--r-- 1 root root 0 Jul 14 05:54 3 -rw-r--r-- 1
Why not only elements 11-20 are shown, but also the rest?

vespa `Illegal query` when testing a deployed search

Following the part 6 of the tutorial: https://docs.vespa.ai/en/tutorials/news-6-recommendation-with-searchers.html I produced the mavel-compiled folder and zip file:
(vespa) raphy#pc:~/vespa/sample-apps/news/app-6-recommendation-with-searchers/target$ ls -lah
total 56K
drwxrwxr-x 8 raphy raphy 4.0K Dec 14 16:51 .
drwxrwxr-x 4 raphy raphy 4.0K Dec 14 16:51 ..
drwxrwxr-x 2 raphy raphy 4.0K Dec 14 16:51 antrun
drwxrwxr-x 5 raphy raphy 4.0K Dec 14 16:51 application
-rw-rw-r-- 1 raphy raphy 6.3K Dec 14 16:51 application.zip
drwxrwxr-x 4 raphy raphy 4.0K Dec 14 16:51 classes
drwxrwxr-x 3 raphy raphy 4.0K Dec 14 16:51 generated-sources
drwxrwxr-x 2 raphy raphy 4.0K Dec 14 16:51 maven-archiver
drwxrwxr-x 3 raphy raphy 4.0K Dec 14 16:51 maven-status
-rw-rw-r-- 1 raphy raphy 4.6K Dec 14 16:51 news-recommendation-searcher-0.0.1-deploy.jar
-rw-rw-r-- 1 raphy raphy 4.6K Dec 14 16:51 news-recommendation-searcher-0.0.1-without-dependencies.jar
I tried to deploy it
(vespa) raphy#pc:~/vespa/sample-apps/news/app-6-recommendation-with-searchers/target$ (cd application && zip -r - .) |
> curl --header Content-Type:application/zip --data-binary #- \
> localhost:19071/application/v2/tenant/default/prepareandactivate
adding: components/ (stored 0%)
adding: components/news-recommendation-searcher-0.0.1-deploy.jar (deflated 23%)
adding: build-meta.json (deflated -1%)
adding: search/ (stored 0%)
adding: search/query-profiles/ (stored 0%)
adding: search/query-profiles/default.xml (deflated 18%)
adding: search/query-profiles/types/ (stored 0%)
adding: search/query-profiles/types/root.xml (deflated 24%)
adding: schemas/ (stored 0%)
adding: schemas/news.sd (deflated 73%)
adding: schemas/user.sd (deflated 51%)
adding: services.xml (deflated 51%)
adding: hosts.xml (deflated 25%)
{"log":[],"tenant":"default","url":"http://localhost:19071/application/v2/tenant/default/application/default/environment/prod/region/default/instance/default","message":"Session 17 for tenant 'default' prepared and activated.","configChangeActions":{"restart":[],"refeed":[],"reindex":[]}}(vespa) raphy#pc
But when testing I get this error:
/?user_id=U33527&searchchain=user' | python -m json.tool
{
"root": {
"id": "toplevel",
"relevance": 1.0,
"fields": {
"totalCount": 0
},
"errors": [
{
"code": 3,
"summary": "Illegal query",
"source": "mind",
"message": "No query"
}
]
}
}
Now I'm getting this:
(vespa) raphy#pc:~/vespa/sample-apps/news/app-6-recommendation-with-searchers$ curl -s 'http://localhost:8080/search/?user_id=U33527&searchchain=user' | python -m json.tool
Expecting value: line 1 column 1 (char 0)
What am I missing? How to solve the problem?

How to change from NTFS to "noramal FS" in USB memory?

Several years ago, I change my usb file system(FS) from default FS to NTFS. but now, I want to change to default FS.
What is the way to change that FS?
Machine Enviroment: macOSX 10.14
default Format: MS-DOS(FAT32)
current Format: Windows NT FileSystem(NTFS)
USB internal file by terminal
>>ls -l -FG -a
total 6403240
-rwxr-xr-x# 1 takezakiyuuta staff 2352 8 2 2018 $UGM*
drwxr-xr-x 1 takezakiyuuta staff 8192 8 23 2018 ./
drwxr-xr-x+ 10 root wheel 320 2 21 19:39 ../
-rwxr-xr-x 1 takezakiyuuta staff 12 8 9 2018 .avm_speed_test2*
drwxr-xr-x 1 takezakiyuuta staff 0 8 10 2018 .fseventsd/
-rwxr-xr-x 1 takezakiyuuta staff 11 8 23 2018 .hd_keepalive*
drwxr-xr-x 1 takezakiyuuta staff 16384 8 23 2018 .index/
drwxr-xr-x 1 takezakiyuuta staff 16384 8 23 2018 .thumb/
-rwxr-xr-x 1 takezakiyuuta staff 354368793 8 18 2018 180818-1039.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 156281700 8 18 2018 180818-1042.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 232452505 8 18 2018 180818-1044.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 164182010 8 20 2018 180820-1817.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 470749844 8 20 2018 180820-1820.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 299472449 8 20 2018 180820-1824.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 112263523 8 23 2018 180823-2044.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 56539836 8 23 2018 180823-2046.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 42780723 8 23 2018 180823-2048.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 290799372 8 23 2018 180823-2050.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 365304821 8 23 2018 180823-2052.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 396741824 8 23 2018 180823-2055.mp4*
-rwxr-xr-x 1 takezakiyuuta staff 336483041 8 23 2018 180823-2058.mp4*
drwxr-xr-x# 1 takezakiyuuta staff 0 8 2 2018 System Volume Information/

How do I figure out which i2c device is which programmatically?

I have 11 i2c device nodes on my system.
localhost user # ls /dev/i2c*
/dev/i2c-0 /dev/i2c-1 /dev/i2c-10 /dev/i2c-2 /dev/i2c-3 /dev/i2c-4 /dev/i2c-5 /dev/i2c-6 /dev/i2c-7 /dev/i2c-8 /dev/i2c-9
I can figure out which one is which by poking around in the /sys filesystem:
localhost devices # pwd
/sys/bus/i2c/devices
localhost devices # ls -al
total 0
drwxr-xr-x 2 root root 0 Jan 10 15:45 .
drwxr-xr-x 4 root root 0 Jan 10 15:45 ..
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-0 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-0
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-1 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-1
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-10 -> ../../../devices/pci0000:00/0000:00:19.2/i2c_designware.5/i2c-10
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-10508825:00 -> ../../../devices/pci0000:00/0000:00:19.2/i2c_designware.5/i2c-10/i2c-10508825:00
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-2 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-2
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-3 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-3
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-4 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-4
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-5 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-5
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-6 -> ../../../devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-7 -> ../../../devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-7
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-8 -> ../../../devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-8
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-9 -> ../../../devices/pci0000:00/0000:00:15.3/i2c_designware.3/i2c-9
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-INT343B:00 -> ../../../devices/pci0000:00/0000:00:19.2/i2c_designware.5/i2c-10/i2c-INT343B:00
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-INT343B:01 -> ../../../devices/pci0000:00/0000:00:19.2/i2c_designware.5/i2c-10/i2c-INT343B:01
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-PRP0001:00 -> ../../../devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-8/i2c-PRP0001:00
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-PRP0001:01 -> ../../../devices/pci0000:00/0000:00:15.3/i2c_designware.3/i2c-9/i2c-PRP0001:01
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-SYNA7817:00 -> ../../../devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6/i2c-SYNA7817:00
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-SYNA7817:01 -> ../../../devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-7/i2c-SYNA7817:01
The ones that I want are i2c-PRP0001-*, which I can see are currently symlinked to i2c-8 and i2c-9.
i2c offers no guarantee that these node numbers are stable (even across reboots). I would like to give my program the ability to look at an i2c device and determine if it's one I care about or not.
I could hack up a shell script to do basically what I just did on the command line, but is there a programmatic (C) way to find the device information (i.e. where does the kernel get the information that it writes to the sys filesystem)?

Error compiling kernel module, fatal error: linux/modversions.h: File or directory not found

i'm trying to compile a simple test kernel module but gcc drop me this error:
fatal error: linux/modversions.h: file or directory not found
but in
/usr/src contains the symlink to the linux souce indeed
ls -l /usr/scr/
drwxr-xr-x 2 root root 4096 apr 26 13:31 fglrx-14.9+ga14.201
lrwxrwxrwx 1 root root 39 lug 11 13:36 linux -> /home/nhoya/Scaricati/linux-source-3.16
drwxr-xr-x 2 root root 4096 lug 10 17:49 linux-config-3.16
drwxr-xr-x 4 root root 4096 lug 10 15:57 linux-headers-3.2.0-4-amd64
drwxr-xr-x 4 root root 4096 apr 26 22:24 linux-headers-3.2.0-4-common
lrwxrwxrwx 1 root root 23 giu 24 2012 linux-kbuild-3.2 -> ../lib/linux-kbuild-3.2
-rw-r--r-- 1 root root 81869308 mag 24 20:24 linux-source-3.16.tar.xz
drwxr-xr-x 12 root root 4096 giu 7 23:31 virtualbox-4.3.18
and
locate modversions.h
/home/nhoya/Scaricati/linux-source-3.16/include/config/modversions.h
/usr/src/linux-headers-3.2.0-4-amd64/include/config/modversions.h
So, i really don't understand the problem... this is the module source
#define __KERNEL__
#define MODULE
#include <linux/modversions.h>
#include <linux/module.h>
#include <linux/tty.h>
int init_mod()
{
console_print("test\n");
return 0;
}
void cleanup_mod()
{
console_print("fine test\n");
}

Resources