I try to compile JDK source code on Ubuntu 20.04. However, the configure script of JDK failed with some errors:
// conftest.cpp
#include <ft2build.h>
#include FT_FREETYPE_H
int main()
{
FT_Library library;
FT_Error error = FT_Init_FreeType(&library);
if (error) {
printf("Error occurred during init.\n");
}
else {
printf("Initialised OK!\n");
}
return 0;
}
In Terminal, this can link OK:
$ g++ -o conftest -I/usr/include/freetype2 -L/usr/lib/x86_64-linux-gnu conftest.cpp -lfreetype
but this not work:
$ g++ -o conftest -I/usr/include/freetype2 -L/usr/lib/x86_64-linux-gnu -lfreetype conftest.cpp
/usr/bin/ld: /tmp/ccpFC5Ih.o: in function `main':
conftest.cpp:(.text+0x23): undefined reference to `FT_Init_FreeType'
collect2: error: ld returned 1 exit status
Only difference is the order of the parameters and, from this freetype question1, it seems that it's a upgrade problem. I am pretty sure that already the current latest 20.04,
$ g++ --version
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0)