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 cross-compilation support #149

Closed
semlanik opened this issue Aug 20, 2020 · 4 comments
Closed

Add cross-compilation support #149

semlanik opened this issue Aug 20, 2020 · 4 comments
Assignees
Labels
feature New feature to be implemented protobuf QtProtobuf related issues
Projects
Milestone

Comments

@semlanik
Copy link
Owner

During cross-compilation generator should always be compiled for host system, but not for target

@semlanik semlanik added protobuf QtProtobuf related issues feature New feature to be implemented labels Aug 20, 2020
@semlanik semlanik self-assigned this Aug 20, 2020
@semlanik semlanik added this to ToDo in Qt Protobuf via automation Aug 20, 2020
@semlanik semlanik added this to the v0.6.0 milestone Aug 31, 2020
@rapgenic
Copy link
Contributor

Could this be related to cmake variable QT_PROTOBUF_EXECUTABLE?

Because I tried using it for cross compilation but i have not been able to make it work and cmake gives me the following message:

/home/giulio/....../qtprotobuftest/build_arm/qtprotobuf/src/generator/qtprotobufgen: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable

Which seems to suggest that cmake ignores this variable.

Note that qtprotobuf is included via CMakeLists.txt into my project and that I tried passing the variable both as parameter to cmake (-DQT_PROTOBUF_EXECUTABLE=.....) and with set inside the lists file

@semlanik
Copy link
Owner Author

@rapgenic, unfortunately no. The problem is that qtprotobufgen compiled for ARM and couldn't be executed in x84/amd64 platform. I didn't find any CMake way to make compilation for host and native platforms in single CMake stack. I'm working on this task right now, and the only way I see is split generator and libraries deeper and make 2 steps crosscompilation. If you have an idea how it could be solved I'm open for suggestions :)

@rapgenic
Copy link
Contributor

The problem is that qtprotobufgen compiled for ARM and couldn't be executed in x84/amd64 platform.

That is what i had noticed too, and I thought that I could compile once for x86 and then use QT_PROTOBUF_EXECUTABLE to have cmake use the x86 compiled generator instead of the ARM built one, but I could not get it to work. (this would be the best solution for me, I think, because I am going to have in my filesystem the right version of the generator already installed)

If you have an idea how it could be solved I'm open for suggestions :)

I think i have read somewhere that cmake can only use one toolchain... :(
Anyway i found this link on SO https://stackoverflow.com/questions/36173840/how-to-instruct-cmake-to-use-the-build-architecture-compiler which seems to suggest that running another cmake instance inside the main one might be the solution.

@semlanik
Copy link
Owner Author

As far as I could see, they use exact same approach that I have. Run cmake twice and use x86 version in compilation for ARM. Looks like it's the only right way to achieve cross-compilation.

semlanik added a commit that referenced this issue May 13, 2021
- Add support of the two-steps crosscompiling.
- Fix issues in Wrap scripts
- Update README
- Set the CMP0112 policy to old, to avoid configuration warnings
- Add a sample toolchain file to examples

Fixes: #149
semlanik added a commit that referenced this issue May 13, 2021
- Add support of the two-steps crosscompiling.
- Fix issues in Wrap scripts
- Update README
- Set the CMP0112 policy to old, to avoid configuration warnings
- Add a sample toolchain file to examples

Fixes: #149
semlanik added a commit that referenced this issue May 13, 2021
- Add support of the two-steps crosscompiling.
- Fix issues in Wrap scripts
- Update README
- Set the CMP0112 policy to old, to avoid configuration warnings
- Add a sample toolchain file to examples

Fixes: #149
semlanik added a commit that referenced this issue May 13, 2021
- Add support of the two-steps crosscompiling.
- Fix issues in Wrap scripts
- Update README
- Set the CMP0112 policy to old, to avoid configuration warnings
- Add a sample toolchain file to examples

Fixes: #149
semlanik added a commit that referenced this issue May 13, 2021
- Add support of the two-steps crosscompiling.
- Fix issues in Wrap scripts
- Update README
- Set the CMP0112 policy to old, to avoid configuration warnings
- Add a sample toolchain file to examples

Fixes: #149
Qt Protobuf automation moved this from ToDo to Done May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature to be implemented protobuf QtProtobuf related issues
Projects
Qt Protobuf
  
Done
Development

No branches or pull requests

2 participants