Perl "libpth" is different from GCC library searching path.
Tags: perl, gcc, c, ubuntu
Published: 2021-12-16 06:37:09

**Perl "libpth".**

```
$ perl -V
Summary of my perl5 (revision 5 version 32 subversion 1) configuration:

  Platform:
    osname=linux
    osvers=4.15.0-55-generic
    archname=x86_64-linux
    uname='linux tk2-259-39003 4.15.0-55-generic #60-ubuntu smp tue jul 2 18:22:20 utc 2019 x86_64 x86_64 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/kimoto/perl5/perlbrew/perls/perl-5.32.1 -Aeval:scriptdir=/home/kimoto/perl5/perlbrew/perls/perl-5.32.1/bin'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    optimize='-O2'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='7.5.0'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.27.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.27'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'
```

**GCC library searching path**

```
$ gcc -print-search-dirs | perl -pi -e 's/:/\n/g'
-i used with no filenames on the command line, reading from STDIN.
install
 /usr/lib/gcc/x86_64-linux-gnu/7/
programs
 =/usr/lib/gcc/x86_64-linux-gnu/7/
/usr/lib/gcc/x86_64-linux-gnu/7/
/usr/lib/gcc/x86_64-linux-gnu/
/usr/lib/gcc/x86_64-linux-gnu/7/
/usr/lib/gcc/x86_64-linux-gnu/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/7/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/bin/
libraries
 =/usr/lib/gcc/x86_64-linux-gnu/7/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/7/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/lib/../lib/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/7/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/
/lib/x86_64-linux-gnu/7/
/lib/x86_64-linux-gnu/
/lib/../lib/
/usr/lib/x86_64-linux-gnu/7/
/usr/lib/x86_64-linux-gnu/
/usr/lib/../lib/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/lib/
/usr/lib/gcc/x86_64-linux-gnu/7/../../../
/lib/
/usr/lib/
```

I find this problem when Perl can't find -lgomp although gcc find -lgomp on Ubuntu 18.