Heroku-18 w/ .NET Core GDI+: Unable to load DLL 'libgdiplus': The specified module could not be found - heroku

Since upgrading from Heroku-16 to Heroku-18 stack, my .NET Core 2.2 App that references System.Drawing.Common to use GDI+ throws the error:
System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
--->System.DllNotFoundException: Unable to load DLL 'libgdiplus': The specified module could not be found.
at System.Runtime.InteropServices.FunctionWrapper `1.get_Delegate()
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Gdip..cctor()
This is because libc6-dev is not installed (see this issue). I'm using heroku-buildpack-apt to install both libgdiplus and libc6-dev), but it appears that the package is no longer available at runtime on Heroku-18, only at build time (see this page).
From the build log:
remote: -----> Fetching .debs for libc6-dev
remote: Reading package lists...
remote: Building dependency tree...
remote: Reinstallation of libc6-dev is not possible, it cannot be downloaded.
remote: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reverting back to Heroku-16 solves the issue.
How can this I make this work on the Heroku-18 stack?? Anyone found a way?

From Heroku support:
I am really sorry for the trouble but it will not be possible in my view. This package libc6-dev2.27-3ubuntu1 means that the package is available only at build time, but not at runtime. Moreover if you have some requirement you can check https://elements.heroku.com/buildpacks/eugeneotto/heroku-buildpack-secp256k1 but this is not officially supported buildpack and we do not provide support for this.

.NET Core 3.x, together with the latest version of System.Drawing.Common, contain fixes which remove the dependency on libc6-dev.
If installing libc6-dev is not possible, you can try to:
Upgrade to .NET Core 3.0
Upgrade to libgdiplus 4.6.0 or later (I'd recommend 4.7.0)

Related

Getting error: no matching version `^2.0.0` found for package `codec`?

Question
I'm new to Substrate and going through Add a Pallet to Your Runtime. At first, running the command cargo check -p node-template-runtime gave me error
error: failed to parse manifest at `/Users/bashar/work/substrate/start/substrate-node-template/pallets/template/Cargo.toml`
Caused by:
feature `rename-dependency` is required
consider adding `cargo-features = ["rename-dependency"]` to the manifest
I added it and then I started getting this error:
error: no matching version `^2.0.0` found for package `codec`
location searched: registry `https://github.com/rust-lang/crates.io-index`
versions found: 0.0.0
required by package `frame-benchmarking-cli v3.0.0`
... which is depended on by `node-template v3.0.0 (/Users/bashar/work/substrate/start/substrate-node-template/node)`
I tried modifying the codec version to 2.0.1 with no luck. My setup
rustup 1.23.1
rustc 1.50.0
cargo 1.30.0
Any idea what I'm doing wrong?
UPDATE
I went back to the Create Your First Substrate Chain, which this tutorial is built on, started from scratch, which the Pallet tutorial is based on. And this time, after cloning the repository for first tutorial, cargo build --release failed with the same error feature rename-dependency is required.
This built fine the first time before I moved to the second tutorial. Which makes me think maybe a recent Mac update ruined something? I even tried uninstalling Rust and re-installing it, then installing a new template. Same thing

How to fix library dependence in a conan package

I am trying to install qt/5.14.2 with conan.
Using
qt/5.14.2#bincrafters/stable
I receive
ERROR: libpq/11.5: Error in package_info() method, line 211
self.cpp_info.components["pq"].requires.append("zlib::zlib")
AttributeError: 'Component' object has no attribute 'requires'
OK, there is a bug in libpq/11.5
I am trying to downgrade to
libpq/11.4#bincrafters/stable
ERROR: Conflict in qt/5.14.2#bincrafters/stable:
'qt/5.14.2#bincrafters/stable' requires 'zlib/1.2.11' while 'libpq/11.4#bincrafters/stable' requires 'zlib/1.2.11#conan/stable'.
To fix this conflict you need to override the package 'zlib' in your root package.
BTW:
Why is it not enough to require the correct version of the library, and requiring the same repository? (and require two different repositories in two different packages for the same dependence)
OK, I attempted
zlib/1.2.11#bincrafters/stable
WARN: libpq/11.4#bincrafters/stable: requirement zlib/1.2.11#conan/stable overridden by your conanfile to zlib/1.2.11#bincrafters/stable
zlib/1.2.11#bincrafters/stable: Not found in local cache, looking in remotes...
zlib/1.2.11#bincrafters/stable: Trying with 'conan-center'...
zlib/1.2.11#bincrafters/stable: Trying with 'minres'...
zlib/1.2.11#bincrafters/stable: Trying with 'bincrafters'...
ERROR: Failed requirement 'zlib/1.2.11#bincrafters/stable' from 'libpq/11.4#bincrafters/stable'
ERROR: Unable to find 'zlib/1.2.11#bincrafters/stable' in remotes
Finally, I arrived at
libpq/11.4#bincrafters/stable
zlib/1.2.11#conan/stable
qt/5.14.2#bincrafters/stable
After this, it looks like it was oK:
Installing (downloading, building) binaries...
qt/5.14.2#bincrafters/stable: Retrieving package 93c70de10405da9f2d5a1f42b8c299ca7af869d2 from remote 'bincrafters'
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
....qt/5.14.2#bincrafters/stable: Package installed 93c70de10405da9f2d5a1f42b8c299ca7af869d2
qt/5.14.2#bincrafters/stable: Downloaded package revision 0
However, the install fails with
CMake was unable to find Qt5, put qmake in your path or set
QTDIR/QT_QMAKE_EXECUTABLE.
The package is downloaded, I see all components in the corresponding subdirectory in my home directory. However, unlike the other components, it is not installed, before CMake attempts to find it.
What do I wrong?
In case of any strange behavior of conan, upgrade! For me, switch 1.24.0 -> 1.28.1 with configs clean up fixed the same problem with libpq/11.5

