FLTK logo

[fltk.general] Re: crosscompiling to macos 10 linker issues

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: crosscompiling to macos 10 linker issues Manolo 03:11 May 02  
 
The fact there's a link error and not a compilation error suggests an incongruency between the macOS conditions used to compile (that is, the version of the SDK used) and the arguments of the link command used:
if symbol OBJC_CLASS$_UTType is needed at link time, it means the source has been compiled with an SDK version of macOS ≥ 11;
it means also that the link option "-framework UniformTypeIdentifiers" necessary to resolve this symbol is missing from the link command.

The adequate link option is defined by CMake by this if statement:
    if(NOT(${CMAKE_SYSTEM_VERSION} VERSION_LESS 20.0.0)) # a.k.a. macOS version ≥ 11.0
Apparently, the cross build gives  ${CMAKE_SYSTEM_VERSION} a value < 20 so  "-framework UniformTypeIdentifiers" is omitted from the link command.
But this is not congruent with having used a version of the SDK ≥ 11.0 during the compilation step.
Caution: there are 2 distinct numbering systems here: that for macOS (we are now at macOS Sonoma14.x) used for SDKs
and that for Darwin used by CMAKE_SYSTEM_VERSION (macOS 14 corresponds to Darwin 23).

I believe the linux->macos cross-build operation with CMake should control these 2 CMake-defined variables
- CMAKE_OSX_SYSROOT  should specify the location or name of the macOS SDK used by the osxcross toolchain in use;
- CMAKE_OSX_DEPLOYMENT_TARGET should indicate the minimum version of a macOS system on which the executable will run (it must be equal or less than the version of the SDK given in CMAKE_OSX_SYSROOT).

See also the cmake doc for more details:
https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_SYSROOT.html#cmake-osx-sysroot

The source code of FLTK takes care of testing the macOS version of the running system and refrains from using symbols
belonging to macOS versions more recent than the running version. Thus, FLTK libraries can be built for recent macOS versions and run
on old macOS systems without problem provided the version given in CMAKE_OSX_DEPLOYMENT_TARGET is met.


--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/b6284760-eb95-4d99-809a-17953abedfbfn%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.