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

Add libcurl, openssl and libbreakpad to the base image #13

Closed
Eeems opened this issue Jan 7, 2022 · 30 comments
Closed

Add libcurl, openssl and libbreakpad to the base image #13

Eeems opened this issue Jan 7, 2022 · 30 comments
Assignees

Comments

@Eeems
Copy link
Member

Eeems commented Jan 7, 2022

See https://github.com/Eeems/oxide/runs/4736055110
It's provided in the reMarkable toolchain.

@matteodelabre
Copy link
Member

I’ll take a look this evening.

@Eeems
Copy link
Member Author

Eeems commented Jan 7, 2022

I’ll take a look this evening.

Thanks! It's likely some missed files, or an environment variable that we haven't populated.

@Eeems
Copy link
Member Author

Eeems commented Jan 7, 2022

Some more information on what I'm building: https://docs.sentry.io/platforms/native/guides/qt/

@matteodelabre
Copy link
Member

Can you try adding -DCMAKE_TOOLCHAIN_FILE="/usr/share/cmake/$CHOST.cmake" to your CMake command-line? See this package for example: https://github.com/toltec-dev/toltec/blob/46b33fd84637fb7e86ba741b92ebd7e5e965277e/package/yaft/package#L23

@Eeems
Copy link
Member Author

Eeems commented Jan 8, 2022

Sure, although that will break building with the normal toolchain. Ideally, the toolchain should just work for cmake. I'll report back when it's done.

@Eeems
Copy link
Member Author

Eeems commented Jan 8, 2022

That gets us further now. I'll sort out how to handle building in both toolchains in my package recipie.

Next up is that the toolchain is missing curl: https://github.com/Eeems-Org/oxide/runs/4746173317

@matteodelabre
Copy link
Member

matteodelabre commented Jan 8, 2022

the toolchain should just work for cmake

That’s a good point. I see that in recent versions (⩾3.21), CMake reads the CMAKE_TOOLCHAIN_FILE variable from environment variables. We can add this to the image.

@matteodelabre
Copy link
Member

Since this requires upgrading CMake, I’m rebuilding the base image to use the latest Debian release. This will take a few hours, so I’ll work on adding libcurl tomorrow.

@Eeems
Copy link
Member Author

Eeems commented Jan 8, 2022

Since this requires upgrading CMake, I’m rebuilding the base image to use the latest Debian release. This will take a few hours, so I’ll work on adding libcurl tomorrow.

Thank you!

@matteodelabre matteodelabre changed the title Qt image missing cmake configuration for Qt. Add CMAKE_TOOLCHAIN_FILE env var and libcurl library Jan 8, 2022
@matteodelabre
Copy link
Member

Regarding setting a default value in the environment for CMAKE_TOOLCHAIN_FILE, I’m actually not convinced it’s the best solution. Consider projects that need to build some executables with the “normal” gcc compiler, and then use the resulting executables in the cross build [1]. Setting a default for CMAKE_TOOLCHAIN_FILE in this case will break the part that needs the normal gcc. We would need to unset the env var before running cmake to build the first part, and then setting the env var back before building the second part. This is also the reason why I haven’t overridden the CC and CXX env vars in the image: some parts of the build may want the normal gcc, and some other parts the cross gcc. I think it’s best that each part explicitly declares which compiler it wants, for example by passing the CMAKE_TOOLCHAIN_FILE argument for CMake projects, or setting the CXX variable, etc.

As you’ve mentioned, having such a behavior differ from the oecore toolchain means both toolchains need to be handled differently. This may not be desirable. But the oecore behavior is really not ideal for projects having a dual-compiler layout.

[1] I have encountered such cases before. This can be used for example to generate some code that is used for the second half of the build.

@matteodelabre
Copy link
Member

As a compromise, we may add some emulate-oecore script that can be sourced to behave like oecore for projects that want it.

@Eeems
Copy link
Member Author

Eeems commented Jan 9, 2022

Regarding setting a default value in the environment for CMAKE_TOOLCHAIN_FILE, I’m actually not convinced it’s the best solution. Consider projects that need to build some executables with the “normal” gcc compiler, and then use the resulting executables in the cross build [1]. Setting a default for CMAKE_TOOLCHAIN_FILE in this case will break the part that needs the normal gcc. We would need to unset the env var before running cmake to build the first part, and then setting the env var back before building the second part. This is also the reason why I haven’t overridden the CC and CXX env vars in the image: some parts of the build may want the normal gcc, and some other parts the cross gcc. I think it’s best that each part explicitly declares which compiler it wants, for example by passing the CMAKE_TOOLCHAIN_FILE argument for CMake projects, or setting the CXX variable, etc.

As you’ve mentioned, having such a behavior differ from the oecore toolchain means both toolchains need to be handled differently. This may not be desirable. But the oecore behavior is really not ideal for projects having a dual-compiler layout.

[1] I have encountered such cases before. This can be used for example to generate some code that is used for the second half of the build.

As a compromise, we may add some emulate-oecore script that can be sourced to behave like oecore for projects that want it.

Fair enough. Even if we don't go with the script, we should properly document this to lower the barrier to entry for people wanting to package things with our toolchain.

@matteodelabre
Copy link
Member

Definitely. Referencing #12 as a reminder.

@matteodelabre
Copy link
Member

Unfortunately the latest GCC 11 release breaks the build of glibc 2.31 in several ways, including a build-time segfault that I didn’t manage to resolve yet. This may take more time than initially planned.

@Eeems
Copy link
Member Author

Eeems commented Feb 21, 2022

@matteodelabre have you had a chance to look at this again?

@matteodelabre
Copy link
Member

Not yet. It’s still on my list but I have limited time available currently.

@matteodelabre
Copy link
Member

Finally managed to make the build work again on the latest Debian… by pinning GCC to version 10. This should allow moving forward for now. Ideally reMarkable would update their glibc to the latest version soon so that we can move to more recent versions of GCC.

@Eeems
Copy link
Member Author

Eeems commented Feb 24, 2022

Is there a new image tag I can use?

@matteodelabre
Copy link
Member

Should be available on latest once the CI completes. Note that this image should be equivalent to the previous ones (if nothing broke). It’s essentially an update. I’ll then work upon this to implement the things we discussed in this thread.

@matteodelabre
Copy link
Member

matteodelabre commented Feb 24, 2022

Just added libcurl and OpenSSL to latest. Could you give it a try @Eeems?

@Eeems
Copy link
Member Author

Eeems commented Feb 24, 2022

@matteodelabre https://github.com/Eeems-Org/oxide/runs/5324827668

[ DEBUG] toltec.builder: oxide [rmall]: /opt/x-tools/arm-remarkable-linux-gnueabihf/lib/gcc/arm-remarkable-linux-gnueabihf/10.3.0/../../../../arm-remarkable-linux-gnueabihf/bin/ld.bfd: cannot find -lbreakpad_client

Which is odd since it should be building it as part of the compile.

@matteodelabre
Copy link
Member

Looks like the libbreakpad_client.a and libbreakpad.a static libraries are present in the OECore toolchain (no dynamic library counterpart is available on the rM system).

@Eeems
Copy link
Member Author

Eeems commented Feb 24, 2022

That might be why. I guess I'll have to add building it into the steps

@matteodelabre
Copy link
Member

Since it’s available on the rM toolchain I could also add it to ours.

@matteodelabre
Copy link
Member

Just published another latest update that includes breakpad and breakpad-client @Eeems

@Eeems
Copy link
Member Author

Eeems commented Feb 26, 2022

@matteodelabre Running it again

@Eeems
Copy link
Member Author

Eeems commented Feb 26, 2022

Looks like that did it! @matteodelabre

@matteodelabre
Copy link
Member

Excellent! I’ll prepare a new release then.

@matteodelabre matteodelabre changed the title Add CMAKE_TOOLCHAIN_FILE env var and libcurl library Add libcurl, openssl and libbreakpad to the base image Feb 27, 2022
@matteodelabre
Copy link
Member

Now available under the 2.3 tag.

@matteodelabre
Copy link
Member

Closing this, will track adding docs for using CMake in #12.

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

No branches or pull requests

2 participants