Skip to Content.
Sympa Menu

freetds - Re: [freetds] Cross-compiling for Mac Catalyst

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Cross-compiling for Mac Catalyst
  • Date: Thu, 7 May 2020 20:17:35 +0100

Hi,
I manage to get Catalina on my laptop (pretty old nowadays) but I'm
pretty busy at the moment.

I looked at the log.
So, the error is

ld: building for Mac Catalyst, but linking in dylib built for macOS,
file '../../dblib/.libs/libsybdb.dylib' for architecture x86_64h

trying to link fisql which is an executable. This error is apparently
a mismatch of ABIs. A mismatch between a shared library (dylib) and
the executable.
The 2 parameters that seem to specify the target are -arch and -target.

The command for the executable is

clang -D_THREAD_SAFE -arch x86_64h -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
-target x86_64-apple-ios13.0-macabi -Wdeclaration-after-statement
-arch x86_64h -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
-target x86_64-apple-ios13.0-macabi -o .libs/fisql fisql.o terminal.o
edit.o handlers.o interrupt.o ../../dblib/.libs/libsybdb.dylib
../../replacements/.libs/libreplacements.a -liconv

the one for the dylib is

clang -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o
.libs/libsybdb.5.dylib .libs/dblib.o .libs/dbutil.o .libs/rpc.o
.libs/bcp.o .libs/xact.o .libs/dbpivot.o
-Wl,-force_load,../tds/.libs/libtds.a
-Wl,-force_load,../replacements/.libs/libreplacements.a -liconv
-arch x86_64h -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
-arch x86_64h -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
-install_name
/Users/niklas/Downloads/freetds-ios/work/catalyst/build_ios/freetds/x86_64h/lib/libsybdb.5.dylib
-compatibility_version 7 -current_version 7.0 -Wl,-single_module

one thing weird is that this last has no -target specified. Maybe is
this the issue?

I also noted that tdspool, another executable, is linked successfully
but the difference here is that tdspool links only convenience
libraries (basically static libraries).

I would suggest manually to try to rebuild the dylib, something like:
- build as you are doing
- move to src/dblib
- launch the command to compile libsybdb.5.dylib with the additional
"-target x86_64-apple-ios13.0-macabi"
- move back to src/apps/fisql
- launch the command to compile fisql (I think also make should work here)

All object files have both -arch and -target too.

Did you run autoreconf? Sometimes it's helpful as it replaces the
libtool provided which sometimes helps under some systems, something
like
- "autoreconf -vif"
- configure
- make

Regards,
Frediano

