NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Install/use Shared Library on cRIO-9039

Hmm, curious, can you check something quickly?

// Get a few tools installed

opkg update

opkg install binutils file

// Check some basics

file /path/to/forrest

// Get complete info on file

readelf -a /path/to/forrest &> forrest.elfinfo

The forrest.elfinfo file will likely be large, can you simply attach to a post. The output of the file command will short, just post the output to that.

0 Kudos
Message 21 of 29
(2,176 Views)

BradM wrote:

Hmm, curious, can you check something quickly?

// Get a few tools installed

opkg update

opkg install binutils file

// Check some basics

file /path/to/forrest

// Get complete info on file

readelf -a /path/to/forrest &> forrest.elfinfo

The forrest.elfinfo file will likely be large, can you simply attach to a post. The output of the file command will short, just post the output to that.

admin@NI-cRIO-9039-01B54B5A:~/bin# file ./fortest

./fortest: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), stripped

admin@NI-cRIO-9039-01B54B5A:~/bin# readelf -a ./fortest

ELF Header:

  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00

  Class:                             ELF64

  Data:                              2's complement, little endian

  Version:                           1 (current)

  OS/ABI:                            UNIX - System V

  ABI Version:                       0

  Type:                              EXEC (Executable file)

  Machine:                           Advanced Micro Devices X86-64

  Version:                           0x1

  Entry point address:               0x400930

  Start of program headers:          64 (bytes into file)

  Start of section headers:          14392 (bytes into file)

  Flags:                             0x0

  Size of this header:               64 (bytes)

  Size of program headers:           56 (bytes)

  Number of program headers:         9

  Size of section headers:           64 (bytes)

  Number of section headers:         38

  Section header string table index: 35

Section Headers:

  [Nr] Name              Type             Address           Offset

       Size              EntSize          Flags  Link  Info  Align

  [ 0] <no-name>         LOOS+76e6172     2e006f666e695f67  62615f6775626564

       65642e0076657262  6265642e00727473 WXSIOGxxxop      1600615778   1701734764     6874592421672660480

  [ 1] <no-name>         2e00636f: <unkn  000000007365676e  00000000

       0000000000000000  0000000000000000 XSIOTxxxolp       0     0     0

  [ 2] <no-name>         NULL             0000000000000000  10000001b00

       0000000000000200  0000000000001c00          1073887232     0     145408

  [ 3] <no-name>         NULL             0000000000000000  70000002300

       0000000000000200  0000000000002000   O      1073894400     0     152576

  [ 4] <no-name>         NULL             0000000000000000  70000003100

       0000000000000200  0000000000002400   T      1073902592     0     160768

  [ 5] <no-name>         NULL             0000000000000000  fffff60000004400

       000000000000026f  0000000000003800   T      1073911808     0     169984

  [ 6] <no-name>         NULL             0000000000000000  b0000004e00

       0000000000000200  000000000001f800   x      1073926144     0     184320

  [ 7] <no-name>         00000100: <unkn  0000000000001800  30000005600

       0000000000000200  000000000001a300   x      1074055168     0     313344

  [ 8] <no-name>         NULL             0000000000000000  ffffff0000005e00

       000000000000026f  0000000000002a00   O      1074162688     0     420864

  [ 9] <no-name>         NULL             0000000000000200  fffffe0000006b00

       000000000000026f  0000000000005000   G      1074173952     0     432128

  [10] <no-name>         00000200: <unkn  0000000000000000  40000007a00

       0000000000000200  0000000000001800   x      1074194432     0     452608

  [11] <no-name>         NULL             0000000000001800  40000008400

       0000000000004200  0000000000010800   x      1074200576     0     458752

  [12] <no-name>         00001800: <unkn  0000000000001800  10000008e00

       0000000000000600  0000000000001a00   x      1074268160     0     526336

  [13] <no-name>         NULL             0000000000000000  10000008900

       0000000000000600  000000000000c000   T      1074278400     0     536576

  [14] <no-name>         NULL             0000000000001000  10000009400

       0000000000000600  0000000000000800   x      1074327552     0     585728

  [15] <no-name>         NULL             0000000000000000  10000009d00

       0000000000000600  000000000005f200   x      1074331648     0     589824

  [16] <no-name>         NULL             0000000000000000  1000000a300

       0000000000000600  0000000000000900   x      1074721792     0     979968

  [17] <no-name>         NULL             0000000000000000  1000000a900

       0000000000000200  000000000000a800   T      1074724864     0     983040

  [18] <no-name>         NULL             0000000000000000  1000000b100

       0000000000000200  0000000000003c00   x      1074767872     0     1026048

  [19] <no-name>         NULL             0000000000000000  1000000bf00

       0000000000000200  0000000000019c00   T      1074784256     0     1042432

  [20] <no-name>         NULL             0000000000000000  e000000c900

       0000000000000300  0000000000000800   x      1612574720     0     1961984

  [21] <no-name>         NULL             0000000000000000  f000000d500

       0000000000000300  0000000000000800   x      1612576768     0     1964032

  [22] <no-name>         NULL             0000000000000000  1000000e100

       0000000000000300  0000000000000800   x      1612578816     0     1966080

  [23] <no-name>         NULL             0000000000000000  6000000e600

       0000000000000300  000000000001f000   x      1612580864     0     1968128

  [24] <no-name>         NULL             0000000000001000  10000009800

       0000000000000300  0000000000000800   x      1612707840     0     2095104

  [25] <no-name>         NULL             0000000000000800  1000000ef00

       0000000000000300  0000000000007000   x      1612709888     0     2097152

  [26] <no-name>         NULL             0000000000000800  1000000f800

       0000000000000300  0000000000001000   x      1612738560     0     2125824

  [27] <no-name>         NULL             0000000000000000  8000000fe00

       0000000000000300  0000000000000800   x      1612742656     0     2129920

  [28] <no-name>         NULL             0000000000000000  10000010300

       0000000000003000  0000000000003400   O       0     0     2129920

  [29] <no-name>         NULL             0000000000000100  10000010c00

       0000000000000000  0000000000004000   O       0     0     2143232

  [30] <no-name>         NULL             0000000000000000  10000011b00

       0000000000000000  00000000060a0d00   O       0     0     2159616

  [31] <no-name>         NULL             0000000000000000  1000001270000

       0000000000000000  00000000011b0000   x       0     0     654180352

  [32] <no-name>         NULL             0000000000000000  1000001350000

       0000000000000000  0000000000b50000   x       0     0     672727040

  [33] <no-name>         NULL             0000000000000000  1000001410000

       0000000000300000  0000000002240000   x       0     0     684589056

  [34] <no-name>         NULL             0000000000010000  10000014c0000

       0000000000000000  0000000000720000   x       0     0     720502784

  [35] <no-name>         NULL             0000000000000000  1000001570000

       0000000000000000  0000000000300000   x       0     0     727973888

  [36] <no-name>         NULL             0000000000000000  3000000110000

       0000000000000000  0000000001650000   x       0     0     919535616

  [37] <no-name>         NULL             0000000000000000  2000000010000

       0000000000000000  0000000007f80000   x       0     0     731381760

