Issue Building Wine: file built for unknown-unsupported file format

Questions about Wine on macOS.
Post Reply
AgentEpsilon
Newbie
Newbie
Posts: 2
Joined: Wed Apr 15, 2020 3:39 pm

Issue Building Wine: file built for unknown-unsupported file format

Post by AgentEpsilon » Wed Apr 15, 2020 3:51 pm

Hello,
I am attempting to build Wine (on macOS Catalina, but my impression has been that wine64 is still working and I don't need 32-bit support). However, after running configure --enable-win64 and make-ing, I am presented with the following error:

Code: Select all

gcc -m64 -o widl client.o expr.o hash.o header.o proxy.o register.o server.o typegen.o typelib.o \
  typetree.o utils.o widl.o write_msft.o parser.tab.o parser.yy.o ../../libs/port/libwine_port.a \
  ../../libs/wpp/libwpp.a
ld: warning: ignoring file ../../libs/port/libwine_port.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file ../../libs/wpp/libwpp.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture x86_64:
  "_wpp_add_cmdline_define", referenced from:
      _main in widl.o
  "_wpp_add_define", referenced from:
      _main in widl.o
  "_wpp_add_include_path", referenced from:
      _main in widl.o
  "_wpp_find_include", referenced from:
      _add_importlib in typelib.o
      _do_import in parser.yy.o
  "_wpp_parse", referenced from:
      _main in widl.o
      _parser_lex in parser.yy.o
      _do_import in parser.yy.o
  "_wpp_set_debug", referenced from:
      _main in widl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [widl] Error 1
make: *** [tools/widl] Error 2
This is the error that trying to build wine 5.6 presents me. I also tried to build an earlier version (4.20), but was presented with a similar error:

Code: Select all

gcc -m64 -o make_xftmpl make_xftmpl.o ../libs/port/libwine_port.a
ld: warning: ignoring file ../libs/port/libwine_port.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
gcc -m64 -c -o sfnt2fon.o sfnt2fon.c -I. -I../../include -I/usr/local/opt/freetype/include/freetype2 \
  -D__WINESRC__ -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body \
  -Wignored-qualifiers -Wno-pragma-pack -Wstrict-prototypes -Wtype-limits -Wvla -Wwrite-strings \
  -Wpointer-arith -gdwarf-2 -gstrict-dwarf -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
gcc -m64 -o sfnt2fon sfnt2fon.o ../../libs/port/libwine_port.a -L/usr/local/opt/freetype/lib -lfreetype \

ld: warning: ignoring file ../../libs/port/libwine_port.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Undefined symbols for architecture x86_64:
  "_wine_cp_get_table", referenced from:
      _main in sfnt2fon.o
  "_wine_cp_mbstowcs", referenced from:
      _main in sfnt2fon.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [sfnt2fon] Error 1
make: *** [tools/sfnt2fon] Error 2
It seems this issue revolves around source files being built for an incorrect format. Does anyone have any idea what could be the issue here? I'm trying to see if anything in my environment could be causing this error, but nothing comes to mind.

Thanks for your time,
AgentEpsilon

Gcenx
Level 5
Level 5
Posts: 435
Joined: Mon Dec 25, 2017 12:11 pm

Re: Issue Building Wine: file built for unknown-unsupported file format

Post by Gcenx » Wed Apr 15, 2020 10:42 pm

As you didn’t mention if you installed the required build dependencies I can’t be sure exactly what’s happening here.

However I can tell you an additional patch is required to compile wine-5.6 you can find that here

Be sure you have mingw installed as that’s required to compile PE files correctly, also Xcode11 on Catalina has some weird linker bug causing issues after the compile so you need to force min version to 10.14 or lower to get it working.

If you use macports I have a Portfile overlay here macports-wine I’ve already added all required workarounds and the required patch to compile wine-5.6

AgentEpsilon
Newbie
Newbie
Posts: 2
Joined: Wed Apr 15, 2020 3:39 pm

Re: Issue Building Wine: file built for unknown-unsupported file format

Post by AgentEpsilon » Thu Apr 16, 2020 10:55 am

I've made sure to have MinGW installed, and I've applied the patch you provided, with no changes.
Gcenx wrote:
Wed Apr 15, 2020 10:42 pm
also Xcode11 on Catalina has some weird linker bug causing issues after the compile so you need to force min version to 10.14 or lower to get it working.
Can you elaborate on this? A "weird linker bug" sounds pretty close to what I'm experiencing now, and I hadn't heard of this before. (Additionally, any idea where I would force it to build for 10.14 or below?)

Gcenx
Level 5
Level 5
Posts: 435
Joined: Mon Dec 25, 2017 12:11 pm

Re: Issue Building Wine: file built for unknown-unsupported file format

Post by Gcenx » Fri Apr 17, 2020 12:10 pm

Setting a deployment target can be done a couple of ways.

The following will force to 10.14;
configure CC="clang -mmacosx-version-min=10.14” CXX="clang++ -mmacosx-version-min=10.14”

Or;
export MACOSX_DEPLOYMENT_TARGET=“10.14”
configure (options)

The Xcode11 linker bug is annoying as wine64 will compile without issue but the resulting compile would fail to launch, forcing a lower deployment target however resolved it.

I do notice your using homebrew for dependencies, I haven’t tested using their provided libfreetype etc.
Last I checked both macports and homebrew had problem prebuilt packages, I instead force built everything from source (macports) and the issues were resolved.

Post Reply