Il giorno ven 1 mag 2020 alle ore 15:11 Niklas Saers
<niklas AT saers.com> ha scritto:
>
> Hi Frediano and the rest of the team,
> Sorry for the delay, I’m no-where closer than I was 1,5 month ago although
> having given it many evenings.
>
> To build the macOS Catalyst only version, I made a branch that does that:
> https://github.com/niklassaers/freetds-ios/tree/catalyst-only
> <https://github.com/niklassaers/freetds-ios/tree/catalyst-only>
>
> Here I’ve included the full log with the make V=1:
>
> https://raw.githubusercontent.com/niklassaers/freetds-ios/catalyst-only/build-catalyst.log
>
> <https://raw.githubusercontent.com/niklassaers/freetds-ios/catalyst-only/build-catalyst.log>
>
> Also, I’ve inlined in
> https://raw.githubusercontent.com/niklassaers/freetds-ios/catalyst-only/build-catalyst-2.sh
>
> <https://raw.githubusercontent.com/niklassaers/freetds-ios/catalyst-only/build-catalyst-2.sh>
> some of the many different ways I’ve tried, and how the errors I’ve
> received have been a bit different.
>
> Does this ring a bell? Any suggestions to what I should try?
>
> If anyone wants to give it a shot but doesn’t have access to macOS
> Catalina, I have prepared a macOS VM on my iMac, that is available via SSH
> from the internet. I’d be happy to give access to anyone who wants to give
> building it a shot. Just shoot me a private email and I’ll provide the
> details
>
> Cheers
>
> Niklas
>
> > On 9 Mar 2020, at 09.49, Frediano Ziglio <freddy77 AT gmail.com> wrote:
> >
> > Hi,
> > no much ideas, I would check the commands to see if there are some
> > weird options.
> > I usually do a clean and another "make V=1" to see the full commands.
> > The important ones are a compile command and a final link one, with
> > all options. Can you post them?
> > I don't have a Mac to try myself.
> >
> > Regards,
> > Frediano
> >
> >
> > Il giorno ven 6 mar 2020 alle ore 15:17 Niklas Saers
> > <niklas AT saers.com <mailto:niklas AT saers.com>> ha scritto:
> >>
> >> Hi Frediano,
> >> No, I haven’t made any progress, and I’d really appreciate some help. :-)
> >>
> >> The build script go.sh in https://github.com/niklassaers/freetds-ios
> >> <https://github.com/niklassaers/freetds-ios>
> >> <https://github.com/niklassaers/freetds-ios
> >> <https://github.com/niklassaers/freetds-ios>> will download FreeDTS, and
> >> build it from clean. So unless I’ve done something odd, I don’t think
> >> there should be leftovers from an old build. I just verified it by
> >> downloading the repo to an clean dir and running it. I still get the
> >> same error:
> >>
> >> ld: building for Mac Catalyst, but linking in dylib built for macOS,
> >> file '../../dblib/.libs/libsybdb.dylib' for architecture x86_64h
> >>
> >> If you’re on a Mac running Catalina, would you mind downloading the repo
> >> and running go.sh ? I expect you’ll get the same error, but perhaps
> >> you’ll have a better understanding as to why it comes?
> >>
> >> PS, Mac Catalyst architecture is x86_64-apple-ios13.0-macabi - no arm
> >> involved
> >>
> >> Cheers
> >>
> >> Niklas
> >>
> >>
> >>> On 6 Mar 2020, at 11.32, Frediano Ziglio <freddy77 AT gmail.com> wrote:
> >>>
> >>> Il giorno mer 26 feb 2020 alle ore 16:18 Niklas Saers
> >>> <niklas AT saers.com> ha scritto:
> >>>>
> >>>> Hi,
> >>>> First of all thanks for all the hard work that has been put into this
> >>>> project, and thank you very much for letting me join the list.
> >>>>
> >>>> I'm trying to cross-compile FreeTDS for the different iOS platforms
> >>>> and for Mac Catalyst. I've made a project with my scripts at
> >>>> https://github.com/niklassaers/freetds-ios
> >>>>
> >>>> If you clone it and run go.sh, it compiles iOS versions for arm64e,
> >>>> arm64, armv7s, armv7 and the simulator, plus a catalyst version. It
> >>>> goes seemingly fine for the iOS versions, but for Mac Catalyst, I get
> >>>> the following error:
> >>>>
> >>>> ld: building for Mac Catalyst, but linking in dylib built for macOS,
> >>>> file '../../dblib/.libs/libsybdb.dylib' for architecture x86_64h
> >>>>
> >>>> Any idea why I get this linker error, and how I can resolve it?
> >>>>
> >>>> My build script for the Mac Catalyst build by itself is here:
> >>>> https://raw.githubusercontent.com/niklassaers/freetds-ios/master/build-catalyst-2.sh
> >>>>
> >>>> Cheers
> >>>>
> >>>> Niklas
> >>>
> >>> Hi,
> >>> did you solve this?
> >>>
> >>> From the message looks like some kind of leftover from an old build or
> >>> picking up a library for another architecture.
> >>> Unless for some reason you manage to compile for x86_64 and attempting
> >>> linking with arm.
> >>>
> >>> Regards,
> >>> Frediano
> >>> _______________________________________________
> >>> FreeTDS mailing list
> >>> FreeTDS AT lists.ibiblio.org
> >>> https://lists.ibiblio.org/mailman/listinfo/freetds
> >>
> >> _______________________________________________
> >> FreeTDS mailing list
> >> FreeTDS AT lists.ibiblio.org <mailto:FreeTDS AT lists.ibiblio.org>
> >> https://lists.ibiblio.org/mailman/listinfo/freetds
> >> <https://lists.ibiblio.org/mailman/listinfo/freetds>
> > _______________________________________________
> > FreeTDS mailing list
> > FreeTDS AT lists.ibiblio.org <mailto:FreeTDS AT lists.ibiblio.org>
> > https://lists.ibiblio.org/mailman/listinfo/freetds
> > <https://lists.ibiblio.org/mailman/listinfo/freetds>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> https://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page