Skip to content

Commit b8514f8

Browse files
authored
Remove bundled fltk, have chplvis require a separately installed one (#26382)
Resolves #26370 This PR removes `third-party/fltk` in favor of expecting users to have `fltk` already installed and available when they `make chplvis`. The reasons for this are: 1. We were seeing problems building the bundled fltk 2. Fltk doesn't build without dependencies. If users have to install dependencies to build `chplvis`, why not ask them to install `fltk`? Meanwhile, `fltk` is available in Homebrew, Spack, and various Linux package managers. This PR adjusts `tools/chplvis/Makefile`: * to use `fltk-config` and `fluid` from the `PATH` (although `make FLTK_CONFIG=<something> FLTK_FLUID=<something-else>` should work to override them) * to automatically add `-I` and `-L` paths for `/opt/homebrew/{include,lib}` on ARM Macs * to use `fltk-config --use-images` because `chplvis` uses `Fl_PNG_Image` Lastly, this PR fixes a bug in `chplvis` that was causing core dump. Reviewed by @benharsh - thanks! - [x] chplvis builds on Mac OS X with Homebrew installed fltk - [x] chplvis builds on Ubuntu 24.04 with system-installed fltk - [x] full comm=none testing
2 parents 4d94654 + dec27cb commit b8514f8

File tree

11 files changed

+33
-98
lines changed

11 files changed

+33
-98
lines changed

Makefile

+2-6
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,8 @@ always-build-cls: FORCE
176176
$(MAKE) chpl-language-server; \
177177
fi
178178

179-
chplvis: compiler third-party-fltk FORCE
180-
cd tools/chplvis && $(MAKE)
181-
cd tools/chplvis && $(MAKE) install
179+
chplvis: FORCE
180+
cd tools/chplvis && $(MAKE) && $(MAKE) install
182181

183182
mason: compiler chpldoc notcompiler FORCE
184183
cd tools/mason && $(MAKE) && $(MAKE) install
@@ -224,9 +223,6 @@ compile-util-python: FORCE
224223
echo "Not compiling Python scripts - missing compileall" ; \
225224
fi
226225

227-
third-party-fltk: FORCE
228-
cd third-party/fltk && $(MAKE)
229-
230226
clean: FORCE
231227
cd compiler && $(MAKE) clean
232228
cd modules && $(MAKE) clean

doc/rst/tools/chplvis/chplvis.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ will help you understand the :mod:`VisualDebug` module and the
2121
Setup
2222
-----
2323

24-
``chplvis`` is built by giving the command ``make chplvis`` at the top level of
25-
the chapel tree. This also builds the GUI tool, *FLTK*, required to build and
26-
run ``chplvis``. (Note: Some versions of Linux may require the standard
27-
package ``libx11-dev`` to be installed before *FLTK* will compile properly.)
24+
``chplvis`` is built by giving the command ``make chplvis`` at the top
25+
level of the chapel tree. ``make chplvis`` will assume that FLTK is
26+
already installed and the ``fltk-config`` and ``fluid`` commands are
27+
available. (If necessary, you can adjust them with
28+
``make chplvis FLTK_CONFIG=<something> FLTK_FLUID=<something-else>``).
29+
2830
To get the most out of this primer, you should compile and run the example
2931
programs and examine the :mod:`VisualDebug` results with ``chplvis``. The
3032
example programs are found on the path ``examples/primers/chplvis``. The

make/Makefile.base

-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ include $(THIRD_PARTY_DIR)/gmp/Makefile.include
200200
include $(THIRD_PARTY_DIR)/hwloc/Makefile.include
201201
include $(THIRD_PARTY_DIR)/re2/Makefile.include
202202
include $(THIRD_PARTY_DIR)/llvm/Makefile.include-$(CHPL_MAKE_LLVM)
203-
include $(THIRD_PARTY_DIR)/fltk/Makefile.include
204203
include $(THIRD_PARTY_DIR)/libunwind/Makefile.include
205204
include $(THIRD_PARTY_DIR)/libfabric/Makefile.include
206205

third-party/Makefile

-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ clean: FORCE
2929
cd llvm && $(MAKE) clean
3030
cd qthread && $(MAKE) clean
3131
cd re2 && $(MAKE) clean
32-
cd fltk && $(MAKE) clean
3332

3433
cleanall: FORCE
3534
cd chpl-venv && $(MAKE) cleanall
@@ -42,7 +41,6 @@ cleanall: FORCE
4241
cd llvm && $(MAKE) cleanall
4342
cd qthread && $(MAKE) cleanall
4443
cd re2 && $(MAKE) cleanall
45-
cd fltk && $(MAKE) cleanall
4644

4745
clobber: FORCE
4846
cd chpl-venv && $(MAKE) clobber
@@ -55,7 +53,6 @@ clobber: FORCE
5553
cd llvm && $(MAKE) clobber
5654
cd qthread && $(MAKE) clobber
5755
cd re2 && $(MAKE) clobber
58-
cd fltk && $(MAKE) clobber
5956

6057
depend:
6158

third-party/fltk/.gitignore

-3
This file was deleted.

third-party/fltk/Makefile

-46
This file was deleted.

third-party/fltk/Makefile.include

-6
This file was deleted.

third-party/fltk/README

-17
This file was deleted.
-5.09 MB
Binary file not shown.

tools/chplvis/InfoBar.cxx

+6-5
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void InfoBar::addLocOrComm(LocCommBox *box)
194194
{
195195
// don't double add
196196
if (isOnList(box)) {
197-
boxCache.insert(boxCache.begin(), box);
197+
boxCache.push_front(box);
198198
return;
199199
}
200200

@@ -213,7 +213,7 @@ void InfoBar::addLocOrComm(LocCommBox *box)
213213
LocCommBox *dbox = *itr;
214214
remove(*itr);
215215
itr = infoBoxes.erase(itr);
216-
boxCache.insert(boxCache.begin(), dbox);
216+
boxCache.push_front(dbox);
217217
}
218218
}
219219

