🔗 “.la file not recognized: File format not recognized”
If you’re writing a program using Autotools (Autoconf, Automake, Libtool and friends) and start getting this error message after adding a new library dependency, this means the library in question exports its link flags using Libtool, but your program’s build is not libtoolized yet.
You need to add a call to “libtoolize” to your project. I usually use a script called autogen.sh which calls the various autotools. This is what a typical autogen.sh of mine looks like:
#!/bin/sh -e echo "libtoolize..." libtoolize --copy --ltdl --force echo "aclocal..." aclocal -I aclocal echo "autoconf..." autoconf echo "autoheader..." autoheader echo "automake..." automake --add-missing --copy echo echo "Now run: ./configure --prefix=" echo
Note the call to "libtoolize".
Then, in your configure.ac, add this:
AC_CONFIG_MACRO_DIR([libltdl/m4]) LT_CONFIG_LTDL_DIR([libltdl]) LT_INIT([dlopen]) LTDL_INIT([recursive])
I got this snippet from this bit of the Libtool manual. I usually add it near the top, after AC_PROG_CC and before AC_HEADER_STDC. In the end, add libltdl/Makefile to the AC_CONFIG_FILES rule. Assuming you already have Makefile and src/Makefile, it would look like this:
AC_CONFIG_FILES([Makefile src/Makefile libltdl/Makefile])
Then in your root Makefile.am, add this:
SUBDIRS = libltdl # plus any subdirs you may already have ACLOCAL_AMFLAGS = -I libltdl/m4
and for your executable's rules (suppose it is called foo
), add:
AM_CPPFLAGS = $(LTDLINCL) foo_LDADD = $(LIBLTDL) # plus anything else you may already have
And that's it: that's what you need so that .la files can link properly when building your executable. I don't know if that's the optimal way, but it works for me.
🔗 Roland vs. Korg lead sounds
I found two videos of roughly the same lead sound (the “wailing guitar” sound inspired by the Roland JD800) being played in two different keyboards, a Roland Fantom-S and a Korg Trinity. (No, it’s not me playing!)
Regardless of the playing stiyle, notice how the Roland sounds “Kevin Moore”/”Awake” and the Korg sounds “Derek Sherinian”/”Falling Into Infinity”:
Roland:
Korg:
🔗 Philosophy, the root of knowledge (in Wikipedia, at least!)
Just read this on XKCD 903:
“Wikipedia trivia: if you take any article, click on the first link in the article text not in parentheses or italics, and then repeat, you will eventually end up at “Philosophy”.
Tried it with a random article, the first one that came up in my Firefox autocompletion:
Brian Stowell → Isle of Man → Crown Dependencies → The Crown → Corporation sole → Legal personality → Entity (almost there! “philosophy” was the second link) → Existence → Sense → Physiology → Science → Knowledge → Fact → Information → Sequence → Mathematics → Quantity
Property (philosophy) → Modern philosophy → Philosophy
Beyond that it’s a loop Philosophy → Reason → Rationality → Philosophy.
Then I tried to pick something as far from philosophy as I could quickly think of:
Neymar → Association football → Team sport → Sport → Organization → Social group → Social sciences → List of academic disciplines → Academia → Community → Extant taxon → Biology → Natural science → Science → … → Philosophy
Turns out Wikipedians have already studied this phenomenon. Apparently, 94.5% of all English Wikipedia articles lead to “Philosophy”. Cool, huh? There is even a fun web app so you can play around with this.
🔗 Free music: Color Bleed is finally online
I recorded an album with a group of extremely talented friends who I had collaborated with in previous projects. I wrote music and lyrics for all the songs; Roberto Coutinho from Ampli Studio was in charge of the mixing board (and also played in a number of tracks).
We are all very happy with the results, so check it out:
You can listen online and also download the mp3 files for free. It’s licensed CC BY-NC-SA 3.0.
All feedback is welcome and much appreciated!
🔗 Lua’s and-or as a ternary operator
Lua is a nice programming language, which allows for readable and concise code. One of my favorite idioms in the language is this:
x = a and b or c
which usually works like the C ternary operator, “a ? b : c”, but in a more readable fashion. This works in Lua because the “and” and “or” operators return their matching value when they get a “true” value (anything other than false and nil).
One thing to keep in mind though, is that this is really “and and b or c” and not “a then b else c”. There’s one big difference: when you want to have nil or false in your “then” value.
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio > = true and 10 or 20 10 > = false and 10 or 20 20 > = true and nil or 20 20
An ugly alternative is to do “not a and c or b”, like this:
> = not true and 20 or 10 10 > = not false and 20 or 10 20 > = not true and 20 or nil nil
But at this point it’s better just to use an “if” statement. (This hack works around the then-as-nil case, but not else-as-nil, of course.)
So, keep in mind that you should use the “a and b or c” construct as if-then-else only if you know that your “b” value is not nil or false.
It’s better, however, to use this construct for what it is. This behavior is not flawed, it is just different, and it has its own uses. For example, it is very useful to check if a table exists:
x = tbl and tbl.key
And to define fallback values:
x = tbl and tbl.key or "missing!"
Note that the above line reads naturally, and you wouldn’t be able to do that with one “?:” operator in C.
Follow
🐘 Mastodon ▪ RSS (English), RSS (português), RSS (todos / all)
Last 10 entries
- Aniversário do Hisham 2025
- The aesthetics of color palettes
- Western civilization
- Why I no longer say "conservative" when I mean "cautious"
- Sorting "git branch" with most recent branches last
- Frustrating Software
- What every programmer should know about what every programmer should know
- A degradação da web em tempos de IA não é acidental
- There are two very different things called "package managers"
- Last day at Kong