LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to use '-Wl,-rpath" on build time? (https://www.linuxquestions.org/questions/linux-software-2/how-to-use-wl-rpath-on-build-time-4175601208/)

poplinux 03-07-2017 12:51 AM

How to use '-Wl,-rpath" on build time?
 
Dear Sir.

My code is very simple, But occured the error on build time.

Library location : /home/myhome/project/lib/libpci.so.3
Header location : /home/myhome/project/include/pci/pci.h
build location : /home/myhome/project/

source
Code:

#define index shadow_workaround_index
#include <pci/pci.h>
struct pci_access *pacc;
struct pci_dev *dev = {0};
int main(int argc, char **argv)
{
  (void) argc;
  (void) argv;
  pacc = pci_alloc();
  dev = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, 1);
  return 0;
}

build
Code:

gcc -I/home/myhome/project/include -Wl,-rpath=/home/myhome/project/lib -o out out.c -L/home/myhome/project/lib -lpci

error message
Code:

$ > make
..
..
/bin/ld: cannot find -lpci

What happen to me???
Please advise to me.

Thank you.

rtmistler 03-07-2017 09:53 AM

I'd try taking out the -rpath term. And verify that you have a file named libpci.so in your /home/myhome/project/lib directory.

poplinux 03-07-2017 06:27 PM

Quote:

Originally Posted by rtmistler (Post 5680228)
I'd try taking out the -rpath term. And verify that you have a file named libpci.so in your /home/myhome/project/lib directory.

You're right.

Thank you.


All times are GMT -5. The time now is 11:26 AM.