What I Learned from Smoking Clover

I was browsing through the “The New Hackers Dictionary” (http://www.eps.mcgill.ca/jargon/jargon.html), a version of the “Jargon File” (https://en.wikipedia.org/wiki/Jargon_File) when I discovered a entry for Smoking Clover, a display hack attributed to Bill Gosper. I located a copy on SourceForge and downloaded it, and unzipped it into a src directory. Looked routine.

Not.


me@here:~/Projects/Graphics/SmokingClover$ cd src
me@here:~/Projects/Graphics/SmokingClover/src$ make
-g -Wall `gtk-config` --cflags -c -o clover.o clover.c
/bin/sh: 1: gtk-config: not found
In file included from clover.c:1:0:
clover.h:47:21: fatal error: gtk/gtk.h: No such file or directory
compilation terminated.
: recipe for target 'clover.o' failed
make: *** [clover.o] Error 1
me@here:~/Projects/Graphics/SmokingClover/src$/

make did not. The Makefile that comes with the Smoking Clover packages does not make the clover package. Why not?

Well, I know that gtk is installed. What’s wrong with this picture.

What’s in the Makefile?

me@here:~/Projects/Graphics/SmokingClover/src$ cat Makefile
CFLAGS = -g -Wall `gtk-config` --cflags
LIBS = `gtk-config` --libs

SRCS = README COPYING ChangeLog BUGS Makefile *.[ch]

CLOVER_OBJS = clover.o common.o direct.o true.o rgb.o
clover: $(CLOVER_OBJS)
$(CC) $(CFLAGS) -o clover $(CLOVER_OBJS) $(LIBS)
$(CLOVER_OBJS): clover.h Makefile

tar:
tar -cf - $(SRCS) | gzip > clover.tar.gz
clean:
rm -f *.o clover
me@here:~/Projects/Graphics/SmokingClover/src$

Maybe no path to gtk-config …

me@here:~/Projects/Graphics/SmokingClover/src$ locate gtk-config
/usr/share/icons/breeze/apps/32/preferences-gtk-config.svg
/usr/share/icons/breeze-dark/apps/32/preferences-gtk-config.svg

Not promising.

A google or two and still no real answer…

Let’s try something… executing gtk-config.

me@here:~/Projects/Graphics/SmokingClover/src$ gtk-config --cflags
No command 'gtk-config' found, did you mean:
Command 'gts-config' from package 'libgts-bin' (universe)
gtk-config: command not found
me@here:~/Projects/Graphics/SmokingClover/src$

Another google and a hit on StackOverflow provided a hint:

Use pkg-config instead of gtk-config. While the article in Stack Overflow did not say so, gtk-config was for GTK 1.0. GTK 2.0 changed that.

me@here:~/Projects/Graphics/SmokingClover/src$ pkg-config
Must specify package names on the command line

Now we are getting someplace.

me@here:~/Projects/Graphics/SmokingClover/src$ pkg-config gtk-2.0 --cflags
Package gtk-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk-2.0' found

Or better, spell gtk+-2.0 correctly.

me@here:~/Projects/Graphics/SmokingClover/src$ pkg-config gtk+-2.0 --cflags
-pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2

That’s better. Change the Makefile to include the pkg-config lines

me@here:~/Projects/Graphics/SmokingClover/src$ head Makefile -n 3
CFLAGS = -g -Wall 'pkg-config gtk+-2.0 --cflags`
LIBS = `pkg-config gtk+-2.0 --libs`

me@here:~/Projects/Graphics/SmokingClover/src$ make
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -c -o clover.o clover.c
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -c -o common.o common.c
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -c -o direct.o direct.c
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -c -o true.o true.c
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -c -o rgb.o rgb.c
rgb.c: In function ‘rgb_init’:
rgb.c:28:31: warning: pointer targets in passing argument 1 of ‘gdk_rgb_cmap_new’ differ in signedness [-Wpointer-sign]
rgb_cmap = gdk_rgb_cmap_new (colors, 256);
^
In file included from /usr/include/gtk-2.0/gdk/gdkpixbuf.h:36:0,
from /usr/include/gtk-2.0/gdk/gdkcairo.h:28,
from /usr/include/gtk-2.0/gdk/gdk.h:33,
from /usr/include/gtk-2.0/gtk/gtk.h:32,
from clover.h:47,
from rgb.c:1:
/usr/include/gtk-2.0/gdk/gdkrgb.h:128:13: note: expected ‘guint32 * {aka unsigned int *}’ but argument is of type ‘gint32 * {aka int *}’
GdkRgbCmap *gdk_rgb_cmap_new (guint32 *colors,
^
rgb.c: In function ‘rgb_redraw’:
rgb.c:58:9: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
countp = counts;
^
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -o clover clover.o common.o direct.o true.o rgb.o `pkg-config gtk+-2.0 --libs`
/usr/bin/ld: direct.o: undefined reference to symbol 'floor@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:8: recipe for target 'clover' failed
make: *** [clover] Error 1
me@here:~/Projects/Graphics/SmokingClover/src$

Close but no cigar.

Looking at the first error found, something called “floor” is undefined at link time. floor … looks like a math function, maybe not to you but I’ve had an interesting life.
A google hit includes the function ceil. A math function. The article suggests you add libm.

You are in a room … you see a libm. take libm

me@here:~/Projects/Graphics/SmokingClover/src$ head -n 3 Makefile
CFLAGS = -g -Wall `pkg-config gtk+-2.0 --cflags`
LIBS = `pkg-config gtk+-2.0 --libs` -lm


me@here:~/Projects/Graphics/SmokingClover/src$ make
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -c -o clover.o clover.c
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -c -o common.o common.c
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -c -o direct.o direct.c
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -c -o true.o true.c
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -c -o rgb.o rgb.c
rgb.c: In function ‘rgb_init’:
rgb.c:28:31: warning: pointer targets in passing argument 1 of ‘gdk_rgb_cmap_new’ differ in signedness [-Wpointer-sign]
rgb_cmap = gdk_rgb_cmap_new (colors, 256);
^
In file included from /usr/include/gtk-2.0/gdk/gdkpixbuf.h:36:0,
from /usr/include/gtk-2.0/gdk/gdkcairo.h:28,
from /usr/include/gtk-2.0/gdk/gdk.h:33,
from /usr/include/gtk-2.0/gtk/gtk.h:32,
from clover.h:47,
from rgb.c:1:
/usr/include/gtk-2.0/gdk/gdkrgb.h:128:13: note: expected ‘guint32 * {aka unsigned int *}’ but argument is of type ‘gint32 * {aka int *}’
GdkRgbCmap *gdk_rgb_cmap_new (guint32 *colors,
^
rgb.c: In function ‘rgb_redraw’:
rgb.c:58:9: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
countp = counts;
^
cc -g -Wall `pkg-config gtk+-2.0 --cflags` -o clover clover.o common.o direct.o true.o rgb.o `pkg-config gtk+-2.0 --libs` -lm
me@here:~/Projects/Graphics/SmokingClover/src$

WHOA!

make is made!

Smoking Clover now. Or more correctly, the clover executable has been created.

transparent 4 leaf clover in transparent green and magenta
Here is how clover executes on my system

Try it, you’ll like it.

Discussion:

This program is clearly ancient history. What I have discovered since is that gtk-config was the tool used in gtk-1.0 and was replaced in gtk+2.0. No hint of this was in any of the information that I found using the information that I had at the time. Young-in’s, no sense of history.
I also went down a false path (that I cannot seem to reproduce) that required that I add the names of the include files to some of the c header .h files. In reproducing my quest, this did not seem to be necessary. Go figure.

The pointer sign-ed-ness warning may or not be important. It should be fixed. In my experience warnings are there for a reason and the results may be unpredictable. I found some hints as to how to fix it but have not yet gotten to it.

The tag line “No smoke, no odor, not a sound” is from a radio commercial in the late 1960’s from the East Ohio Gas Company touting gas fired domestic incinerators. Refer to the Summary item 5. The jingle was very catchy and memorable. Additional interesting, related stuff

Lamination Lamentations

Picture of tape fences and  epoxy-filled clamped gap.
Filling the gap
While working on a sailboat project, I laminated two pieces to make the rudder. I thought that I had enough clamps to hold it tightly together but after the epoxy had set up, I noticed that the edges had a gap. Spring clams just do not cut it.
To fill the gap, I set the edge up level and clamped the part to hold it . Then I made a small dam about 1/8″ high for each end out of folded masking tape. Finally, I put a masking tape fence along each side of the edge. I mixed up 1 pump (about 1 ounce) of epoxy and poured it in between the fences. It flowed into the gap a bubbles began to come up. To speed the process, I pinched the sides of the gap with pliers to squeeze the air out, releasing sucked the epoxy in. Repeat as desired.
When the gap was filled with epoxy, I put C-clamps (G-clamps in some parts of the world) on wherever I could see that it squeezed the gap closed. This caused the excess to squeeze out but the fences and the dams kept the excess from flowing down the sides. (The drip you see in the picture is from the other edge before I learned the part about the dams at the ends.) When the epoxy was set, removed the clamps and tape. Sand the excess hardened epoxy off. The gap is filled.

The Greatest

The POTUS, while he was campaigning, promised to “make America great again”. I submit that it was never not great.
The Mexican Foreign Minister said that “net immigration [from Mexico to the USA] is zero. This is probably true. Mexico has more jobs, less drug violence, and many other improvements over 20 years ago. And probably a few Mexican-born US residents reaching retirement age and heading for home. Those that are coming to the USA are coming because the USA is a great country. Frankly, 99 and 44/100 percent of the people that pay the “coyotes”, dodge the ICE-man, and run the risks of crossing the border without the proper credentials do not come to rape, rob, and pillage. They come because there are opportunities here. There is work that they can do. And they come to do the work.
Nobody “takes” jobs away. They are given up. You and I gave them up when we started buying “made in Japan” and later “made in CHINA”. We wanted a better price and the importers were able to sell at a better price than the local manufacturers. Why were they able to sell at a better price? The same things that make this country great: social security, minimum wage laws, union job protection. These things are expensive. Choose wisely when you purchase and when you vote.

Blind Trust

The folks that were disappointed with the results of last November’s election keep agitating for the President to put his companies in a blind trust. I submit that that this is 1) totally unnecessary and 2) that it is better that he does not.

For full disclosure, I do not think much of the current POTUS. My opinion is that he is a bully, a bigot, and a boor. But he is what he is and what he is is his BRAND.

Brand was once a big deal. Old-time brands like General Electric, Bell System, RCA, Ford, Buick, and many more stood for something. You heard or read the brand and you expected a certain quality, reliability, working-life, price-value, design characteristic that you could rely on and purchase dependably. Sometime in the 1970’s or 1980’s, the marketeers got hold of “brand” and began to abuse it. They applied it to products outside the traditional envelope of the companies. They applied it to imports and domesitically produced products of inferior quality. “Brand” became the thing instead of the qualities that the brand stood for and made the brand desirable. It seems that lately, Apple and Nordstrom are the only two brands I can name that that really stand for something consistent over the years. Brand has been devalued.

Meanwhile, back at the White House, a former TV actor is playing the part of a former real-estate businessman who has been elected President of the United States. Before he was elected, said businessman made most of his money not from real-estate transactions but from branding. Attaching his name to things, not real-estate wheeling-dealing. That is why you will never see his US Income Tax returns.

If (when?) he makes a mess of the USA brand, his name will be indelibly attached to the mess. If his name is trash, so is his fortune, blind trust or no blind trust.

He has made a number of good appointments and at least one bad one so far. If those ladies and gentlemen can keep him from running the ship onto the rocks, he (and we) will come out fine. If not we will all suffer.

Looking for a Presidential Candidate with a Heart

I have been following the campaign with interest and wondering where the candidates that have a heart are.
Bernie Sanders comes closest. He has a heart, as long as it is with someone else’s money.
If you are going to find Hillary Clinton’s heart, there will need to be an increase in funding for microscopy research.
And a Republican with a heart seems to be an oxymoron.

CHAIR-LOC info page

In my previous posts here and here I have referred to product called Chair-Loc. This is is labeled on my bottle as “rosin triethanolamide”. My bottle was made by The Chair-Loc Company of Lakehurst, NJ.

I have not been able to find Chair-Loc in local stores. I found that it might be available at Contantines Wood Center. Either a 2oz bottle alone ($4.25) or a 3oz bottle in a kit with syringe and tips to inject the joint ($11.95). Also at Western Wood Doctor with similar but different pricing.

Google search and Amazon provide a number of false leads and alternatives.

Wonderlokking Tite Chair glue is a cyanoacrylate glue which may work well at repairing chairs. The problem is that is really is a glue. If you have to disassemble the chair to repair the wood, covering, or as a result of refinishing, the glue will stick to the wood fibers and tear them apart. My theory is that if you want to repair furniture, you want to do it with glues that fill, swell, tighten, but do not stick. CA glue is sticky, particularly if you get it on your fingers.

Behlin Swel-Lock (scroll to page 16) may work, I have not tried it. The MSDS says that it is dipropylene glycol. I see information on the web that antifreeze (ethylene glycol and diethylene glycol) is a traditional fix for loose ax handles. I have not used it and cannot comment on how well it works or how long it lasts.

Briwax ChaiRX is a self-crosslinking vinyl acrylic polymer emulsion. While the MSDS states that the emulsion contains a large amount of water, if, on drying, the vinyl acrylic polymer remains in the wood fibers and joint, the joint should remain tight some time. This may be the best replacement available today for my favorite chair repair.

Briwax MTD, a wood sweller for mortice and tenon joints appears to be similar and may work as well.

When I get time, I will update the links to Chair-Loc in other posts to point to this info page.

Security

Terrorists are in the news as is their wont. This has prompted a dither over what to do.

We need to keep doing what we have been doing and do it better. Since 9/11, our freedom continues to be eroded. This is just what the terrorists want.

My recommendation is that we continue to allow the NSA to monitor phone connections. And allow the encryption of phone content. A backdoor for the government is a backdoor for everyone as the government has demonstrated its lack of ability in keeping secrets.

We should continue the debate as to whether the NSA should share the data it collects with the FBI and others. I lean to “no sharing” of data without a court order. The NSA should be free to share findings of specific threats with other agencies.

Running for President

I have been watching with interest the Presidential race. Biden has other things to worry about and Senator Sanders has decided that he is not going to be critical of Mrs. Clinton. Or maybe he is starting today. We will see.

Mr. Trump seems to be leading, after a fashion, the pack of Republicans. And that is a complete description of that party’s current state. Dr. Carson is popular but seems remote.

As for my own presidential campaign, some things I think are needed to fix the schools.
1. Leave colleges alone. There are plenty of sources of information in the market for people to make the choice of which college to attend, whether it provides good value, etc. We need to decrease the taxpayer participation in paying for college and encourage private funding through true scholarships. Work hard and show you can do the work, get tuition reduction, books, etc.
2. Improve language instruction. All high school graduates should be able to read, write, and converse in (at least) two languages. Any two.
3. All young people in the middle school time frame should get some training in basic hand tools, wood and metal working, electrical fundamentals, auto fundamentals, clothing construction, fabric selection, sewing, and especially cooking a healthy meal for breakfast, lunch, and dinner using a microwave, conventional oven, and stovetop.
4. Young people should get instruction in household operations including budgeting, maintenance, bill paying, and retirement planning.
5. The items in 4 should become part of the curriculum for the mathematics and language training. The items in 3 should be reinforced through the study of science, history and social studies coursework.

That would be the focus of my common core.

Missing Mr. Harry

Harry, a black cat, with pumpkin in background
Harry at Halloween 2015
Harry a young black cat
Harry in 2008

A little over a week ago, Harry began breathing hard. We took him in, the tech listened to his lungs. She did not think that he was suffering but that he should come back in the morning.
The doctor listened to him in the morning and said “I think that I will get a film”. The x-rays showed an enlarged heart and a little fluid. We brought him back in the evening and had held him while he was put to sleep.
Harry was my favorite.

Harry the cat on shelf on deck
Harry in 2009