Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Beginner
44 Views

DYLD_LIBRARY_PATH not loading in gdb-ia on OS X

Hi

Trying out 2017 beta version of Fortran (I also have the previous 2013 ifort version) but I'm having a challenge with  gdb-ia. I have my .bash_profile set so that DYLD_LIBRARY_PATH is set so that on the command line I get 

echo $DYLD_LIBRARY_PATH/libiomp5.dylib

 

/opt/intel/compilers_and_libraries_2017.0.039/mac/compiler/lib/libiomp5.dylib

 
When in gdb-ia I get the following
 

(gdb) set environment DYLD_LIBRARY_PATH /opt/intel/compilers_and_libraries_2017.0.039/mac/compiler/lib

(gdb) run

The program being debugged has been started already.

Start it from the beginning? (y or n) y

Starting program: ~/LMSafe 

dyld: Library not loaded: @rpath/libiomp5.dylib

  Referenced from: ~/LMSafe

  Reason: image not found

 

Program received signal SIGTRAP, Trace/breakpoint trap.

0x00007fff5fc01075 in ?? ()

 

(gdb) 

in gdb-ia show environment gives.. 
 

DYLD_LIBRARY_PATH=/opt/intel/compilers_and_libraries_2017.0.039/mac/compiler/lib

 
 
If I run from 2013’s idb it works (even though I had to manually set the path in idb)
 
(idb) set environment DYLD_LIBRARY_PATH /opt/intel/compilers_and_libraries_2017.0.039/mac/compiler/lib
(idb) run
Program exited normally.
Starting program: ~/LMSafe

 

 Levenberg Marquardt XOR took::  4.892110824584961E-003 seconds.
                   200

 

 Output:=   0.461050158803991                          1
 Output:=   0.464174557964011                          2
 Output:=   0.463944152735494                          3
 Output:=   0.466966905109538                          4
Program exited normally.
(idb) 
 
any ideas?

 

 

0 Kudos
3 Replies
Beginner
44 Views

apologies for untidy post, the default editor here doesn't seem to handle carriage return properly so I just and pasted from a text editor, looked OK before I posted ;-(

0 Kudos
Beginner
44 Views

For info I also tried 

install_name_tool -change libiomp5.dylib /opt/intel/compilers_and_libraries_2017.0.039/mac/compiler/lib/libiomp5.dylib ~/LMSafe

otool -l LMSafe
LMSafe:
Load command 0
      cmd LC_SEGMENT_64
  cmdsize 72
  segname __PAGEZERO
   vmaddr 0x0000000000000000
   vmsize 0x0000000100000000
  fileoff 0
 filesize 0
  maxprot 0x00000000
 initprot 0x00000000
   nsects 0
    flags 0x0
Load command 1
      cmd LC_SEGMENT_64
  cmdsize 552
  segname __TEXT
   vmaddr 0x0000000100000000
   vmsize 0x00000000009dd000
  fileoff 0
 filesize 10342400
  maxprot 0x00000007
 initprot 0x00000005
   nsects 6
    flags 0x0
Section
  sectname __text
   segname __TEXT
      addr 0x0000000100000d00
      size 0x00000000008e4820
    offset 3328
     align 2^8 (256)
    reloff 0
    nreloc 0
     flags 0x80000400
 reserved1 0
 reserved2 0
Section
  sectname __stubs
   segname __TEXT
      addr 0x00000001008e5520
      size 0x000000000000039c
    offset 9327904
     align 2^1 (2)
    reloff 0
    nreloc 0
     flags 0x80000408
 reserved1 0 (index into indirect symbol table)
 reserved2 6 (size of stubs)
Section
  sectname __stub_helper
   segname __TEXT
      addr 0x00000001008e58bc
      size 0x0000000000000614
    offset 9328828
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x80000400
 reserved1 0
 reserved2 0
Section
  sectname __const
   segname __TEXT
      addr 0x00000001008e5f00
      size 0x0000000000060668
    offset 9330432
     align 2^6 (64)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Section
  sectname __cstring
   segname __TEXT
      addr 0x0000000100946580
      size 0x000000000001b13f
    offset 9725312
     align 2^5 (32)
    reloff 0
    nreloc 0
     flags 0x00000002
 reserved1 0
 reserved2 0
Section
  sectname __eh_frame
   segname __TEXT
      addr 0x00000001009616c0
      size 0x000000000007b8a0
    offset 9836224
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Load command 2
      cmd LC_SEGMENT_64
  cmdsize 632
  segname __DATA
   vmaddr 0x00000001009dd000
   vmsize 0x00000000001d9000
  fileoff 10342400
 filesize 516096
  maxprot 0x00000007
 initprot 0x00000003
   nsects 7
    flags 0x0
Section
  sectname __got
   segname __DATA
      addr 0x00000001009dd000
      size 0x0000000000000080
    offset 10342400
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000006
 reserved1 154 (index into indirect symbol table)
 reserved2 0
