             }
             sdkPath = AbsolutePath(sdkPathStr)
         }
+#else
+        sdkPath = nil
+#endif
 
         // Compute common arguments for clang and swift.
         var extraCCFlags: [String] = []
         var extraSwiftCFlags: [String] = []
+#if os(macOS)
         if let sdkPaths = Destination.sdkPlatformFrameworkPaths(environment: environment) {
             extraCCFlags += ["-F", sdkPaths.fwk.pathString]
             extraSwiftCFlags += ["-F", sdkPaths.fwk.pathString]
             extraSwiftCFlags += ["-I", sdkPaths.lib.pathString]
             extraSwiftCFlags += ["-L", sdkPaths.lib.pathString]
         }
+#endif
+
+#if !os(Windows)
+        extraCCFlags += ["-fPIC"]
+#endif
+
+        var extraCPPFlags: [String] = []
+#if os(macOS)
+        extraCPPFlags += ["-lc++"]
+#else
+        extraCPPFlags += ["-lstdc++"]
+#endif
 
         return Destination(
             target: nil,

            binDir: binDir,
            extraCCFlags: extraCCFlags,
            extraSwiftCFlags: extraSwiftCFlags,
            extraCPPFlags: ["-lc++"]
        )
      #else
        return Destination(
            target: nil,
            sdk: nil,
            binDir: binDir,
            extraCCFlags: ["-fPIC"],
            extraSwiftCFlags: [],
            extraCPPFlags: ["-lstdc++"]
        )
      #endif
    }

    /// Returns macosx sdk platform framework path.

        let binDir = customBinDir ?? binDir ?? Destination.hostBinDir(
            originalWorkingDirectory: originalWorkingDirectory)

        let sdkPath: AbsolutePath?
#if os(macOS)
        // Get the SDK.
        if let value = lookupExecutablePath(filename: ProcessEnv.vars["SDKROOT"]) {
            sdkPath = value
        } else {