Problems installing Haskell with Atom on a Mac

I want to program in Haskell using Atom on a Mac. Therefore I installed the following packages in Atom:
haskell-ghc-mod
ide-haskell
ide-haskell-cabal
language-haskell
After that I installed the Haskell Platform 8.2.1 from here:
https://www.haskell.org/platform/#osx-none
This did not seem to work as I cannot compile and during every start of Atom there is this error message:
Haskell-ghc-mod: ghc-mod failed to launch. It is probably missing or misconfigured. ENOENT
Then I tried installing the necessary packages manually as described on https://atom-haskell.github.io/installation/installing-binary-dependencies/ which also failed (even unregistering failed):
Daniels-MacBook-Pro:ghc-mod-sandbox daniel$ cabal install ghc-mod stylish-haskell
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: ghc-mod-5.8.0.0 (user goal)
next goal: base (dependency of ghc-mod-5.8.0.0)
rejecting: base-4.10.0.0/installed-4.1... (conflict: ghc-mod => base<4.10 &&
>=4.6.0.1)
rejecting: base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from non-upgradeable package requires installed instance)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, ghc-mod, syb
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
Daniels-MacBook-Pro:ghc-mod-sandbox daniel$ cabal uninstall ghc-mod stylish-haskell
cabal: This version of 'cabal-install' does not support the 'uninstall'
operation. It will likely be implemented at some point in the future; in the
meantime you're advised to use either 'ghc-pkg unregister ghc-mod' or 'cabal
sandbox hc-pkg -- unregister ghc-mod'.
Daniels-MacBook-Pro:ghc-mod-sandbox daniel$ ghc-pkg unregister ghc-mod
ghc-pkg: cannot find package ghc-mod
Daniels-MacBook-Pro:ghc-mod-sandbox daniel$ cabal sandbox hc-pkg -- unregister ghc-mod
ghc-pkg: cannot find package ghc-mod
Daniels-MacBook-Pro:ghc-mod-sandbox daniel$ cabal install ghc-mod stylish-haskell
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: ghc-mod-5.8.0.0 (user goal)
next goal: base (dependency of ghc-mod-5.8.0.0)
rejecting: base-4.10.0.0/installed-4.1... (conflict: ghc-mod => base<4.10 &&
>=4.6.0.1)
rejecting: base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from non-upgradeable package requires installed instance)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, ghc-mod, syb
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
I already searched stackoverflow for answers but nothing really worked for me. Can anybody tell me what I am missing?
I can advise you on one part of the problem. The error message from cabal is very confusing, but what it means is:
ghc-mod does not work with a version 4.10.0.0 of the base
The base library ships with GHC and cannot be changed
GHC 8.2.1 ships with base 4.10.0.0
Therefore: you cannot build ghc-mod with the version of the Haskell Platform you downloaded
You can work around this by downloading an older Haskell Platform (8.0.2). In my opinion: it's premature for the promoted Haskell Platform version to be 8.2.1.
Another approach is using Stack, which will manage the installation of GHC installations for you. In this case, running stack install ghc-mod should just work. But since you'll still be using GHC 8.2.1 from the Haskell Platform, it won't do you much good, since ghc-mod is tied to your GHC version.
Personally: I never had success setting up ghc-mod. I've also never used either Atom or VS Code, but I've heard people sharing good experiences with VS Code + Haskero, so if you're looking for an IDE-like experience, that may be something worth considering. I've switched over to using emacs+intero mode, which may be something to consider.
Here are some links that may be helpful on getting started with tooling:
https://haskell-lang.org/get-started
https://haskell-lang.org/intero

Haskell cabal issue with Mac OS X 10.11? (cannot satisfy -package-id)