Key to Flags:

  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)

  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)

  O (extra OS processing required) o (OS specific), p (processor specific)

There are no section groups in this file.

Program Headers:

  Type           Offset             VirtAddr           PhysAddr

                 FileSiz            MemSiz              Flags  Align

  PHDR           0x0000000000000040 0x0000000000400040 0x0000000000400040

                 0x00000000000001f8 0x00000000000001f8  R E    8

  INTERP         0x0000000000000238 0x0000000000400238 0x0000000000400238

                 0x000000000000001c 0x000000000000001c  R      1

      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]

  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000

                 0x0000000000001184 0x0000000000001184  R E    200000

  LOAD           0x0000000000001df0 0x0000000000601df0 0x0000000000601df0

                 0x0000000000000290 0x0000000000000298  RW     200000

  DYNAMIC        0x0000000000001e08 0x0000000000601e08 0x0000000000601e08

                 0x00000000000001f0 0x00000000000001f0  RW     8readelf: Error: no .dynamic section in the dynamic segment

  NOTE           0x0000000000000254 0x0000000000400254 0x0000000000400254

                 0x0000000000000044 0x0000000000000044  R      4

  GNU_EH_FRAME   0x0000000000000fa8 0x0000000000400fa8 0x0000000000400fa8

                 0x000000000000003c 0x000000000000003c  R      4

  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000

                 0x0000000000000000 0x0000000000000000  RW     10

  GNU_RELRO      0x0000000000001df0 0x0000000000601df0 0x0000000000601df0

                 0x0000000000000210 0x0000000000000210  R      1

Dynamic section at offset 0x1e08 contains 27 entries:

  Tag        Type                         Name/Value

0x0000010000000000 (<unknown>: 10000000000)   0x10000000000

0x0000010000000000 (<unknown>: 10000000000)   0x8d0000000000

0x0000010000000000 (<unknown>: 10000000000)   0x1490000000000

0x00000c0000000000 (<unknown>: c0000000000)   0x4008080000000000

0x00000d0000000000 (<unknown>: d0000000000)   0x400ef40000000000

