Skip to content

Commit

Permalink
Remove bundled fltk, have chplvis require a separately installed one (c…
Browse files Browse the repository at this point in the history
…hapel-lang#26382)

Resolves chapel-lang#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
  • Loading branch information
mppf authored Dec 11, 2024
2 parents 4d94654 + dec27cb commit b8514f8
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 98 deletions.
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ always-build-cls: FORCE
$(MAKE) chpl-language-server; \
fi

chplvis: compiler third-party-fltk FORCE
cd tools/chplvis && $(MAKE)
cd tools/chplvis && $(MAKE) install
chplvis: FORCE
cd tools/chplvis && $(MAKE) && $(MAKE) install

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

third-party-fltk: FORCE
cd third-party/fltk && $(MAKE)

clean: FORCE
cd compiler && $(MAKE) clean
cd modules && $(MAKE) clean
Expand Down
10 changes: 6 additions & 4 deletions doc/rst/tools/chplvis/chplvis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ will help you understand the :mod:`VisualDebug` module and the
Setup
-----

``chplvis`` is built by giving the command ``make chplvis`` at the top level of
the chapel tree. This also builds the GUI tool, *FLTK*, required to build and
run ``chplvis``. (Note: Some versions of Linux may require the standard
package ``libx11-dev`` to be installed before *FLTK* will compile properly.)
``chplvis`` is built by giving the command ``make chplvis`` at the top
level of the chapel tree. ``make chplvis`` will assume that FLTK is
already installed and the ``fltk-config`` and ``fluid`` commands are
available. (If necessary, you can adjust them with
``make chplvis FLTK_CONFIG=<something> FLTK_FLUID=<something-else>``).

To get the most out of this primer, you should compile and run the example
programs and examine the :mod:`VisualDebug` results with ``chplvis``. The
example programs are found on the path ``examples/primers/chplvis``. The
Expand Down
1 change: 0 additions & 1 deletion make/Makefile.base
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ include $(THIRD_PARTY_DIR)/gmp/Makefile.include
include $(THIRD_PARTY_DIR)/hwloc/Makefile.include
include $(THIRD_PARTY_DIR)/re2/Makefile.include
include $(THIRD_PARTY_DIR)/llvm/Makefile.include-$(CHPL_MAKE_LLVM)
include $(THIRD_PARTY_DIR)/fltk/Makefile.include
include $(THIRD_PARTY_DIR)/libunwind/Makefile.include
include $(THIRD_PARTY_DIR)/libfabric/Makefile.include

Expand Down
3 changes: 0 additions & 3 deletions third-party/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ clean: FORCE
cd llvm && $(MAKE) clean
cd qthread && $(MAKE) clean
cd re2 && $(MAKE) clean
cd fltk && $(MAKE) clean

cleanall: FORCE
cd chpl-venv && $(MAKE) cleanall
Expand All @@ -42,7 +41,6 @@ cleanall: FORCE
cd llvm && $(MAKE) cleanall
cd qthread && $(MAKE) cleanall
cd re2 && $(MAKE) cleanall
cd fltk && $(MAKE) cleanall

clobber: FORCE
cd chpl-venv && $(MAKE) clobber
Expand All @@ -55,7 +53,6 @@ clobber: FORCE
cd llvm && $(MAKE) clobber
cd qthread && $(MAKE) clobber
cd re2 && $(MAKE) clobber
cd fltk && $(MAKE) clobber

depend:

Expand Down
3 changes: 0 additions & 3 deletions third-party/fltk/.gitignore

This file was deleted.

46 changes: 0 additions & 46 deletions third-party/fltk/Makefile

This file was deleted.

6 changes: 0 additions & 6 deletions third-party/fltk/Makefile.include

This file was deleted.

17 changes: 0 additions & 17 deletions third-party/fltk/README

This file was deleted.

Binary file removed third-party/fltk/fltk-1.3.8-source.tar.gz
Binary file not shown.
11 changes: 6 additions & 5 deletions tools/chplvis/InfoBar.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void InfoBar::addLocOrComm(LocCommBox *box)
{
// don't double add
if (isOnList(box)) {
boxCache.insert(boxCache.begin(), box);
boxCache.push_front(box);
return;
}

Expand All @@ -213,7 +213,7 @@ void InfoBar::addLocOrComm(LocCommBox *box)
LocCommBox *dbox = *itr;
remove(*itr);
itr = infoBoxes.erase(itr);
boxCache.insert(boxCache.begin(), dbox);
boxCache.push_front(dbox);
}
}

