You are not logged in.

#1 2017-01-17 23:20:30

Tuetuopay
Member
From: Paris, France
Registered: 2017-01-17
Posts: 2
Website

[Patch] swift fails to compile

Hi,

This is just a very simple patch for the package Swift that includes this commit from October. Without this, the package fails to build on both my personal arch system and a Docker container. Although the package uses the release from december, the commit made it into master a few days ago ... I'm still wondering how this could have compiled before ...
How can I integrate this patch in "upstream", aka in the AUR package ? I've done most of the work in a github repository.

Thanks !

Complete patch to the repo, including the updated PKGBUILD :

diff --git a/PKGBUILD b/PKGBUILD
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -26,7 +26,7 @@ source=(
     "swift-corelibs-foundation-${_swiftver}.tar.gz::https://github.com/apple/swift-corelibs-foundation/archive/swift-${_swiftver}.tar.gz"
     "swift-corelibs-libdispatch-${_swiftver}.tar.gz::https://github.com/apple/swift-corelibs-libdispatch/archive/swift-${_swiftver}.tar.gz"
     "swift-integration-tests-${_swiftver}.tar.gz::https://github.com/apple/swift-integration-tests/archive/swift-${_swiftver}.tar.gz"
-    "swift-sphinx2.patch" "xar-1.6.patch" "build-script.patch"
+    "swift-sphinx2.patch" "xar-1.6.patch" "build-script.patch" "swift-init-CachedVFile.patch"
 )
 sha256sums=('e69764cb3d83d7209f21c2af448ae39e6612df28e37b7a3ceffa9c24f19ca0cc'
             '194f66f522aa349061ae682bab18fa3fffe146da30e30f2d9f4b811fd544f8eb'
@@ -41,7 +41,8 @@ sha256sums=('e69764cb3d83d7209f21c2af448ae39e6612df28e37b7a3ceffa9c24f19ca0cc'
             '90cb9573f22ed62d49ffff4de0e92fefdb3044a7e19391bbc14a63cc4f0ca27b'
             '93bbe769666aab15b15d12e2423f213b39d6c47237eafc781569698c8367535f'
             'df27c2bfeaed6335f49a8815b0b296fd5acc331a6a9361a40f7dfc69a7518da6'
-            '9f2512df8c495e2b8bf19fe213e951cdd17df9207538ceb8ab59a30bd6a18e3f')
+            '9f2512df8c495e2b8bf19fe213e951cdd17df9207538ceb8ab59a30bd6a18e3f'
+            '49d1e9136a66f66bdd49fa85909645f1a54b8741efd3f3d6d29907ebed9a8726')
 
 prepare() {
     # Use python2 where appropriate
@@ -77,6 +78,9 @@ prepare() {
 
     # Typo in build-script
     ( cd "${srcdir}/swift" && patch -p1 -i "${srcdir}/build-script.patch" )
+
+    # Fix for missing initialization
+    ( cd "${srcdir}/swift" && patch -p1 -i "${srcdir}/swift-init-CachedVFile.patch" )
 }
 
 build() {
diff --git a/swift-init-CachedVFile.patch b/swift-init-CachedVFile.patch
--- /dev/null
+++ b/swift-init-CachedVFile.patch
@@ -0,0 +1,33 @@
+diff --git a/include/swift/Basic/SourceManager.h b/include/swift/Basic/SourceManager.h
+--- a/include/swift/Basic/SourceManager.h
++++ b/include/swift/Basic/SourceManager.h
+@@ -40,7 +40,7 @@ class SourceManager {
+     int LineOffset;
+   };
+   std::map<const char *, VirtualFile> VirtualFiles;
+-  mutable std::pair<const char *, const VirtualFile*> CachedVFile = {};
++  mutable std::pair<const char *, const VirtualFile*> CachedVFile = {nullptr, nullptr};
+ 
+ public:
+   llvm::SourceMgr &getLLVMSourceMgr() {
+diff --git a/lib/Basic/SourceLoc.cpp b/lib/Basic/SourceLoc.cpp
+--- a/lib/Basic/SourceLoc.cpp
++++ b/lib/Basic/SourceLoc.cpp
+@@ -82,7 +82,7 @@ bool SourceManager::openVirtualFile(SourceLoc loc, StringRef name,
+ 
+   CharSourceRange range = CharSourceRange(*this, loc, end);
+   VirtualFiles[end.Value.getPointer()] = { range, name, lineOffset };
+-  CachedVFile = {};
++  CachedVFile = {nullptr, nullptr};
+   return true;
+ }
+ 
+@@ -99,7 +99,7 @@ void SourceManager::closeVirtualFile(SourceLoc end) {
+ #endif
+     return;
+   }
+-  CachedVFile = {};
++  CachedVFile = {nullptr, nullptr};
+ 
+   CharSourceRange oldRange = virtualFile->Range;
+   virtualFile->Range = CharSourceRange(*this, virtualFile->Range.getStart(),

Offline

#2 2017-01-18 01:19:00

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [Patch] swift fails to compile

1) Don't bundle patches if you can pull them, e.g. https://github.com/apple/swift/commit/0 … d2e4.patch

2) Post a note on the AUR page about it, not here. The AUR maintainer may not be looking here, but he will be subscribed to notifications about his own package. wink


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2017-01-18 08:02:11

Tuetuopay
Member
From: Paris, France
Registered: 2017-01-17
Posts: 2
Website

Re: [Patch] swift fails to compile

1. Yep you're right ! I just wrote the fix by hand before realising it was in the official Github repository x)

2. Thanks, that exactly was my question !

Offline

Board footer

Powered by FluxBB