FLTK logo

[fltk.coredev] Understanding macOS build environments

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.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Understanding macOS build environments Albrecht Schlosser Mar 03, 2021  
 
All,

I need your help to (better) understand other users' macOS build environments.

As you may know I'm trying to maintain our build support files, mainly CMake but also autoconf as far as I can do.

As a new Mac owner I'm now able to improve our build files for macOS. My first goal is to make the build files compatible with different users' build environments, for instance Homebrew, Fink, certainly more, *without* having to hardcode paths like /sw, /opt/sw, /opt/homebrew etc. directly in the build files. I'm making progress but I need more info, that's why I'm asking here.

I know this may involve some work on your side, but maybe you can help and I'd appreciate this very much. I'll post questions prefixed by "Q: " and my own answers as an example prefixed by "A: " (Answer/Albrecht).

If you reply, please cite the Questions (Q:) but trim my answers for brevity and clarity. TIA.


I learned that you need the "Xcode commandline tools" for any builds so you have compilers, git, and build tools. This is what I did too and I assume this as a general requirement for commandline builds - unless you install Xcode and build and test with that.

I learned also that there are some tools that act like "package managers" to install software packages that are not included in macOS. Popular tools are Homebrew and Fink, but there are certainly others. I decided to install Homebrew and that's what I'm now working with.


Q: Which "package management" tool(s) did you install and which tool(s) are you actually using?

A: Homebrew


Q: How are you mainly building FLTK? Options are configure/make or CMake. If CMake, please add your "Generator" as well, like "Unix Makefiles", "Ninja", "Xcode", ...

A: autoconf + CMake/Ninja + CMake/Xcode (I did not yet try CMake/"Unix Makefiles").

Note: my first build with configure/make worked fine w/o installing autoconf. I copied a current 'configure' file from my Linux build system but you can also use a FLTK release tarball or snapshot which contain configure scripts. No additional software beyond the FLTK download and the "commandline tools" are required. I'm trying to use as many different build environments as possible to test FLTK builds.


Q: If you are using autoconf/configure, how did you install 'autoconf'?

A: Homebrew (brew install autoconf)


Q: If you are using Homebrew, what is your Homebrew install directory?

A: /opt/homebrew

FYI: Homebrew installs its packages on new "arm64" Macs to /opt/homebrew and places symbolic links in /usr/local whereas it installs to /usr/local on Intel Macs.


Q: Do you have pkg-config installed; if yes: by which package manager or self-built or ...?

A: yes, Homebrew


Q: How are you building/using the bundled libs (jpeg, png, zlib), i.e. system or bundled (aka "local") versions?

A: all three either system (WIP) or bundled, i.e. all combinations of system and/or bundled libs work with either configure/make or CMake/Ninja (see below for "WIP").

Note: I like Ninja (brew install ninja). It's much faster than "Unix Makefiles" particularly if only a few files were changed.


Q: What build environments do you use, particularly do you use Xcode to edit/build/test/debug (FLTK) and your FLTK application code?

A: VS Code (Visual Studio Code) is now my preferred editor and build/test environment.

I'm using VS Code on Linux and macOS for editing and debugging. There are currently some limits on M1 (arm64) Macs: debugging with VS Code works only for x86_64 builds (using Rosetta which makes it somewhat slower), not for native arm64 but I'm confident this will be resolved soon (there are open GitHub Issues). Meanwhile I can build x86_64 target code for debugging with VS Code or I can use Xcode to debug arm64 code. Universal binaries (arm64 + x86_64) build but not yet tested with debugger (lldb).


Q: What else should I know about the build environments on your Macs WRT building FLTK? Which extra build options work, which ones don't?

A1: I installed Cairo (brew install cairo) and I can now build the Cairo demo - either with configure/make or CMake (after a recent commit).

A2: I'm working on support for using the system versions of all bundled libs (jpeg, png, zlib). The current status is that I can build (see answer above) but only with modified CMake files, suited to my Homebrew setup. AFAICT in previous versions only the bundled jpeg and png libs worked and zlib was usually "system".

A3: Building universal apps (arm64 + x86_64) basically works but all my installed Homebrew libs are (currently) arm64 only, hence I can build apps with system libs (jpeg, png, zlib, cairo, etc.) only as arm64 targets. I hope this can be changed, maybe by building universal libs myself or if Homebrew can support universal libs in the future.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/de9641fd-447c-d49c-9c8b-a9f35474fe96%40online.de.
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'.