Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Windows Build Still Broken #107

Open
wagesj45 opened this issue Mar 11, 2019 · 22 comments
Open

Windows Build Still Broken #107

wagesj45 opened this issue Mar 11, 2019 · 22 comments

Comments

@wagesj45
Copy link

Even after the newest commit with "Build fixes for Windows" opencl fails to build under MSYS2.

@ChaoticBlankness
Copy link

Is this the same issue?

chaot@PC MSYS ~/butterflow/packages/windows/mingw-w64-opencv2
$ MINGW_INSTALLS=mingw64 makepkg-mingw -sLf
==> Making package: mingw-w64-opencv2 2.4.13-1 (Mon, Mar 11, 2019 11:11:11 PM)
==> Checking runtime dependencies...
==> Installing missing dependencies...
resolving dependencies...
looking for conflicting packages...

Packages (5) mingw-w64-x86_64-freeglut-3.0.0-4
mingw-w64-x86_64-ilmbase-2.2.1-1
mingw-w64-x86_64-intel-tbb-1~2018_20171205-1
mingw-w64-x86_64-jasper-2.0.14-1 mingw-w64-x86_64-openexr-2.2.1-1

Total Download Size: 5.97 MiB
Total Installed Size: 27.46 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
mingw-w64-x86_64-in... 2.0 MiB 2.82M/s 00:01 [#####################] 100%
mingw-w64-x86_64-fr... 147.0 KiB 3.05M/s 00:00 [#####################] 100%
mingw-w64-x86_64-ja... 759.7 KiB 2.41M/s 00:00 [#####################] 100%
mingw-w64-x86_64-il... 144.8 KiB 1114K/s 00:00 [#####################] 100%
mingw-w64-x86_64-op... 2.9 MiB 2.16M/s 00:01 [#####################] 100%
(5/5) checking keys in keyring [#####################] 100%
(5/5) checking package integrity [#####################] 100%
(5/5) loading package files [#####################] 100%
(5/5) checking for file conflicts [#####################] 100%
(5/5) checking available disk space [#####################] 100%
:: Processing package changes...
(1/5) installing mingw-w64-x86_64-intel-tbb [#####################] 100%
(2/5) installing mingw-w64-x86_64-freeglut [#####################] 100%
(3/5) installing mingw-w64-x86_64-jasper [#####################] 100%
(4/5) installing mingw-w64-x86_64-ilmbase [#####################] 100%
(5/5) installing mingw-w64-x86_64-openexr [#####################] 100%
==> Checking buildtime dependencies...
==> Installing missing dependencies...
resolving dependencies...
looking for conflicting packages...

Packages (1) mingw-w64-x86_64-eigen3-3.3.4-1

Total Download Size: 0.81 MiB
Total Installed Size: 6.42 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
mingw-w64-x86_64-ei... 825.2 KiB 1794K/s 00:00 [#####################] 100%
(1/1) checking keys in keyring [#####################] 100%
(1/1) checking package integrity [#####################] 100%
(1/1) loading package files [#####################] 100%
(1/1) checking for file conflicts [#####################] 100%
(1/1) checking available disk space [#####################] 100%
:: Processing package changes...
(1/1) installing mingw-w64-x86_64-eigen3 [#####################] 100%
==> Retrieving sources...
-> Downloading opencv-2.4.13.tar.gz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 121 0 121 0 0 274 0 --:--:-- --:--:-- --:--:-- 274
100 87.4M 0 87.4M 0 0 2297k 0 --:--:-- 0:00:38 --:--:-- 2570k
-> Found mingw-w64-cmake.patch
-> Found free-tls-keys-on-dll-unload.patch
-> Found solve_deg3-underflow.patch
==> Validating source files with sha256sums...
opencv-2.4.13.tar.gz ... Passed
mingw-w64-cmake.patch ... Passed
free-tls-keys-on-dll-unload.patch ... Passed
solve_deg3-underflow.patch ... Passed
==> Extracting sources...
-> Extracting opencv-2.4.13.tar.gz with bsdtar
==> Starting prepare()...
patching file cmake/OpenCVDetectPython.cmake
patching file cmake/OpenCVFindOpenEXR.cmake
patching file cmake/OpenCVGenConfig.cmake
patching file cmake/OpenCVGenPkgconfig.cmake
patching file cmake/OpenCVModule.cmake
patching file cmake/templates/OpenCVConfig.cmake.in
patching file CMakeLists.txt
patching file modules/core/src/alloc.cpp
patching file modules/core/src/precomp.hpp
patching file modules/core/src/rand.cpp
patching file modules/core/src/system.cpp
patching file modules/calib3d/src/polynom_solver.cpp
==> Starting build()...
In file included from ffopencv.c:1:0:
../../modules/highgui/src/cap_ffmpeg_impl.hpp: In function 'AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, AVCodecID, int, int, int, double, int)':
../../modules/highgui/src/cap_ffmpeg_impl.hpp:1481:21: error: 'CODEC_FLAG_GLOBAL_HEADER' was not declared in this scope
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
^~~~~~~~~~~~~~~~~~~~~~~~
../../modules/highgui/src/cap_ffmpeg_impl.hpp:1481:21: note: suggested alternative: 'AV_CODEC_FLAG_GLOBAL_HEADER'
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
^~~~~~~~~~~~~~~~~~~~~~~~
AV_CODEC_FLAG_GLOBAL_HEADER
../../modules/highgui/src/cap_ffmpeg_impl.hpp: In function 'int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)':
../../modules/highgui/src/cap_ffmpeg_impl.hpp:1505:30: error: 'AVFMT_RAWPICTURE' was not declared in this scope
if (oc->oformat->flags & AVFMT_RAWPICTURE) {
^~~~~~~~~~~~~~~~
../../modules/highgui/src/cap_ffmpeg_impl.hpp:1505:30: note: suggested alternative: 'AVFMT_NOFILE'
if (oc->oformat->flags & AVFMT_RAWPICTURE) {
^~~~~~~~~~~~~~~~
AVFMT_NOFILE
../../modules/highgui/src/cap_ffmpeg_impl.hpp: In member function 'void CvVideoWriter_FFMPEG::close()':
../../modules/highgui/src/cap_ffmpeg_impl.hpp:1679:35: error: 'AVFMT_RAWPICTURE' was not declared in this scope
if( (oc->oformat->flags & AVFMT_RAWPICTURE) == 0 )
^~~~~~~~~~~~~~~~
../../modules/highgui/src/cap_ffmpeg_impl.hpp:1679:35: note: suggested alternative: 'AVFMT_NOFILE'
if( (oc->oformat->flags & AVFMT_RAWPICTURE) == 0 )
^~~~~~~~~~~~~~~~
AVFMT_NOFILE
../../modules/highgui/src/cap_ffmpeg_impl.hpp: In member function 'bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)':
../../modules/highgui/src/cap_ffmpeg_impl.hpp:1913:32: error: 'AVFMT_RAWPICTURE' was not declared in this scope
if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
^~~~~~~~~~~~~~~~
../../modules/highgui/src/cap_ffmpeg_impl.hpp:1913:32: note: suggested alternative: 'AVFMT_NOFILE'
if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
^~~~~~~~~~~~~~~~
AVFMT_NOFILE
In file included from ffopencv.c:1:0:
../../modules/highgui/src/cap_ffmpeg_impl.hpp: In static member function 'static AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext*, AVCodecID, int, int, int, double, AVPixelFormat)':
../../modules/highgui/src/cap_ffmpeg_impl.hpp:2207:25: error: 'CODEC_FLAG_GLOBAL_HEADER' was not declared in this scope
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
^~~~~~~~~~~~~~~~~~~~~~~~
../../modules/highgui/src/cap_ffmpeg_impl.hpp:2207:25: note: suggested alternative: 'AV_CODEC_FLAG_GLOBAL_HEADER'
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
^~~~~~~~~~~~~~~~~~~~~~~~
AV_CODEC_FLAG_GLOBAL_HEADER
../../modules/highgui/src/cap_ffmpeg_impl.hpp: In member function 'bool OutputMediaStream_FFMPEG::open(const char*, int, int, double)':
../../modules/highgui/src/cap_ffmpeg_impl.hpp:2290:30: warning: ignoring return value of 'int avformat_write_header(AVFormatContext*, AVDictionary**)', declared with attribute warn_unused_result [-Wunused-result]
avformat_write_header(oc_, NULL);
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
==> ERROR: A failure occurred in build().
Aborting...

@wagesj45
Copy link
Author

@ChaoticBlankness Yes, I get the same issue. What causes it, I'm unsure.

@ChaoticBlankness
Copy link

It's odd, thought maybe build on Windows was the issue however butterflow-0.2.4.dev portable returns:

butterflow -d
Traceback (most recent call last):
File "C:/msys64/mingw64/lib/python2.7/site-packages/cx_Freeze/initscripts/startup.py", line 14, in run
File "C:/msys64/mingw64/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 26, in run
File "butterflow/main.py", line 25, in
File "butterflow/cli.py", line 263, in main
RuntimeError: opencl call failed

Latest Radeon driver, clinfo reports FULL_PROFILE and with correct Max Work Group Size Max Work Item Size. Fiji/FuryX

@wagesj45
Copy link
Author

Correct. It seems to be some kind of issue with newer nVidia drivers paired with the older version of OpenCL that butterflow relies on. I was hoping the latest commit had fixed it, but it has not. I'm not sure what to do at this point.

@alset333
Copy link

alset333 commented May 6, 2019

Not to revive an old post... but since it's still open and I'm also getting this error...

Did anyone ever find a fix for this?
If not, does anyone know if there are tools or programs similar to butterflow?
If development and fixes are getting abandoned it'd be nice to know at least...

@wagesj45
Copy link
Author

wagesj45 commented May 6, 2019

@alset333 Sadly I think butterflow has fallen into disrepair and is more or less abandoned right now. I can find no way to contact the original developer. I think the best bet is for someone to fork it and maintain a new branch. I toyed with the idea, but I'm not a C++ developer and to feel comfortable at all I'd have to rewrite the whole thing in C# to be able to sustainably maintain it.

As to your other question, I do not know of an alternative for butterflow. I think Adobe Premier or After Effects has an interpolation feature but I'm not aware of it being anywhere near as sophisticated as butterflow, not to mention it being costly and proprietary (whichever of those matter to you).

@ChaoticBlankness
Copy link

Personal workaround for Radeon (at least) has been to maintain an Ubuntu 16.04 partition.

Was hoping Windows might get a fix soon, but looking grim unless some of us can step up. Props to dthpham for pushing any updates this year. I'm sure it's life taking priority over the project.

@Stemanz
Copy link

Stemanz commented May 6, 2019

Personal workaround with Windows 10: linux subsystem for Windows. Tried and working (it works on my machine ;) )!

#95 (comment)

@alset333
Copy link

alset333 commented May 7, 2019

Oh well, thanks for letting me know.
I've moved to using SVP for most stuff (proprietary and paid, but GPU accelerated and up to date), but I liked the versatility and open-source nature of Butterflow.

@dthpham
Copy link
Owner

dthpham commented May 8, 2019

@ChaoticBlankness I just tried using BF after not using it for a long time but 0.2.4.dev0 portable with the latest NVIDIA drivers (430.39) works for me. What you're experiencing is probably a driver issue and since I don't have a Radeon GPU I can't provide any meaningful support for people with AMD cards until I get my hands on one myself.

I mean I want to debug & get that RuntimeError you're getting fixed with the portable version, but am I really going to to buy and build a machine with a Radeon card just to test BF on? Probably not anytime soon.

I'm going to specifically look into the build issue right now and maybe a newer build will fix what you're experiencing on Windows. Anyways thanks for being patient. I'll give an update on my findings soon.

@ChaoticBlankness
Copy link

@dthpham I'm very grateful. 👍 Understandable about the Radeon driver, though this seems to happen identically on my Windows 10 Intel HD 620 using current drivers as well. If that might be easier for you to test and would perhaps resolve problems for both Intel/AMD.

@wagesj45 You're Nvidia if I recall. Is all well for you using 430.39?

Retried 0.2.4.dev0 portable and still no luck. :(

@dthpham
Copy link
Owner

dthpham commented May 9, 2019

About the build issue on Windows:

The problem is MSYS2 upgraded the FFMPEG 3 package to 4 and because of API changes OpenCV 2 is referencing definitions that are no longer in FFMPEG library headers resulting in compiler errors. One example is CODEC_FLAG_GLOBAL_HEADER was renamed to AV_CODEC_FLAG_GLOBAL_HEADER in FFMPEG 4. Another is AVFMT_RAWPICTURE which was removed completely (or I can't find the equivalent definition) in FFMPEG 4.

There's three things off the top of my head I can do to get this fixed:

  1. I can patch the missing references in the OpenCV 2 source code to their new equivalents, or the suggested alternative provided by the compiler. But after I get past that build problem I'll likely encounter another down the line. Plus I have no idea what the implications of doing this are, if it's even correct or going to work when I'm done. Is it going to break something that I won't be aware of until it happens in the long run?

  2. I can try to upgrade BF to use OpenCV 4. I forgot why I didn't update to OpenCV 3 but I think it had to do with how optical flow functions, Numpy, and Python were having problems interfacing with each other. I'm not 100% sure about this but it looks like OpenCV 4 can call the functions I need easily with Python, which wasn't possible before in OpenCV 2 so I had to wrap some OpenCV code and functions and use third party code to help me do weird data type conversions.

  3. The last option is for me to make BF depend on FFMPEG 3. The last working FFMPEG is 3.4.2, which was bundled in BF 0.2.4 Portable, and I can update PKGBUILDs to use that.

Each has it's downsides and upsides and difficulty to implement a fix. (1) means everybody will have the latest FFMPEG but not OpenCV, (2) means everybody can use the latest OpenCV and FFMPEG, (3) means FFMPEG and OpenCV will be the older versions.

There's also other options like a full rewrite where I could bundle or port the Farneback algorithm and write my own video reader-writer thingy. That way OpenCV would no longer be a dependency & BF would be less prone to breakages on FFMPEG updates.

The best option today is to downgrade to FFMPEG 3 because it's easy and is going to work (I'm pretty sure). I will be implementing some kind of fix in the next few days. After that I will be researching and weighing the other options as well to see if they are worth it or more optimal.

@ChaoticBlankness Thanks I'll try testing the portable version with Intel after I get build fixes in.

@wagesj45
Copy link
Author

wagesj45 commented May 9, 2019

@dthpham Given the three possible solutions, I think solution 3 will be the quickest way to get a working build out. Long term, solution 2 would probably be best for performance. This assumes, of course, that OpenCV 4 has improved utilization of hardware and improved optical flow efficiency.

In regards to the rewrite idea:
I have been toying with this idea and even created a proof-of-concept project to attempt it in C# using .Net Core. Given the nature of GPU/OpenCL compilation requirements, OpenCV does not provide GPU functionality in its precompiled DLLs, which are used by the C# OpenCV wrappers available via Nuget package. Long story short, I was unable to do a faithful rewrite in C# that would utilize hardware acceleration, defeating the purpose of the whole thing since using the CPU for the Farneback optical flows is prohibitively slow.

That being said, if you were to rewrite butterflow to get rid of the current OpenCV dependency, I may be able to use your implementation of Farneback and reimplement it in something like ILGPU. This could let me "take over" the project in so much as the project would just migrate to a .Net version with cross platform support. This is, of course, assuming that 1) you are interested in handing the project off to someone else for maintenance and 2) I am smart enough to figure out ILGPU and how to implement the optical flow algorithm using it.

@alset333
Copy link

For reference, my issues were while running with a GTX-1060-3G on 430.39, so I don't think it's the AMD vs NVIDIA problem nor a driver issue. Though it might be a slightly different problem than some are having.

@dthpham dthpham reopened this May 15, 2019
@wagesj45
Copy link
Author

I saw that there was some movement on this and some changes were checked in. Has this resulted in a working build that can be packaged as a release?

@dthpham
Copy link
Owner

dthpham commented May 26, 2019

Builds are working again on the latest commit, at least on my end. Install instructions have been simplified. A new release can be packaged but the current one is still working so I don't see the need to publish a new one.

@wagesj45
Copy link
Author

I followed the updated instructions from your latest check in but was unable to produce a build. I still received errors. I have another project that depends on a Windows executable and I wouldn't mind building myself to include it, but I just can't currently get it to work, which is why I was hoping for a released version if you can get the build to work.

@dthpham
Copy link
Owner

dthpham commented May 29, 2019

@wagesj45 What errors are you getting? If you elaborate, maybe I can fix them so everybody can benefit.

@wagesj45
Copy link
Author

@dthpham The current release was put out on Feb 27th, with 3 commits since its release. It does not currently work with nVidia hardware. As for the error I had in building, I will share the trailing output from the MSYS2 shell.

==> Checking buildtime dependencies...
==> Installing missing dependencies...
error: target not found: mingw-w64-x86_64-ffmpeg3
==> ERROR: 'pacman' failed to install missing dependencies.
loading packages...
error: 'mingw-w64-x86_64-opencv2-2.4.13-2-any.pkg.tar.xz': could not find or read package
==> Making package: mingw-w64-butterflow 0.2.3-1 (Tue, Jun 25, 2019 3:44:36 AM)
==> Checking runtime dependencies...
==> Installing missing dependencies...
error: target not found: mingw-w64-x86_64-ffmpeg3
error: target not found: mingw-w64-x86_64-opencv2
==> ERROR: 'pacman' failed to install missing dependencies.
loading packages...
error: 'mingw-w64-x86_64-butterflow-0.2.3-1-x86_64.pkg.tar.xz': could not find or read package

It then exits to the command line. I searched in a MINGW64 window but could find no butterflow files. I'm guessing I might need to correct something in the script given in your build instructions, but I'm not sure what.

@wagesj45
Copy link
Author

Has there been any movement on this? I'd like to package my project with butterflow. I don't mind building or using a prepackaged release.

@dthpham
Copy link
Owner

dthpham commented Jul 18, 2019

@wagesj45 A new build should be ready in the next couple of days with a fix for #103 which should resolve the NVIDIA OpenCL issues everybody is experiencing.

@LukasKysela
Copy link

LukasKysela commented Nov 22, 2019

Hi. I have this problem.
Not run convert and show this error:

Traceback (most recent call last):
File "C:/msys64/mingw64/lib/python2.7/site-packages/cx_Freeze/initscripts/startup.py", line 14, in run
File "C:/msys64/mingw64/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 26, in run
File "butterflow/main.py", line 34, in
File "butterflow/cli.py", line 288, in main
RuntimeError: opencl call failed

How i can fix?
I dont have nVidia graphic card.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants