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

Need a Cross compile example #163

Open
staticmem opened this issue Jun 2, 2024 · 5 comments
Open

Need a Cross compile example #163

staticmem opened this issue Jun 2, 2024 · 5 comments

Comments

@staticmem
Copy link

I'm ok with .configure scripts from the older releases and while I can build the current zziplib using Cmake to create a Makefile and then using the traditional make command for the current host I don't know what I need to do to cross compile with Cmake.

Do I have to edit the CMakeLists.txt file every time the target changes and if so what needs to change?

I would like one simple example. Let's say I want to use "x86_64-w64-mingw32" to create a Windows build. I have a location in /opt to place the target files.

How would I go about this?

@gdraheim
Copy link
Owner

gdraheim commented Jun 3, 2024

There is a working example in the source code - "testbuilds.py test_250" and "testbuilds.py test_260".

I just made it working, and I wanted to have a test with conan as well, so it may not contain all the answers you need. Cmake itself should allow for anything needed to crosscompile. As I was using automake without conan in the past, I need to learn more about that myself.

@staticmem
Copy link
Author

staticmem commented Jun 3, 2024

I really have no idea what to do with it, I run this...

$ cd zziplib-master

$ ./testbuilds.py test_250
WARNING:TESTING:     windows-static-x64 compiles fine but segfaults on linking an .exe
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK (skipped=1)

I don't think it does any compiling as it just returns straight away.

I would have thought something like this was required:

https://earthly.dev/blog/cmake-gcc-cross-compile/

At this stage I think I'll have to use zziplib-0.13.69.tar.gz and install the files myself and copy the __*.h files to the include directory which has worked around the issue in the past (I found some notes I had for that). That release has worked for me in the past and I'm just after something that can be cross compiled easily.

@gdraheim
Copy link
Owner

gdraheim commented Jun 3, 2024

The "testbuilds.py" requires an active docker service as it uses a containerized crossgcc. I do not expect anyone to preinstall a compiler on the host to get some tests running. If you like then you can look into the respective dockerfile that is used by the test.

https://github.com/gdraheim/zziplib/blob/master/testbuilds/windows-shared-x64.dockerfile

@staticmem
Copy link
Author

staticmem commented Jun 3, 2024

Way too involved and complicated for me I'm afraid. Even a .configure script that many packages use only requires one line to cross compile so I'm not sure why Cmake is taking over the traditional way of doing things.

Thanks anyway.

@gdraheim
Copy link
Owner

gdraheim commented Jun 3, 2024

Well, cmake is better for use in IDEs. And I will certainly remove the automake-configure script in the near future.

As for myself, I do a lot of devops-consulting and Conan is the tool for versioning and better release-managment. This is required in a lot of places even getting into the "reproducible builds" domain. The industry is changing.

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