diff --git a/Cabal/Distribution/Simple/Compiler.hs b/Cabal/Distribution/Simple/Compiler.hs
index e2607405e3a4b2fd140555d427661250a1c4aff3..141c33b94f9f1188abea86b44aa55d368ae6d60a 100644
--- a/Cabal/Distribution/Simple/Compiler.hs
+++ b/Cabal/Distribution/Simple/Compiler.hs
@@ -63,6 +63,7 @@ module Distribution.Simple.Compiler (
         backpackSupported,
         arResponseFilesSupported,
         libraryDynDirSupported,
+        libraryVisibilitySupported,
 
         -- * Support for profiling detail levels
         ProfDetailLevel(..),
@@ -380,6 +381,15 @@ profilingSupported comp =
     GHCJS -> True
     _     -> False
 
+-- | Does this compiler support a package database entry with:
+-- "visibility"?
+libraryVisibilitySupported :: Compiler -> Bool
+libraryVisibilitySupported comp = case compilerFlavor comp of
+  GHC -> v >= mkVersion [8,8]
+  _   -> False
+ where
+  v = compilerVersion comp
+
 -- | Utility function for GHC only features
 ghcSupported :: String -> Compiler -> Bool
 ghcSupported key comp =
diff --git a/cabal-install/Distribution/Client/ProjectPlanning.hs b/cabal-install/Distribution/Client/ProjectPlanning.hs
index 5c3a345c432fd0e6e5e50c09cc23cccb36e93896..c32b2de25322af0180d2029b52e89c0b55d9defb 100644
--- a/cabal-install/Distribution/Client/ProjectPlanning.hs
+++ b/cabal-install/Distribution/Client/ProjectPlanning.hs
@@ -3412,9 +3412,7 @@ setupHsConfigureFlags (ReadyPackage elab@ElaboratedConfiguredPackage{..})
     configUserInstall         = mempty -- don't rely on defaults
     configPrograms_           = mempty -- never use, shouldn't exist
     configUseResponseFiles    = mempty
-    -- TODO set to true when the solver can prevent private-library-deps by itself
-    -- (issue #6039)
-    configAllowDependingOnPrivateLibs = mempty
+    configAllowDependingOnPrivateLibs = Flag $ not $ libraryVisibilitySupported pkgConfigCompiler
 
 setupHsConfigureArgs :: ElaboratedConfiguredPackage
                      -> [String]
diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/Successful/cabal.test.hs b/cabal-testsuite/PackageTests/MultipleLibraries/Successful/cabal.test.hs
index 393ca17b51c9b6c8aa8870f58b383a43c47c20e2..886065891928aefde6b620d82014b4a07773dbb5 100644
--- a/cabal-testsuite/PackageTests/MultipleLibraries/Successful/cabal.test.hs
+++ b/cabal-testsuite/PackageTests/MultipleLibraries/Successful/cabal.test.hs
@@ -1,7 +1,4 @@
 import Test.Cabal.Prelude
-main = cabalTest $ do
-    -- https://github.com/haskell/cabal/pull/6047 should make this work for older GHCs too?
-    skipIf =<< ghcVersionIs (< mkVersion [8,8])
-
+main = cabalTest $
     cabal' "v2-run" ["pkg-abc:program"] >>= assertOutputContains "pkg-def:publib"
 
diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/T6083Pre/cabal.test.hs b/cabal-testsuite/PackageTests/MultipleLibraries/T6083Pre/cabal.test.hs
index 5819f9cb2ecde87f33be063012970c65e3056090..1aa1889af13232f3e67441a9b1fcbc286221249d 100644
--- a/cabal-testsuite/PackageTests/MultipleLibraries/T6083Pre/cabal.test.hs
+++ b/cabal-testsuite/PackageTests/MultipleLibraries/T6083Pre/cabal.test.hs
@@ -2,8 +2,5 @@ import Test.Cabal.Prelude
 
 -- https://github.com/haskell/cabal/issues/6083
 -- see pkg-abc.cabal
-main = cabalTest $ do
-    -- https://github.com/haskell/cabal/pull/6047 should make this work for older GHCs too?
-    skipIf =<< ghcVersionIs (< mkVersion [8,8])
-
+main = cabalTest $
     cabal' "v2-run" ["pkg-abc:program"] >>= assertOutputContains "pkg-abc:pkg-def"
diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/T6083PreMixin/cabal.test.hs b/cabal-testsuite/PackageTests/MultipleLibraries/T6083PreMixin/cabal.test.hs
index 246480accfc69663e6b12bda4e74016bfdf95cf7..dec445d9afbf5fb13ce5bea4a1993eb80b15abb5 100644
--- a/cabal-testsuite/PackageTests/MultipleLibraries/T6083PreMixin/cabal.test.hs
+++ b/cabal-testsuite/PackageTests/MultipleLibraries/T6083PreMixin/cabal.test.hs
@@ -2,8 +2,5 @@ import Test.Cabal.Prelude
 
 -- This is like T6083Pre, but also goes via mixins
 --
-main = cabalTest $ do
-    -- https://github.com/haskell/cabal/pull/6047 should make this work for older GHCs too?
-    skipIf =<< ghcVersionIs (< mkVersion [8,8])
-
+main = cabalTest $
     cabal' "v2-run" ["pkg-abc:program"] >>= assertOutputContains "pkg-abc:pkg-def"