I used the latest Haskell Platform 7.10.2-a (https://www.haskell.org/platform/mac.html) on Mac OS X 10.11 for El-capitan.
When I tried to install yesod with cabal install yesod, I have multiple error messages such as:
Building email-validate-2.1.3...
Building http-api-data-0.2.1...
Building fast-logger-2.4.1...
Building http-date-0.0.6.1...
Failed to install crypto-random-0.0.9
Build log ( /Users/smcho/.cabal/logs/crypto-random-0.0.9.log ):
Configuring crypto-random-0.0.9...
Building crypto-random-0.0.9...
Preprocessing library crypto-random-0.0.9...
<command line>: cannot satisfy -package-id vector-0.11.0.0-730f99979d41c11c3a1ef069844b5f57
(use -v for more information)
Failed to install email-validate-2.1.3
Build log ( /Users/smcho/.cabal/logs/email-validate-2.1.3.log ):
Configuring email-validate-2.1.3...
The error pattern is pretty much the same: cannot satisfy -package-id.
For example, cabal install aeson gives cannot satisfy -package-id attoparse... error.
Resolving dependencies...
Configuring aeson-0.10.0.0...
Building aeson-0.10.0.0...
Failed to install aeson-0.10.0.0
Build log ( /Users/smcho/.cabal/logs/aeson-0.10.0.0.log ):
Configuring aeson-0.10.0.0...
Building aeson-0.10.0.0...
Preprocessing library aeson-0.10.0.0...
<command line>: cannot satisfy -package-id attoparsec-0.13.0.1-99b4df28644e63383f308c810764a8bb
(use -v for more information)
cabal: Error: some packages failed to install:
aeson-0.10.0.0 failed during the building phase. The exception was:
ExitFailure 1
However, attoparsec library seems to be installed without problem.
smcho#macho ~> cabal install attoparsec
Resolving dependencies...
All the requested packages are already installed:
attoparsec-0.13.0.1
Use --reinstall if you want to reinstall anyway.
What might be wrong?
As suggested here, the cannot satisfy -package-id error you're seeing might be due to an out of date cache.
If running ghc-pkg check warns you that your cache is out of date, then running ghc-pkg recache might resolve your issues.
I've been running into the cannot satisfy -package-id problem all morning (not with yesod, but with various other packages). ghc-pkg recache resolved my issues. Hope this helps.
This might be controversial, but imho the haskell platform and cabal (when used directly) are both essentially deprecated now with the advent of stack.
Stack will:
Automatically install haskell for you (stack setup)
Automatically sandbox (and intelligently share sandboxes between projects)
Completely avoid cabal hell (in my experience)
I could install yesod from brew.
Uninstall haskell-plaftorm
/Library/Haskell/bin/uninstall-hs thru 7.10.2
Install ghc
brew install ghc
brew link ghc
Install stackage
brew install haskell-stack
Install Yesod
stack install yesod
stack install yesod-bin
Use Yesod
Getting "Could not find module `Yesod'" when I try to run first example from Yesod book
stack runghc hello-world.hs
Use Yesod for development
I'm not sure, but I had to run stack exec yesod build first.
stack exec yesod devel.
Yesod deployment with keter
Remove the first line in config/keter.yaml
stack exec yesod keter, and you will get one binary in dist/bin that contains most of the necessary files to run.
Execute the binary as a standalone server.

play20 app (v. 2.0.2) deployment on heroku

Trying to get a play 2.0.2 application going on heroku and it seems it is not yet supported.
Has anyone had any luck with this?
Error:
http://s3pository.heroku.com/maven-scala-tools-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.11.3/sbt_2.9.1-0.11.3.pom
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.11.3!sbt_2.9.1.jar:
http://s3pository.heroku.com/maven-scala-tools-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.11.3/sbt_2.9.1-0.11.3.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-tools.sbt#sbt_2.9.1;0.11.3: not found
::::::::::::::::::::::::::::::::::::::::::::::
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-tools.sbt#sbt_2.9.1;0.11.3: not found
Error during sbt execution: Error retrieving required libraries
(see /tmp/build_7sg3kay36u6a/project/boot/update.log for complete log)
Error: Could not retrieve sbt 0.11.3
! Failed to build app with SBT 0.11.0
! Heroku push rejected, failed to compile Scala app
This was happening because of old cache (my app had been deployed on heroku before, hence the old cache)
From the root of your play application, do
heroku config:add BUILDPACK_URL='https://github.com/heroku/heroku-buildpack-scala#cleancache'
then push your app again
This will drop all cached artifacts and the sbt jar and re-download up to date fresh ones.
Just remember to do heroku config:remove BUILDPACK_URL afterwards or each time you push the cache will be dropped and builds will take a while.
Kudos to scott # play googlegroups
https://groups.google.com/forum/#!topic/play-framework/yUDfW2UtBjs
This could be unrelated, but I had some conflicting plugin in myhomedir/.sbt/plugins/build.sbt that messed up my Play 2.0.2 build. Removing that fixed it for me.
I had this exact error on my Mac and it was because MacPorts did not install the correct version of SBT (sudo port install sbt gave me 0.11.2 not 0.11.3) - yes I updated my port tree. So I sudo port uninstalled sbt and used brew install sbt. This (Homebrew) installed 0.11.3 and the problem disappeared. I would suggest checking the sbt version on Heroku.
If you encounter this on play 2.0.4 (I know, this question is for play 2.0.2, but it's first on google):
change the sbt version to 0.11.3:
Change sbt version in project/build.properties to 0.11.3

Resources