Devilutionx: FreeBSD 12 - cmake fails, Could NOT find SDL2_ttf

Created on 4 Oct 2019  路  23Comments  路  Source: diasurgical/devilutionX

Running FreeBSD 12, installed necessary prereqs from source via ports, including SDL2_ttf.
During run of cmake it fails, because it can't find SDL2_ttf.

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
CMake Error at /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find SDL2_ttf (missing: SDL2_ttf_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  CMake/FindSDL2_ttf.cmake:141 (find_package_handle_standard_args)
  CMakeLists.txt:67 (find_package)

Just for the sake of it, I tried installing SDL2_ttf again, reboot the machine and run the cmake step with both gcc and clang. Same result.

Not sure whether this is a bug in the devilutionx build files or in Cmake on FreeBSD.
Help on how I can verify whether it's FreeBSD or devilutionx is greatly appreciated!

buid system help wanted

All 23 comments

What system are you running exactly? I'm on 12.0 amd64 and I can compile the current version (just checked out from git) just fine. Are you on 12.1-BETAx already? If so I can try that, too, if it helps.

Here's what I get when I run cmake from the build directory within the source dir:

% cmake -DASAN=OFF ..
-- The C compiler identification is Clang 6.0.1
-- The CXX compiler identification is Clang 6.0.1
-- Check for working C compiler: /usr/local/libexec/ccache/cc
-- Check for working C compiler: /usr/local/libexec/ccache/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/libexec/ccache/c++
-- Check for working CXX compiler: /usr/local/libexec/ccache/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found Sodium: /usr/local/lib/libsodium.so  
-- Found SDL2_ttf: /usr/local/lib/libSDL2_ttf.so  
-- Found SDL2: /usr/local/lib/libSDL2.so  
-- Found SDL2_mixer: /usr/local/lib/libSDL2_mixer.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kraileth/git/devilutionX/build

Here's all the SDL packages that are installed on my machine:

% pkg info -x sdl
sdl-1.2.15_14,2
sdl2-2.0.9_3
sdl2_mixer-2.0.4_1
sdl2_ttf-2.0.15
sdl_mixer-1.2.12_12
sdl_net-1.2.8_3
sdl_sound-1.0.3_14

And here the contents of the package that gives you problems:

% pkg info -l sdl2_ttf
sdl2_ttf-2.0.15:
        /usr/local/bin/sdl2-showfont
        /usr/local/include/SDL2/SDL_ttf.h
        /usr/local/lib/libSDL2_ttf-2.0.so.0
        /usr/local/lib/libSDL2_ttf-2.0.so.0.14.1
        /usr/local/lib/libSDL2_ttf.a
        /usr/local/lib/libSDL2_ttf.so
        /usr/local/libdata/pkgconfig/SDL2_ttf.pc
        /usr/local/share/licenses/sdl2_ttf-2.0.15/LICENSE
        /usr/local/share/licenses/sdl2_ttf-2.0.15/ZLIB
        /usr/local/share/licenses/sdl2_ttf-2.0.15/catalog.mk

What about your system?

Thanks for your input!

I'm running arm64 on a raspberry pi. I see now, that the instructions says that devilutionx doesn't run on 64bit bsd, but I still think cmake should detect the package, no?

I rebuilt world from svn. I think that it is freebsd-current(?)

root@freebsd:~ # svnlite info /usr/src/
Path: /usr/src
Working Copy Root Path: /usr/src
URL: https://svn.freebsd.org/base/head
Relative URL: ^/head
Repository Root: https://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 352431
Node Kind: directory
Schedule: normal
Last Changed Author: jmg
Last Changed Rev: 352431
Last Changed Date: 2019-09-16 22:48:40 +0000 (Mon, 16 Sep 2019)

Here are my packages. sdl2_ttf is there.

pkg info -x sdl
sdl-1.2.15_14,2
sdl2-2.0.10
sdl2_ttf-2.0.15
sdl_mixer-1.2.12_12

My contents of sdl2_ttf

pkg info -l sdl2_ttf
sdl2_ttf-2.0.15:
        /usr/local/bin/sdl2-showfont
        /usr/local/include/SDL2/SDL_ttf.h
        /usr/local/lib/libSDL2_ttf-2.0.so.0
        /usr/local/lib/libSDL2_ttf-2.0.so.0.14.1
        /usr/local/lib/libSDL2_ttf.a
        /usr/local/lib/libSDL2_ttf.so
        /usr/local/libdata/pkgconfig/SDL2_ttf.pc
        /usr/local/share/licenses/sdl2_ttf-2.0.15/LICENSE
        /usr/local/share/licenses/sdl2_ttf-2.0.15/ZLIB
        /usr/local/share/licenses/sdl2_ttf-2.0.15/catalog.mk

the 64bit bsd issue might have been solved recently, but i need to verify it

Here is how CMake tries to find SDL2_ttf_INCLUDE_DIR:

https://github.com/diasurgical/devilutionX/blob/fb242127615e1d5926d26817d11bc15ce182df6c/CMake/FindSDL2_ttf.cmake#L105-L113

Interestingly, it's looking for the wrong header (sdl_mixer.h instead of sdl_ttf.h) and you don't have sdl2_mixer installed!

Interestingly, it's looking for the wrong header (sdl_mixer.h instead of sdl_ttf.h) and you don't have sdl2_mixer installed!

Good catch! I seem to have installed "sdl_mixer" instead of "sdl2_mixer" accidentally.
I'll build sdl2_mixer and update here afterwards.

Yes, now cmake runs successfully.
I tried to build it using clang and it seems to build successfully, but I don't have a video driver to run it apparently, so I can't test it.

The path /dev/dri cannot be opened or is not available
INFO: No availabla video device

Thanks for all your help.

Don't worry I have an ASCII render in the works :D

@snigel Try with -DUSE_SDL1=ON instead, it only needs the framebuffer.

@glebm thanks.
I installed sdl12, sdl_mixer sdl_ttf and tried.

Using clang failed for sdl1:
cmake .. -DUSE_SDL1=ON
make

[  1%] Building CXX object CMakeFiles/devilution.dir/Source/appfat.cpp.o
In file included from /home/freebsd/devilutionX/Source/appfat.cpp:1:
In file included from /home/freebsd/devilutionX/Source/diablo.h:7:
/home/freebsd/devilutionX/SourceS/sdl2_to_1_2_backports.h:727:16: error: use of undeclared identifier 'PATH_MAX'
        char fullpath[PATH_MAX];
                      ^
/home/freebsd/devilutionX/SourceS/sdl2_to_1_2_backports.h:729:22: error: use of undeclared identifier 'CTL_KERN'
        const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
                            ^
/home/freebsd/devilutionX/SourceS/sdl2_to_1_2_backports.h:729:32: error: use of undeclared identifier 'KERN_PROC'
        const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
                                      ^
/home/freebsd/devilutionX/SourceS/sdl2_to_1_2_backports.h:729:43: error: use of undeclared identifier 'KERN_PROC_PATHNAME'
        const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
                                                 ^
/home/freebsd/devilutionX/SourceS/sdl2_to_1_2_backports.h:730:18: error: invalid application of 'sizeof' to an incomplete type 'const int []'
        if (sysctl(mib, SDL_arraysize(mib), fullpath, &buflen, NULL, 0) != -1) {
                        ^~~~~~~~~~~~~~~~~~
/usr/local/include/SDL/SDL_stdinc.h:78:37: note: expanded from macro 'SDL_arraysize'
#define SDL_arraysize(array)    (sizeof(array)/sizeof(array[0]))
                                       ^~~~~~~
5 errors generated.
*** Error code 1

Using gcc9 it built successfully.
cmake .. -DUSE_SDL1=ON -DCMAKE_C_COMPILER=/usr/local/bin/gcc9 -DCMAKE_CXX_COMPILER=/usr/local/bin/g++9

But launching it gives segmentation fault. What can I do from here?

For a segfault, you should've got a stack trace (-DASAN=ON is enabled by default).

My experience was the same on FreeBSD, it just segfaults hard with no info.

Should still be possible to get a stack trace with gdb:

gdb -ex=r devilutionx

Just built the latest DevilutionX source on a Cavium ThunderX ARM64 server with FreeBSD 12.1-BETA3. It built without problems (using Clang 8.0.1). Unfortunately I cannot try it out on my PineBook right now (preparing to move houses and having no idea where I put the power adapter). Should I run across it, I'll make sure to test.

image
Latest master, FreeBSD 12.0:

cd build
cmake ..
make -j4

@AJenbo: I recognize good ol' Charlie Root, so I guess this is a screenshot from FreeBSD. But is it arm64? If so: Which device? Just curious.

Qemu amd64, Clang 6.0.1

Ah, ok. Then it's probably 12.0 - and thus identical to the system that I just use. I haven't played it a lot, yet, but it seems to work pretty well.

It didn't segfault with the SDL2 version. Or perhaps it just failed for graphics before the segfault

Here is my output from running with gdb:

freebsd@freebsd:~/devilutionX/build % gdb -ex=r devilutionx
GNU gdb (GDB) 8.3 [GDB v8.3 for FreeBSD]
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-portbld-freebsd13.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from devilutionx...
Starting program: /home/freebsd/devilutionX/build/devilutionx 
warning: File "/usr/local/lib/gcc9/libstdc++.so.6.0.27-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
    add-auto-load-safe-path /usr/local/lib/gcc9/libstdc++.so.6.0.27-gdb.py
line to your configuration file "/home/freebsd/.gdbinit".
To completely disable this security protection add
    set auto-load safe-path /
line to your configuration file "/home/freebsd/.gdbinit".
--Type <RET> for more, q to quit, c to continue without paging--
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
    info "(gdb)Auto-loading safe path"

Program received signal SIGILL, Illegal instruction.
_armv8_pmull_probe () at /usr/src/secure/lib/libcrypto/aarch64/arm64cpuid.S:51
51      pmull   v0.1q, v0.1d, v0.1d

I pressed return after the warning above, perhaps I should have done something else?
I'm not experienced with gdb, sadly.

That's SIGILL, illegal instruction

Ah, apparently that SIGILL may be normal -- https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225779#c1.

Enter c to continue until the first real error, then enter bt to see the backtrace.

I continued until SIGSEGV, then ran bt. This my output.

freebsd@freebsd:~/devilutionX/build % gdb -ex=r devilutionx
GNU gdb (GDB) 8.3 [GDB v8.3 for FreeBSD]
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-portbld-freebsd13.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from devilutionx...
Starting program: /home/freebsd/devilutionX/build/devilutionx
warning: File "/usr/local/lib/gcc9/libstdc++.so.6.0.27-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
        add-auto-load-safe-path /usr/local/lib/gcc9/libstdc++.so.6.0.27-gdb.py
line to your configuration file "/home/freebsd/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/freebsd/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"

Program received signal SIGILL, Illegal instruction.
_armv8_pmull_probe () at /usr/src/secure/lib/libcrypto/aarch64/arm64cpuid.S:51
51              pmull   v0.1q, v0.1d, v0.1d
(gdb) c
Continuing.

Program received signal SIGILL, Illegal instruction.
_armv8_aes_probe () at /usr/src/secure/lib/libcrypto/aarch64/arm64cpuid.S:30
30              aese    v0.16b, v0.16b
(gdb) c
Continuing.

Program received signal SIGILL, Illegal instruction.
_armv8_sha1_probe () at /usr/src/secure/lib/libcrypto/aarch64/arm64cpuid.S:37
37              sha1h   s0, s0
(gdb) c
Continuing.

Program received signal SIGILL, Illegal instruction.
_armv8_sha256_probe () at /usr/src/secure/lib/libcrypto/aarch64/arm64cpuid.S:44
44              sha256su0       v0.4s, v0.4s
(gdb) c
Continuing.

Program received signal SIGILL, Illegal instruction.
0x0000000041c10750 in _armv8_sha512_probe () at /usr/src/secure/lib/libcrypto/aarch64/arm64cpuid.S:52
52              ret
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x000000004162ea00 in vtable for __cxxabiv1::__si_class_type_info () from /lib/libcxxrt.so.1
(gdb) bt
#0  0x000000004162ea00 in vtable for __cxxabiv1::__si_class_type_info () from /lib/libcxxrt.so.1
#1  0x000000004099bddc in __dynamic_cast () from /usr/local/lib/gcc9/libstdc++.so.6
#2  0x0000000040a20ddc in bool std::has_facet<std::ctype<char> >(std::locale const&) () from /usr/local/lib/gcc9/libstdc++.so.6
#3  0x0000000040a1263c in std::basic_ios<char, std::char_traits<char> >::_M_cache_locale(std::locale const&) () from /usr/local/lib/gcc9/libstdc++.so.6
#4  0x0000000040a12ad4 in std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*) () from /usr/local/lib/gcc9/libstdc++.so.6
#5  0x0000000040a0e4a0 in std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode) () from /usr/local/lib/gcc9/libstdc++.so.6
#6  0x00000000005a03f0 in radon::File::File (this=0x663fb0 <dvl::ini>, path=..., reading=true) at /home/freebsd/devilutionX/3rdParty/Radon/Radon/source/File.cpp:18
#7  0x0000000000415f84 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /home/freebsd/devilutionX/SourceX/storm/storm.cpp:31
#8  0x0000000000415fe0 in _GLOBAL__sub_I_nLastError () at /home/freebsd/devilutionX/SourceX/storm/storm.cpp:843
#9  0x000000004065a708 in objlist_call_init (list=<optimized out>, lockstate=<optimized out>) at /usr/src/libexec/rtld-elf/rtld.c:2740
#10 0x00000000406592ec in _rtld (sp=<optimized out>, exit_proc=<optimized out>, objp=<optimized out>) at /usr/src/libexec/rtld-elf/rtld.c:771
#11 0x0000000040657018 in rtld_start () at /usr/src/libexec/rtld-elf/aarch64/rtld_start.S:41
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Looked at the calls in the devilutionx source.
storm.cpp:843 - this is the last line in the file.
storm.cpp:31 - static radon::File ini(getIniPath());
File.cpp:18 std::ifstream stream(path);

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AJenbo picture AJenbo  路  19Comments

baszczewski picture baszczewski  路  15Comments

cain05 picture cain05  路  18Comments

predator8bit picture predator8bit  路  22Comments

mgpat-gm picture mgpat-gm  路  21Comments