https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249951

            Bug ID: 249951
           Summary: installworld results bad symbolic links to libraries
                    and non-root users get link error like -lgcc_s
           Product: Base System
           Version: 11.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: b...@freebsd.org
          Reporter: o...@j.email.ne.jp

After running installworld, non-root users cannot properly read symbolic links
from /usr/lib and causing link error like not finding -lgcc_s library.

Root user can link a program without a problem while all others fails to link.

I have / and /usr separate mount points.


After each installworld, I need to run the following to adjust symbolic links:

cd /usr/lib
ls -l *.so | nawk '$NF ~ /..\/..\/lib/{cmd="ln -sf " substr($NF, 6) " "
$(NF-2);system(cmd)}'


These are the commands to expose errors and comparison between a root user and
non-root user.

% is command as my own user account.
$ is the root user.


% uname -a
FreeBSD XXX 12.2-BETA2 FreeBSD 12.2-BETA2 #348 r365986M: Sat Sep 19 14:36:23
EDT 2020     hiro@XXX:/usr/obj/usr/src/i386.i386/sys/ZFS  i386

% cd /tmp
% cat main.c 
int main()
{
    return 0;
}
% cc main.c 
ld: error: unable to find library -lgcc_s
ld: error: unable to find library -lgcc_s
cc: error: linker command failed with exit code 1 (use -v to see invocation)
% c++ main.c 
c++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is
deprecated [-Wdeprecated]
ld: error: cannot open /usr/lib/libcxxrt.so: Permission denied
ld: error: unable to find library -lgcc_s
ld: error: unable to find library -lgcc_s
c++: error: linker command failed with exit code 1 (use -v to see invocation)
% ls -lsd /usr/lib/libcxxrt.so 
0 lrwxr-xr-x  1 root  wheel  23 Sep 21 23:27 /usr/lib/libcxxrt.so ->
../../lib/libcxxrt.so.1
% ls -lsd /lib/libcxxrt.so.1
90 -r--r--r--  1 root  wheel  90644 Sep 21 23:27 /lib/libcxxrt.so.1
% mount
/dev/ada0s4a on / (ufs, local, soft-updates)
devfs on /dev (devfs, local, multilabel)
/dev/ada0s4d on /usr (ufs, local, noatime, soft-updates)
/dev/ada0s4e on /usr/local (ufs, local, noatime, soft-updates)


$ cc main.c
$ ./a.out
$

I had run the re-link program from comment above.

% ls -lsd /usr/lib/libcxxrt.so /lib/libcxxrt.so.1
90 -r--r--r--  1 root  wheel  90644 Sep 21 23:27 /lib/libcxxrt.so.1
 0 lrwxr-xr-x  1 root  wheel     23 Sep 21 23:27 /usr/lib/libcxxrt.so ->
../../lib/libcxxrt.so.1
% ls -lsd /usr/lib/libcxxrt.so /lib/libcxxrt.so.1
90 -r--r--r--  1 root  wheel  90644 Sep 21 23:27 /lib/libcxxrt.so.1
 0 lrwxr-xr-x  1 root  wheel     18 Sep 22 22:58 /usr/lib/libcxxrt.so ->
/lib/libcxxrt.so.1

% cc main.c 
% ./a.out 
%

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to