Section
  sectname __nl_symbol_ptr
   segname __DATA
      addr 0x00000001009dd080
      size 0x0000000000000010
    offset 10342528
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000006
 reserved1 170 (index into indirect symbol table)
 reserved2 0
Section
  sectname __la_symbol_ptr
   segname __DATA
      addr 0x00000001009dd090
      size 0x00000000000004d0
    offset 10342544
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000007
 reserved1 172 (index into indirect symbol table)
 reserved2 0
Section
  sectname __mod_init_func
   segname __DATA
      addr 0x00000001009dd560
      size 0x0000000000000008
    offset 10343776
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000009
 reserved1 0
 reserved2 0
Section
  sectname __data
   segname __DATA
      addr 0x00000001009de000
      size 0x000000000007c9e0
    offset 10346496
     align 2^12 (4096)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Section
  sectname __common
   segname __DATA
      addr 0x0000000100a5a9e0
      size 0x0000000000000080
    offset 0
     align 2^5 (32)
    reloff 0
    nreloc 0
     flags 0x00000001
 reserved1 0
 reserved2 0
Section
  sectname __bss
   segname __DATA
      addr 0x0000000100a5aa60
      size 0x000000000015a780
    offset 0
     align 2^5 (32)
    reloff 0
    nreloc 0
     flags 0x00000001
 reserved1 0
 reserved2 0
Load command 3
      cmd LC_SEGMENT_64
  cmdsize 72
  segname __LINKEDIT
   vmaddr 0x0000000100bb6000
   vmsize 0x0000000000061000
  fileoff 10858496
 filesize 394488
  maxprot 0x00000007
 initprot 0x00000001
   nsects 0
    flags 0x0
Load command 4
            cmd LC_DYLD_INFO_ONLY
        cmdsize 48
     rebase_off 0
    rebase_size 0
       bind_off 10858496
      bind_size 264
  weak_bind_off 0
 weak_bind_size 0
  lazy_bind_off 10858760
 lazy_bind_size 3056
     export_off 10861816
    export_size 51320
Load command 5
     cmd LC_SYMTAB
 cmdsize 24
  symoff 10921640
   nsyms 9109
  stroff 11068688
 strsize 184296
Load command 6
            cmd LC_DYSYMTAB
        cmdsize 80
      ilocalsym 0
      nlocalsym 6512
     iextdefsym 6512
     nextdefsym 2436
      iundefsym 8948
      nundefsym 161
         tocoff 0
           ntoc 0
      modtaboff 0
        nmodtab 0
   extrefsymoff 0
    nextrefsyms 0
 indirectsymoff 11067384
  nindirectsyms 326
      extreloff 0
        nextrel 0
      locreloff 0
        nlocrel 0
Load command 7
          cmd LC_LOAD_DYLINKER
      cmdsize 32
         name /usr/lib/dyld (offset 12)
Load command 8
     cmd LC_UUID
 cmdsize 24
    uuid 26BE3F43-671C-3950-94BD-EB3503684C68
Load command 9
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.11.4
      sdk 10.11
Load command 10
      cmd LC_SOURCE_VERSION
  cmdsize 16
  version 0.0
Load command 11
       cmd LC_MAIN
   cmdsize 24
  entryoff 3328
 stacksize 0
Load command 12
          cmd LC_LOAD_DYLIB
      cmdsize 56
         name /usr/lib/libSystem.B.dylib (offset 24)
   time stamp 2 Thu Jan  1 01:00:02 1970
      current version 1226.10.1
compatibility version 1.0.0
Load command 13
          cmd LC_LOAD_DYLIB
      cmdsize 48
         name @rpath/libiomp5.dylib (offset 24)
   time stamp 2 Thu Jan  1 01:00:02 1970
      current version 5.0.0
compatibility version 5.0.0
Load command 14
      cmd LC_FUNCTION_STARTS
  cmdsize 16
  dataoff 10913136
 datasize 8504
Load command 15
      cmd LC_DATA_IN_CODE
  cmdsize 16
  dataoff 10921640
 datasize 0

 

0 Kudos
Employee
44 Views

Hello,

if you run it outside the debugger:

$ ~/LMSafe
...will fail because @rpath/libiomp5.dylib is not found.

$ DYLD_LIBRARY_PATH=/opt/intel/compilers_and_libraries_2017.0.039/mac/compiler/lib ~/LMSafe
...will work as libiomp5.dylib is found.

Is my assumption correct?

If so, could you try to link with "-rpath" set to /opt/intel/compilers_and_libraries_2017.0.039/mac/compiler/lib? "otool -l" should show an entry "cmd LC_RPATH" with the proper path set. Does this work then with gdb-ia?

So far I can see the same symptom but once I set the environment in GDB (set environment DYLD_LIBRARY_PATH <path>) it works.

Could you please also try the latest 2017 BETA Update 1 release? This update will be available end of the week.

Best regards,

Georg Zitzlsberger

 

0 Kudos