0x0000190000000000 (<unknown>: 190000000000)    0x601df00000000000

0x00001b0000000000 (<unknown>: 1b0000000000)    0x80000000000

0x00001a0000000000 (<unknown>: 1a0000000000)    0x601df80000000000

0x00001c0000000000 (<unknown>: 1c0000000000)    0x80000000000

0xfffef50000000000 (<unknown>: fffef50000000000)        0x400298000000006f

0x0000050000000000 (<unknown>: 50000000000)   0x4004c80000000000

0x0000060000000000 (<unknown>: 60000000000)   0x4002d00000000000

0x000a0d0000000000 (<unknown>: a0d0000000000)     0x1a3000000000000

0x000b000000000000 (<unknown>: b000000000000)     0x18000000000000

0x0015000000000000 (<unknown>: 15000000000000)      0x0

0x0003000000000000 (<unknown>: 3000000000000)     0x2000000000000000

0x0002000000000060 (<unknown>: 2000000000060)     0x108000000000000

0x0014000000000000 (<unknown>: 14000000000000)      0x7000000000000

0x0017000000000000 (<unknown>: 17000000000000)      0x700000000000000

0x0007000000000040 (<unknown>: 7000000000040)     0x6e8000000000000

0x0008000000000040 (<unknown>: 8000000000040)     0x18000000000000

0x0009000000000000 (<unknown>: 9000000000000)     0x18000000000000

0xfffe000000000000 (<unknown>: fffe000000000000)        0x698000000006fff

0xffff000000000040 (<unknown>: ffff000000000040)        0x2000000006fff

0xfff0000000000000 (<unknown>: fff0000000000000)        0x66c000000006fff

0x0000000000000040 (<unknown>: 40)      0x0

0x0000000000000000 (NULL)               0x0

There are no relocations in this file.

The decoding of unwind sections for machine type Advanced Micro Devices X86-64 is not currently supported.

No version information found in this file.

admin@NI-cRIO-9039-01B54B5A:~/bin#


Paul
0 Kudos
Message 22 of 29
(2,176 Views)

One thing to bear in mind is that this is a test program of what we really need.  A shared object.  The test program only invokes the shared object with a couple recipes to make sure that the shared object is working.


Paul
0 Kudos
Message 23 of 29
(2,175 Views)

I really do appreciate all of the help.  Thank you! Hopefully we find a resolution soon.


Paul
0 Kudos
Message 24 of 29
(2,175 Views)

I think it might be the thing I can't check conveniently from here...the /lib vs. /lib64 difference between distros. Maybe Brad can check: I see from the Ubuntu "file" output that the interpreter it's looking at is /lib64/ld-linux-x86-64.so.2 and I'm not sure that that's the path to that file on our distro. A symlink /lib64 -> /lib might fix it? Sorry I can't be more certain.

0 Kudos
Message 25 of 29
(2,175 Views)

ScotSalmon wrote:

I think it might be the thing I can't check conveniently from here...the /lib vs. /lib64 difference between distros. Maybe Brad can check: I see from the Ubuntu "file" output that the interpreter it's looking at is /lib64/ld-linux-x86-64.so.2 and I'm not sure that that's the path to that file on our distro. A symlink /lib64 -> /lib might fix it? Sorry I can't be more certain.

Thanks Scot for the help.  This has been a few days in the making.  A few more hours and sleep, plus office resources most certainly will help.  I appreciate it.


Paul
0 Kudos
Message 26 of 29
(2,175 Views)

It looks like the NI Linux RT distro has ld-linux-x86-64.so.2 in both /lib and /lib64. It's interesting that the "find" command only found the ld-linux-x86-64.so.2 that is in /lib and not /lib64

Untitled.jpg

Sev K.
Senior Systems R&D Engineer | Wireless | CLA
National Instruments
0 Kudos
Message 27 of 29
(2,175 Views)

find doesn't follow symlinks by default, and /lib64 is a symlink to /lib already. So that's not the issue. We have another lead though.

0 Kudos
Message 28 of 29
(2,175 Views)

Also also, if it's a loader issue, you're faced with the exceedingly-odd "$BINARY: file not found" error, not a segfault. That's at least the case for normally-linked filed, I do find it extremely interesting that ldd reports that this binary is statically linked (which is supported by the fact that the readelf output indicating that there are no NEEDED libraries), yet it includes the INTERP entry in the elf. dlopen() would use libdl, which would either be linked in (in the case of a statically-linked binary) or listed as a NEEDED library.

Any particular reason for statically linking the executable?

0 Kudos
Message 29 of 29
(2,175 Views)