@@ -239,7 +239,7 @@ void InfoBar::delLocOrComm(LocCommBox *box)
239239
x += (*itr)->w();
240240
itr++;
241241
}
242-
boxCache.insert(boxCache.begin(), box);
242+
boxCache.push_front(box);
243243
MainWindow->redraw();
244244
}
245245

@@ -249,8 +249,9 @@ LocCommBox * InfoBar::getNewLocComm()
249249
return new LocCommBox(0, 0, LC_Box_W, LC_Box_H);
250250
} else {
251251
std::list<LocCommBox *>::iterator itr = boxCache.begin();
252+
LocCommBox *box = *itr;
252253
boxCache.erase(itr);
253-
return *itr;
254+
return box;
254255
}
255256
}
256257

@@ -263,7 +264,7 @@ void InfoBar::rmAllLocOrComm(void)
263264
box = *itr;
264265
itr = infoBoxes.erase(itr);
265266
remove(box);
266-
boxCache.insert(boxCache.begin(), box);
267+
boxCache.push_front(box);
267268
}
268269
}
269270

tools/chplvis/Makefile

+19-7
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,32 @@ ifndef CHPL_MAKE_HOME
2424
export CHPL_MAKE_HOME=$(shell pwd)/../..
2525
endif
2626

27-
CHPL_MAKE_HOST_TARGET = --target
27+
CHPL_MAKE_HOST_TARGET = --host
2828
include $(CHPL_MAKE_HOME)/make/Makefile.base
2929

3030
# FLTK config section
3131

32-
FLTK_CONFIG=$(FLTK_INSTALL_DIR)/bin/fltk-config
33-
FLTK_FLUID=$(FLTK_INSTALL_DIR)/bin/fluid
32+
FLTK_CONFIG=fltk-config
33+
FLTK_FLUID=fluid
3434

35-
CXXFLAGS= -Wall -I. -g
35+
FLTK_COMPILE=$(shell $(FLTK_CONFIG) --use-images --cxx --cxxflags)
36+
FLTK_LINK=$(shell $(FLTK_CONFIG) --use-images --cxx)
37+
FLTK_LIBS=$(shell $(FLTK_CONFIG) --use-images --ldflags --libs)
38+
39+
# If fltk is installed with Homebrew on ARM, need to look in /opt/homebrew
40+
ifeq ($(CHPL_MAKE_PLATFORM), darwin)
41+
ifeq ($(CHPL_MAKE_HOST_ARCH), arm64)
42+
FLTK_COMPILE += -I/opt/homebrew/include
43+
FLTK_LINK += -L/opt/homebrew/lib
44+
endif
45+
endif
46+
47+
CXXFLAGS += -Wall -I. -g
3648

3749
# Suffix rule for compiling .cxx files
3850
.SUFFIXES: .o .h .cxx
3951
.cxx.o:
40-
$$($(FLTK_CONFIG) --cxx) -c $$($(FLTK_CONFIG) --cxxflags) $(CXXFLAGS) $<
52+
$(FLTK_COMPILE) -c $(CXXFLAGS) $<
4153

4254

4355
SRCS= GraphView.cxx DataModel.cxx Event.cxx InfoBar.cxx LocCommWin.cxx \
@@ -57,8 +69,7 @@ OFILES= $(SRCS:.cxx=.o) $(GENSRCS:.cxx=.o)
5769
all: chplvis
5870

5971
chplvis: $(GENSRCS) $(OFILES)
60-
$$($(FLTK_CONFIG) --cxx) -o chplvis $(OFILES) \
61-
$$($(FLTK_CONFIG) --ldflags) $$($(FLTK_CONFIG) --libs)
72+
$(FLTK_LINK) -o chplvis $(OFILES) $(FLTK_LIBS)
6273

6374
chplvis.h: chplvis.fl
6475
$(FLTK_FLUID) -c chplvis.fl
@@ -78,6 +89,7 @@ clobber: clean
7889
rm -f chplvis
7990

8091
install: chplvis
92+
mkdir -p $(CHPL_BIN_DIR)
8193
cp chplvis $(CHPL_BIN_DIR)
8294

8395
# Dependencies

0 commit comments

Comments
 (0)