Skip to content
Tcl Source Code View Ticket
Login

View Ticket

building Tcl with -O3

Openf46dc3c48d84a3879c8da793d755d5543188668cCreated 2 years agoUpdated 311 days ago
Descriptionplain2024-11-26 13:10:11
Hi,
I'm compiling Tcl on macOS and I would like to test it against -O3

the way I build Tcl on macOS is:
make -C macosx deploy
and -O2 is automatically set.

the only way I've found is to:
make -j 4 -C macosx deploy CFLAGS="-O3 -g0 -UCFLAGS_DEFAULT -fomit-frame-pointer"

is there's another way?
best regards,
Nicolas
cduboisplain2026-01-26 02:45:51
On macOS you don’t have to use the macosx make wrapper if you want to experiment with different compiler flags. The supported approach is the Unix build flow; macOS is covered there, with the mac-specific options --enable-framework and --enable-aqua.

Example (Framework build, isolated prefix, -O3 test):

mkdir -p build && cd build
../unix/configure --enable-framework --enable-aqua \
  --prefix="$HOME/tcl-O3-test" \
  CFLAGS="-O3 -g0"
make -j4
make test
make install


If you prefer to stay with make -C macosx deploy, overriding CFLAGS in the make invocation is the right direction; deploy is the “optimized build” target in the macOS build system.
If there’s a cleaner knob than passing variables to make, I haven’t found it in the macOS build docs—happy to be corrected by someone more familiar with that make wrapper.
Log in (anonymous is fine) to add a comment.