GabrielZ

Q: Why does my executable not run under bash ?

I've got a command line executable (compiled using nvcc and clang), which works fine when I run it from the command line.

This means it's executed from the tcsh (which is my interactive shell).

 

However, when I try to run the same executable from the bash , either a bash script or the interactive bash,

it fails with the error message

 

dyld: Symbol not found: _iconv

  Referenced from: /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/Languag eModeling

  Expected in: /opt/local/lib/libiconv.2.dylib

in /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/Languag eModeling

 

But the library is there in /opt/local/lib.

 

Any hints what I can check will be greatly appreciated.

 

Best regards,

Gabriel.

MacBook Pro with Retina display, OS X El Capitan (10.11.2), iPhone 6S, always latest iOS

Posted on Jan 12, 2016 2:49 PM

Close

Q: Why does my executable not run under bash ?

  • All replies
  • Helpful answers

  • by Tony T1,

    Tony T1 Tony T1 Jan 12, 2016 5:21 PM in response to GabrielZ
    Level 6 (9,249 points)
    Mac OS X
    Jan 12, 2016 5:21 PM in response to GabrielZ

    In your script, do you have the following as the 1st line:

    #!//bin/tcsh

  • by GabrielZ,

    GabrielZ GabrielZ Jan 13, 2016 6:26 AM in response to Tony T1
    Level 1 (37 points)
    Desktops
    Jan 13, 2016 6:26 AM in response to Tony T1

    Thanks a lot for your response!

     

    Yes, this is my complete script

     

    #!/bin/tcsh
    
    echo LD_LIBRARY_PATH
    echo $LD_LIBRARY_PATH
    
    ./particles -n=30000
    

    Actually, LD_LIBRARY_PATH  is not defined, when i run this script. This is very puzzling to me, too, because I thought that the executable (in this case the tcsh) inherits all environment variables from the parent. And when I do setenv in my interactive shell, I can clearly see LD_LIBRARY_PATH  .

  • by GabrielZ,

    GabrielZ GabrielZ Jan 13, 2016 7:12 AM in response to GabrielZ
    Level 1 (37 points)
    Desktops
    Jan 13, 2016 7:12 AM in response to GabrielZ

    It seems like I actually need to define the environment variable in the script itself again. This works

     

    #!/bin/bash

     

    CUDA="/Developer/NVIDIA/CUDA-6.5"

    export DYLD_FALLBACK_LIBRARY_PATH=":/usr/local/lib:/opt/local/lib:/usr/X11R6/lib:${CUD A}/lib:${CUDA}/samples/common/lib/darwin"

    ./particles -n=30000

     

    It is a mystery to me why the bash script does not inherit the value of DYLD_FALLBACK_LIBRARY_PATH from its parent (in this case, my interactive shell).