Ld.gold: error: cannot open library

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"

# swift --version
Swift version 5.1.5 (swift-5.1.5-RELEASE)
Target: x86_64-unknown-linux-gnu

# swift build -v                                                                                                                               
lsb_release -r                                                                                                                                                                                              
uname                                                                                                                                                                                                       
pkg-config --variable pc_path pkg-config                                                                                                                                                                    
/opt/swift/usr/bin/swiftc -sdk / -L/usr/lib/x86_64-linux-gnu -lssl -L/usr/lib/x86_64-linux-gnu -lcrypto -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lz -L/usr/lib/x86_64-linux-gnu -lcurl -L/us
r/lib/x86_64-linux-gnu -lssl -L/usr/lib/x86_64-linux-gnu -lcrypto -g -L /home/ubuntu/Home/Multipass/.build/x86_64-unknown-linux/debug -o /home/ubuntu/Home/Multipass/.build/x8
6_64-unknown-linux/debug/antiparsing -module-name appname -emit-executable -Xlinker '-rpath=$ORIGIN' @/home/ubuntu/Home/Multipass/.build/x86_64-unknown-linux/debug/name.product/O
bjects.LinkFileList -target x86_64-unknown-linux -L /opt/swift/usr/lib                                                                                                                                      
/usr/bin/ld.gold: error: cannot open /home/ubuntu/Home/Multipass/.build/x86_64-unknown-linux/debug/NIOPriorityQueue.build/PriorityQueue.swift.o: Operation not permitted                     
/usr/bin/ld.gold: error: cannot open /home/ubuntu/Home/Multipass/.build/x86_64-unknown-linux/debug/NIOTLS.build/ApplicationProtocolNegotiationHandler.swift.o: Operation not permitted       
/usr/bin/ld.gold: error: cannot open /home/ubuntu/Home/Multipass/.build/x86_64-unknown-linux/debug/NIOTLS.build/NIOTLS.swiftmodule.o: Operation not permitted                                
/usr/bin/ld.gold: error: cannot open /home/ubuntu/Home/Multipass/.build/x86_64-unknown-linux/debug/NIOTLS.build/SNIHandler.swift.o: Operation not permitted                                  
/usr/bin/ld.gold: error: cannot open /home/ubuntu/Home/Multipass/.build/x86_64-unknown-linux/debug/NIOTLS.build/TLSEvents.swift.o: Operation not permitted                                   

Issue happens after migrating from 5.0.4 to 5.1.5

That looks like a file permission issue. What are the permissions and ownership for those files?

# ls -l .build/x86_64-unknown-linux/debug/NIOPriorityQueue.build/
total 340
-rw-r--r-- 1 root root   4701 Mar 12 09:22 Heap.d
-rw-r--r-- 1 root root 107744 Mar 12 09:22 Heap.swift.o
-rw-r--r-- 1 root root  21330 Mar 12 09:22 Heap.swiftdeps
-rw-r--r-- 1 root root    356 Mar 12 09:22 Heap~partial.swiftdoc
-rw-r--r-- 1 root root  29420 Mar 12 09:22 Heap~partial.swiftmodule
-rw-r--r-- 1 root root  40528 Mar 12 09:22 NIOPriorityQueue.swiftmodule.o
-rw-r--r-- 1 root root   4728 Mar 12 09:22 PriorityQueue.d
-rw-r--r-- 1 root root  59544 Mar 12 09:22 PriorityQueue.swift.o
-rw-r--r-- 1 root root  11526 Mar 12 09:22 PriorityQueue.swiftdeps
-rw-r--r-- 1 root root    356 Mar 12 09:22 PriorityQueue~partial.swiftdoc
-rw-r--r-- 1 root root  25520 Mar 12 09:22 PriorityQueue~partial.swiftmodule
-rw-r--r-- 1 root root    404 Mar 12 09:22 master.swiftdeps
-rw-r--r-- 1 root root    404 Mar 12 09:22 master.swiftdeps~moduleonly
-rw-r--r-- 1 root root   1542 Mar 12 09:22 output-file-map.json

Issue happens because of Multipass virtualization solution.

1 Like
Terms of Service

Privacy Policy

Cookie Policy