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
[bug] libiconv.res.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86' #20689
Comments
|
Thanks for your report. I can reproduce it, by moving to the libiconv folder and doing a single: I can see the error (it is not necessary to do the Thanks very much also for your detailed investigation. |
|
Good point about
In the build folder On Windows, typing this command
Also, I recall this SO question and it suggested using RCFLAGS, but I had no luck with that approach. For now, I've patched it directly using this specific x86 python code which has the effect of adding the target option windres-options Thanks for your time. |
|
Ok, thanks very much for the explanations. I'd recommend trying to simplify it to a one liner def _apply_resource_patch(self): #Note the _ to make it private, just in case
if self.settings.arch == "x86":
windres_options_path = os.path.join(self.source_folder, "windows", "windres-options")
self.output.info("Applying {} resource patch: {}".format(self.settings.arch, windres_options_path))
replace_in_file(self, windres_options_path, '# PACKAGE_VERSION_SUBMINOR', '\necho "--target=pe-i386"\n')With |
|
I'll submit a PR to conan-center-index\recipes\libiconv\all\conanfile.py Add replace_in_file to the imports: Add |
|
Ok, I'll move this ticket to |
|
When you do a PR, you can add in the comment a |
Environment details
Steps to reproduce
This bug was initially reported here: https://lists.defectivebydesign.org/archive/html/bug-gnu-libiconv/2021-01/msg00002.html
and I'm currently running into the same error.
Below are the libiconv build steps, the fatal error and a suggested patch.
Creating the libiconv library
git clone https://github.com/conan-io/conan-center-index.git
cd conan-center-index/recipes/libiconv/all
Build of x86 libiconv/1.17
conan remove libiconv/1.17
conan export c:\Projects\conan-center-index\recipes\libiconv\all libiconv/1.17@/
...
libtool: compile: windres -DPACKAGE_VERSION_STRING=\"1.17\" -DPACKAGE_VERSION_MAJOR=1 -DPACKAGE_VERSION_MINOR=17 -DPACKAGE_VERSION_SUBMINOR=0 -i /c/users/johnsmith/.conan/data/libiconv/1.17///build/e7f407375b48ca2f89135f6704b636cb32edd0ff/src/lib/../windows/libiconv.rc --output-format=coff -o libiconv.res.obj
/bin/sh ../libtool --mode=link /c/users/johnsmith/.conan/data/libiconv/1.17///build/e7f407375b48ca2f89135f6704b636cb32edd0ff/src/build-aux/compile cl -nologo -debug -MT -Zi -O2 -Ob1 -FS -o libiconv.la -rpath /lib -version-info 8:1:6 -no-undefined iconv.lo localcharset.lo relocatable.lo libiconv.res.lo
libtool: link: /c/users/johnsmith/.conan/data/libiconv/1.17///build/e7f407375b48ca2f89135f6704b636cb32edd0ff/src/build-aux/ar-lib lib cr .libs/iconv.lib iconv.obj localcharset.obj relocatable.obj libiconv.res.obj
libiconv.res.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
make[1]: *** [Makefile:77: libiconv.la] Error 88
make[1]: Leaving directory '/c/Users/johnsmith/.conan/data/libiconv/1.17///build/e7f407375b48ca2f89135f6704b636cb32edd0ff/build-relwithdebinfo/lib'
make: *** [Makefile:33: all] Error 2
libiconv/1.17:
libiconv/1.17: ERROR: Package 'e7f407375b48ca2f89135f6704b636cb32edd0ff' build failed
libiconv/1.17: WARN: Build folder C:\Users\johnsmith.conan\data\libiconv\1.17__\build\e7f407375b48ca2f89135f6704b636cb32edd0ff\build-relwithdebinfo
ERROR: libiconv/1.17: Error in build() method, line 126
autotools.make()
ConanException: Error 2 while executing make -j16
Executing error: Program conan: returned error code: 1
...
I tried 3 ways to resolve this error:
--- src/windows/windres-options
+++ src/windows/windres-options
@@ -34 +33,0 @@ q
and updated conandata.yml as follows:
patches:
"1.16":
- patch_file: "patches/0001-libcharset-fix-linkage.patch"
"1.17":
- patch_file: "patches/ windres-options.patch"
but, ran into this error
C:\Users\johnsmith.conan\data\libiconv\1.17__\build\e7f407375b48ca2f89135f6704b636cb32edd0ff\patches/windres-options.patch: source/target file does not exist:
[Config:x86] --- b'src/windows/windres-options'
[Config:x86] +++ b'src/windows/windres-options'
self.run(r'"C:\Program Files\Git\usr\bin\patch.exe" -p0 -R --binary < {}'.format(patch_file_path), cwd=parent_build_folder, output=True)
so no luck with this method.
--target=pe-i386Creating the libiconv resource Patch
Navigate to the directory:
cd conan-center-index/recipes/libiconv/all
conanfile.py Modifications:
Added a new function called
apply_resource_patch()which correctly added this option
--target=pe-i386to the windres commandline during the build:libtool: compile: windres --target=pe-i386 -DPACKAGE_VERSION_STRING=\"1.17\" -DPACKAGE_VERSION_MAJOR=1 -DPACKAGE_VERSION_MINOR=17 -DPACKAGE_VERSION_SUBMINOR=0 -i /c/users/johnsmith/.conan/data/libiconv/1.17///build/e7f407375b48ca2f89135f6704b636cb32edd0ff/src/lib/../windows/libiconv.rc --output-format=coff -o libiconv.res.obj
Everything now builds successfully and that patch resolves the x86 build error:
libiconv.res.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'I'd like to be able to use the standard apply_conandata_patches() method for libiconv instead of modifying the file directly via the custom patch function apply_resource_patch().
There are 3 proposed patch methods above:
apply_conandata_patches()patch.exeto apply the patchapply_conandata_patches()Hopefully a patch can be added to resolve the x86 only fatal error.
Thanks!
Logs
No response
The text was updated successfully, but these errors were encountered: