-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Build lib Files on Windows #6740
Build lib Files on Windows #6740
Conversation
…uild-lib-files-on-windows
…est suite" This reverts commit a5c076e.
…uild-lib-files-on-windows
just use the msys2 toolchain? |
You're right that we could swap entirely to the MSVC toolchain on Windows, but that would necessitate writing and maintaining an entirely separate build path specifically for Windows as, atm, all platforms are built with gcc. Additionally, because the same Makefiles are used to build user projects, we would then also have to ship the MSVC toolchain with the Windows Webots installation (or maintain a third, gcc-on-Windows build path), which is a whole other can of worms. For those reasons, I would much prefer finding a way to get MSVC to generate the required files from the existing gcc-compiled files. |
I meant msys2 not msvc |
Sorry, my bad, I misinterpreted your original comment. From my understanding, msys2 is just a collection of Windows software ports; not a toolchain. AFAIK, the only major C/C++ toolchains are MSVC, Clang/LLVM, and GCC. Webots currently uses the gcc toolchain (msys2's version on Windows). However, despite my best efforts, I've been unable to find a way to get gcc to generate MSVC style importlibs directly. Hence, this approach. |
msys2 is a distro that provides mingw which is gcc with libraries and headers to build on windows. msys2 provides the toolchain such as gcc, rust, go, mono, node, clang, etc. Afaik gcc generates .a files, I think they're the same as .lib files... just rename them. But you can just use them with msvc (as long as they are C and not CPP) |
I just ran a few tests, and you appear to be right! I knew about those files, but I thought they were ELF rather than COFF. (I suppose that's my fault for not double-checking :P ) Thanks for the tip! There's still some more work I want to do to get these changes ready for review, but you just saved me a bunch of it :D |
Description
Currently, Windows import libraries (
.lib
files) are only being generated for some binaries. This makes it difficult to link to these binaries with the MSVC toolchain. This was previously done because generating these files requires listing all of there exports in a file, which had to be done by hand. This PR updates the relevant Makefiles to use MinGW'sdlltool
to generate these export listings. These can then be compiled to import libraries by MSVC.I did a quick check between the autogenerated and manually written files, and it looks like the new ones are the same, with two distinctions:
My knowledge of the MSVC toolchain is somewhat limited, so take the above with a grain of salt.
The other major note is that the
Controller.def
file is currently used to verify the Matlab function set. My guess is that I can rewrite the code to filter out just the webots definitions from the generated files (because they start withwb
), but it will probably be a bit less cut-and-dry than the old implementation.UPDATE: I've gone through and done a more detailed comparison between the old and new versions of the
Controller.def
files. Here's a rundown of the differences:The old version has an additional 5 functions listed:
wb_range_finder_image_get_depth
- This is actually a#define
statement, so it's included purely in the header files. It does not need to be in the def.wbr_camera_set_focal_distance
andwbr_camera_set_fov
- These functions are only used by the remote control plugin. They also do not need to be exported.wbu_robot_window_configure
andwbu_robot_window_update
- These functions do not exist anywhere else in the codebase. My guess is that they were at some point removed, but theController.def
file was never updated.The new version has a bunch of additional functions. As stated above. Most of these are library functions and other statically-linked stuff. Here, I will ignore everything besides the Webots functions/constants (stuff starting with
wb
).Here's a full list
wb_abstract_camera_*
- These are used by the various implementations of cameras and are not usually called directly.wb_radio_*
- These are used by the radio plugin.wbr_*
- These are used by the remote control plugin.wb_*_init`/`wb_*_cleanup
- These are mostly called automatically by other parts of the API.*_no_mutex
- Variants of other functions that do not lock the robot mutex. Again, used internally. A couple of `wb_robot_* functions that are part of the internal API.wb_(lidar/range_finder)_get_unique_id
- Unused internal functions to get the unique id of the underlying abstract camera object for the corresponding node types.wb_file_get_extension
- Internal API function.wb_node_get_name
- Only available in the C API.A couple functions used internally by the Matlab API
Some functions that I think should've probably been included in the original
Controller.def
fileRelated Issues
This pull-request fixes issue #6434 .