How to change library default dir for gcc or add another path?

5,495

Try setting LD_LIBRARY_PATH before compiling, in a bash console type:

export LD_LIBRARY_PATH="your_new_lib_path"

or, to keep the previous settings and just prepend your new library path:

export LD_LIBRARY_PATH="your_new_lib_path:$LD_LIBRARY_PATH"
Share:
5,495

Related videos on Youtube

sparcboy
Author by

sparcboy

Just a DevOps, who's passionate about scaling and automation. Who doesn't want to do less job anyway? DevOps practices brought a new way to decrease maintenance for the whole company, which is basically increase of profit up to 80% in some cases! My background is mostly Python with HA web services. Currently working with Kubernetes and Terraform.

Updated on September 17, 2022

Comments

  • sparcboy
    sparcboy almost 2 years

    Related topic is here

    Tried to link some files to /lib like this

    [/opt/lib] # ln -s libncurses.so.5.7 /lib/
    [/opt/lib] # ln -s libncursesw.so.5.7 /lib/
    

    Compiler still can't find any ncurses libs...

    Trying to compile menuconfig in psybnc source. Where those auto tools seeking libraries? How to debug auto tools or just tell me how to add another library path because /opt/lib need to be used instead of /lib or any other place where auto tools are seeking.

    p.s. this doesn't work

    [/share/HDA_DATA/Linux/psybnc] # export LD_LIBRARY_PATH="/opt/lib:$LD_LIBRARY_PATH"         
    [/share/HDA_DATA/Linux/psybnc] # make menuconfig
    Initializing Menu-Configuration
    [*] Running Conversion Tool for older psyBNC Data.
    Using existent configuration File.
    [*] Running Autoconfig.
    System: Linux
    Socket Libs: Internal.
    Environment: Internal.
    Time-Headers: in time.h and sys/time.h
    Byte order: Big Endian.
    IPv6-Support: Yes, general support. But no interface configured.
    async-DNS-Support: Yes.
    SSL-Support: No openssl found. Get openssl at www.openssl.org
    Creating Makefile
    [*] Creating Menu, please wait.
    This needs the ncurses library. If it is not available, menuconf wont work. If you are using curses, use make menuconfig-curses instead.
    
    [/share/HDA_DATA/Linux/psybnc] # ls /opt/lib | grep libncurses
    libncurses.so@
    libncurses.so.5@
    libncurses.so.5.7*
    libncursesw.so@
    libncursesw.so.5@
    libncursesw.so.5.7*
    

    UPDATE:

    this topic flagged for removal, answer is posted on related topic which I mentioned above

  • sparcboy
    sparcboy over 13 years
    updated post, doesn't work
  • rems
    rems over 13 years
    Is /opt/lib listed in /etc/ld.so.conf ? Did you run ldconfig ? What operating system are you running? Are the ncurses development packages installed?
  • sparcboy
    sparcboy over 13 years
    oh man... have you read related topic? =/ Linux NAS-LI 2.6.33.2 #1 Wed Jan 5 02:06:35 CST 2011 armv5tel unknown , libs installed with IPKG packet manager (native), /opt/lib is in ld.so.conf. ldconfig shows absolutely nothing. file command: /opt/lib/libncurses.so.5.7: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, stripped
  • rems
    rems over 13 years
    Have you installed the ncurses-devel package ?
  • sparcboy
    sparcboy over 13 years
    that was no, but that is a part of an answer=)