Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

83 compile with opencv contrib #85

Open
wants to merge 63 commits into
base: develop
Choose a base branch
from

Conversation

qwelyt
Copy link

@qwelyt qwelyt commented Nov 11, 2022

Build opencv with opencv_contrib included

As requested in #83

Add opencv_contrib to all platforms.

The windows variant just republished the opencv binaries. Now it
actually has to build for windows. I hope this actually builds it
correctly.
Apparently there is no 22.04 arm image. Go back to 20.04

Remove bad line in the windows runner.
Arm build fails due to certificate errors. Either we don't care about
the certs (bad) or we try to install the correct certs (good) so it
doesn't fail on that.

Visual Studio is not like the others. You apparently don't get a
makefile when using VS to build things. So instead of using `make` you
should use `cmake --build .` to actually build it. Let's give that a go.
@vonnieda
Copy link
Member

Hi @qwelyt - thanks for sending this!

It looks like a few of the builds failed. You can see the results in the Checks section.

Also, I was curious why you changed Ubuntu versions and Java versions in some of the steps?

Thanks,
Jason

@qwelyt
Copy link
Author

qwelyt commented Nov 12, 2022

Yeah I noticed that as well. Not quite sure why they fail. I have no experience with arm. I would have thought the same steps should work on both arm and x64.

The reason to change Ubuntu version is because the 18.04 runner is deprecated by GitHub. See https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners for which versions one can run. And the action used to support arm does not support 22.04 yet.

The reason to change Java is to make it uniform across all platforms. I found it odd that some used 8 and others 15. The setup should ideally be the same everywhere, no?

Another thing; on arm one can't download from GitHub without ignoring the certs. This does not seem great. Even making sure to install ca-certificates did not help. Is the action doing something strange perhaps?

I will take a look at it again when I can, but if you see where the problems are please guide me in the right direction.

Let's see if the deprecated version of ubuntu works on arm.
@qwelyt
Copy link
Author

qwelyt commented Nov 16, 2022

@vonnieda Okay, so I pulled back the arm builds to 18.04 and they now work. Strange. These should preferably be updated given the deprecation status. But now they work at least. I will try to get a hold of an arm-device and try to figure out what goes wrong. I'm guessing some updated gcc or the like messes things up.

The aarch64 (apple m1?) I can't test as I don't have any such device.

But everything builds now at least.

Also, I noticed this build opencv 4.5.5. 4.6 is out. Want a PR to update the version?

@qwelyt
Copy link
Author

qwelyt commented Nov 29, 2022

@vonnieda I think I've hit a wall. I can't get the windows build to work and I have no idea why.

After a couple of tries I got it to configure and compile correctly. The DLL and jar files are produced as they should, but the DLL does not seem to actually work. No matter what I try I get a java.lang.UnsatisfiedLinkError when I try to run the tests on Windows.

What is even stranger is I got a VM with windows up. I can compile opencv in that, put the DLL where it is supposed to go in the project, and run the tests. This works. All tests pass. When I then try to use the exact same DLL but compiled into the jar file (still local in my VM), I get UnsatisfiedLinkError.

I am running out of ideas. I have no idea what setup that OpenCV uses in their runners as they self hosted as far as I can tell. So I can't replicate that on GitHub or locally.

What is even more annoying is that OpenCV actually builds all this themselves everytime they have a release or PR. They just don't expose the jar and dll for download. Only test logs are available.

So as far as this goes I've hit a wall. Unless someone else has some insight my "verdict" is that Windows can't be supported right now. It's simply too difficult to build.

Linux and Mac (intel) works without flaws.

I'm at my wits end.

I just .. keep at it. Do I like frustration?
I don't know why I don't just use mingw again. But OpenCV uses VS in their winpack ci so I'm giving it a go.
As suspected the vs build didn't work. So no we are back to mingw
So ... windows 2019 seem to work. I frecking hate windows.

Upping the version so we don't override the already out version. Should
have done this before.
@vonnieda
Copy link
Member

Hi @qwelyt - thanks for all your persistence on this. I'll take a look through the builds and see if anything jumps out to me.

@vonnieda
Copy link
Member

vonnieda commented Apr 4, 2023

With the addition of native windows builds with visual studio in https://github.com/openpnp/openpnp-capture/blob/master/.github/workflows/build.yml#L80, I think we can probably finish this up now.

I'll put this on my list to finish, but it may be a awhile. @qwelyt if you'd like to take another stab at it, here is what is left IMHO:

  1. Using information in that openpnp-capture link above, change the Windows build in opencv to build similarly, using Visual Studio on Github Actions.
  2. Update the builds to include contrib, as you did previously. With the Windows updates and the recent build updates I did this should all go much more smoothly.

Thanks,
Jason

@qwelyt
Copy link
Author

qwelyt commented Apr 26, 2023

Finally got some time to work on this again.

@vonnieda The link build you provided proved key to get this to work! It now produces valid builds for windows! 🥳

I have access to windows and linux x64 and the build works for these. I'm not sure if you want to keep the windows x86 builds, is that architecture even supported still? And I can't test the builds for arm or mac. I suspect theses architectures works though as it's only the windows one that has been a problem.

Enabled all platforms again in my pipelines, which will probably make it break as I don't have access to the apple aarch64 runner. But I think this could be ready for a pull. Please have a look! And possibly that the version should be updated. Let me know!

@deckerst
Copy link

deckerst commented Jul 5, 2023

Hi @vonnieda, is this PR ready to be merged?
I'm eager to try the build with contrib, that would be very convenient!

@vonnieda
Copy link
Member

vonnieda commented Jul 5, 2023

Sorry @qwelyt - I missed your previous message! I will take a look at this in the next few days.

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

Successfully merging this pull request may close these issues.

5 participants