Expand All @@ -239,7 +239,7 @@ void InfoBar::delLocOrComm(LocCommBox *box)
x += (*itr)->w();
itr++;
}
boxCache.insert(boxCache.begin(), box);
boxCache.push_front(box);
MainWindow->redraw();
}

Expand All @@ -249,8 +249,9 @@ LocCommBox * InfoBar::getNewLocComm()
return new LocCommBox(0, 0, LC_Box_W, LC_Box_H);
} else {
std::list<LocCommBox *>::iterator itr = boxCache.begin();
LocCommBox *box = *itr;
boxCache.erase(itr);
return *itr;
return box;
}
}

Expand All @@ -263,7 +264,7 @@ void InfoBar::rmAllLocOrComm(void)
box = *itr;
itr = infoBoxes.erase(itr);
remove(box);
boxCache.insert(boxCache.begin(), box);
boxCache.push_front(box);
}
}

Expand Down
26 changes: 19 additions & 7 deletions tools/chplvis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,32 @@ ifndef CHPL_MAKE_HOME
export CHPL_MAKE_HOME=$(shell pwd)/../..
endif

CHPL_MAKE_HOST_TARGET = --target
CHPL_MAKE_HOST_TARGET = --host
include $(CHPL_MAKE_HOME)/make/Makefile.base

# FLTK config section

FLTK_CONFIG=$(FLTK_INSTALL_DIR)/bin/fltk-config
FLTK_FLUID=$(FLTK_INSTALL_DIR)/bin/fluid
FLTK_CONFIG=fltk-config
FLTK_FLUID=fluid

CXXFLAGS= -Wall -I. -g
FLTK_COMPILE=$(shell $(FLTK_CONFIG) --use-images --cxx --cxxflags)
FLTK_LINK=$(shell $(FLTK_CONFIG) --use-images --cxx)
FLTK_LIBS=$(shell $(FLTK_CONFIG) --use-images --ldflags --libs)

# If fltk is installed with Homebrew on ARM, need to look in /opt/homebrew
ifeq ($(CHPL_MAKE_PLATFORM), darwin)
ifeq ($(CHPL_MAKE_HOST_ARCH), arm64)
FLTK_COMPILE += -I/opt/homebrew/include
FLTK_LINK += -L/opt/homebrew/lib
endif
endif

CXXFLAGS += -Wall -I. -g

# Suffix rule for compiling .cxx files
.SUFFIXES: .o .h .cxx
.cxx.o:
$$($(FLTK_CONFIG) --cxx) -c $$($(FLTK_CONFIG) --cxxflags) $(CXXFLAGS) $<
$(FLTK_COMPILE) -c $(CXXFLAGS) $<


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

chplvis: $(GENSRCS) $(OFILES)
$$($(FLTK_CONFIG) --cxx) -o chplvis $(OFILES) \
$$($(FLTK_CONFIG) --ldflags) $$($(FLTK_CONFIG) --libs)
$(FLTK_LINK) -o chplvis $(OFILES) $(FLTK_LIBS)

chplvis.h: chplvis.fl
$(FLTK_FLUID) -c chplvis.fl
Expand All @@ -78,6 +89,7 @@ clobber: clean
rm -f chplvis

install: chplvis
mkdir -p $(CHPL_BIN_DIR)
cp chplvis $(CHPL_BIN_DIR)

# Dependencies
Expand Down

0 comments on commit b8514f8

Please sign in to comment.