Closed unix-supremacist closed 11 months ago
i'm pretty sure you need the sdl2 development package to ensure the headers are available at build time (on debian that's libsdl2-dev
), i'm not sure what the openbsd equivalent of that would be
sorry for the late response, there doesnt seem to be a separate package for my system, and in /usr/local/include/SDL2/
there seems to be all the appropiate headers for SDL2
unix E[0] /home/unix/ ➜ /usr/local/include/SDL2/
SDL.h SDL_haptic.h SDL_opengl.h SDL_scancode.h SDL_test_log.h
SDL_assert.h SDL_hidapi.h SDL_opengl_glext.h SDL_sensor.h SDL_test_md5.h
SDL_atomic.h SDL_hints.h SDL_opengles.h SDL_shape.h SDL_test_memory.h
SDL_audio.h SDL_joystick.h SDL_opengles2.h SDL_stdinc.h SDL_test_random.h
SDL_bits.h SDL_keyboard.h SDL_opengles2_gl2.h SDL_surface.h SDL_thread.h
SDL_blendmode.h SDL_keycode.h SDL_opengles2_gl2ext.h SDL_system.h SDL_timer.h
SDL_clipboard.h SDL_loadso.h SDL_opengles2_gl2platform.h SDL_syswm.h SDL_touch.h
SDL_config.h SDL_locale.h SDL_opengles2_khrplatform.h SDL_test.h SDL_types.h
SDL_cpuinfo.h SDL_log.h SDL_pixels.h SDL_test_assert.h SDL_version.h
SDL_egl.h SDL_main.h SDL_platform.h SDL_test_common.h SDL_video.h
SDL_endian.h SDL_messagebox.h SDL_power.h SDL_test_compare.h SDL_vulkan.h
SDL_error.h SDL_metal.h SDL_quit.h SDL_test_crc32.h begin_code.h
SDL_events.h SDL_misc.h SDL_rect.h SDL_test_font.h close_code.h
SDL_filesystem.h SDL_mouse.h SDL_render.h SDL_test_fuzzer.h
SDL_gamecontroller.h SDL_mutex.h SDL_revision.h SDL_test_harness.h
SDL_gesture.h SDL_name.h SDL_rwops.h SDL_test_images.h
maybe im missing something but this seems right?
also the proper .a/.so files
unix E[130] /home/unix/ ➜ ls /usr/local/lib/ | grep SDL2
libSDL2.a
libSDL2.la
libSDL2.so.0.11
libSDL2_test.a
libSDL2_test.la
libSDL2main.a
libSDL2main.la
I was in the middle of typing a response when you posted your last comment, where I was going to suggest you check those directories and yep, seems like everything is there. I'm noticing they are in /usr/local/
, is that normal for BSD, and does cmake check that directory by default for finding the -config.cmake
files? I imagine it would, just a key difference I noticed.
It's not likely the cause of this particular issue, but you seem to have version 2.0.20 installed while our BUILDING.md indicates you need at least 2.0.22. It will probably be just fine, but if you do have any weird bugs that nobody can replicate later that could be the cause.
as far as the update, i just checked and theres a new sdl2 version in ports, but the package repo doesn't seem updated, i'll look at building and installing that if i need to.
and yes /usr/local/
is normal on bsd for a lot of things, linux is different i forgot why, it may symlink those directories elsewhere don't remember
i don't honestly know if cmake checks those directories for files, but i assume since other projects work, and the openbsd package installs the cmake files to that directory, so i assume it would
Ok, I have one thing I'd like you to try, I'm not quite sure if it will make any difference. In soh/CMakeLists.txt
on line 2063, change that line to read find_package(SDL2 CONFIG)
. CMake is supposed to fall back to config mode if module mode doesn't work, but this way we can at least be certain it's looking for the Find<package>.cmake
file.
You could also try adding the flag -DCMAKE_PREFIX_PATH=/usr/local/lib
to ensure it's looking in /usr/local
correctly, or -DCMAKE_MODULE_PATH=/usr/local/lib/cmake/SDL2
, but the method in my previous comment would be preferred, as we can easily incorporate that into our CMakeLists.
Oh and I should clarify, changing just that one line I mentioned may not make it configure successfully, but it should get rid of one of those two errors if that's what the issue was.
doing all three gives the exact sane results unfortunately,
unix E[1] /home/unix/Source/Shipwright/ ➜ cmake -H. -Bbuild-cmake -GNinja -DCMAKE_MODULE_PATH=/usr/local/lib/cmake/SDL2
-- OpenBSD
-- Linking against dependent libraries statically
-- Using the multi-header code from /home/unix/Source/Shipwright/libultraship/extern/nlohmann-json/include/
-- Testing if -Werror=pointer-arith can be used -- compiles
-- Testing if -Werror=implicit-function-declaration can be used -- compiles
-- Testing if -fno-strict-aliasing can be used -- compiles
-- Using raylib's GLFW
-- Using X11 for window creation
-- Audio Backend: miniaudio
-- Building raylib static library
-- Generated build type: Debug
-- Compiling with the flags:
-- PLATFORM=PLATFORM_DESKTOP
-- GRAPHICS=GRAPHICS_API_OPENGL_33
-- Configuring done
CMake Error at libultraship/extern/CMakeLists.txt:73 (target_link_libraries):
Target "ImGui" links to:
SDL2::SDL2
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
CMake Error at soh/CMakeLists.txt:2100 (target_link_libraries):
Target "soh" links to:
SDL2::SDL2
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
didn't mean to close it oops, it for some reason enter closed it, anyway i meant to say as an example that is the results of one but i tried all three
oh and from what i understand isn't the SDL2::SDL2 call looking for specifically the SDL2 shared object? i noticed libSDL2.so.0.11
was sort of a weird name and i was wondering if that could be the issue?
No, it should be linking the library statically and thus should be looking for libSDL2.a I believe. And regardless I've got similarly weird names on Linux, although now that you bring it up I do see symlinks for names without those numbers on Linux. Hmmm, perhaps for BSD we need to be linking SDL2::SDL2-static
? If you could try that, line 2069 of soh/CMakeLists.txt
is the one to find. As before, that alone won't fix the build but it should remove one of the errors in your logs and give us a clue how to proceed.
Thanks for your patience in testing thus far, I don't think anyone on the dev team has a BSD system ready to go, so you being willing to try my suggestions is a huge help.
SDL2-static gives this
unix E[0] /home/unix/Source/Shipwright/ ➜ cmake -H. -Bbuild-cmake -GNinja
-- OpenBSD
-- Linking against dependent libraries statically
-- Using the multi-header code from /home/unix/Source/Shipwright/libultraship/extern/nlohmann-json/include/
CMake Warning at soh/CMakeLists.txt:2063 (find_package):
By not providing "FindSDL2-static.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"SDL2-static", but CMake did not find one.
Could not find a package configuration file provided by "SDL2-static" with
any of the following names:
SDL2-staticConfig.cmake
sdl2-static-config.cmake
Add the installation prefix of "SDL2-static" to CMAKE_PREFIX_PATH or set
"SDL2-static_DIR" to a directory containing one of the above files. If
"SDL2-static" provides a separate development package or SDK, be sure it
has been installed.
-- Testing if -Werror=pointer-arith can be used -- compiles
-- Testing if -Werror=implicit-function-declaration can be used -- compiles
-- Testing if -fno-strict-aliasing can be used -- compiles
-- Using raylib's GLFW
-- Using X11 for window creation
-- Audio Backend: miniaudio
-- Building raylib static library
-- Generated build type: Debug
-- Compiling with the flags:
-- PLATFORM=PLATFORM_DESKTOP
-- GRAPHICS=GRAPHICS_API_OPENGL_33
-- Configuring done
CMake Error at libultraship/extern/CMakeLists.txt:73 (target_link_libraries):
Target "ImGui" links to:
SDL2::SDL2
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
CMake Error at soh/CMakeLists.txt:2100 (target_link_libraries):
Target "soh" links to:
SDL2::SDL2
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
no problem this is easy enough for me to test, honestly i attempted to get it working my self for awhile but i'm just not used to cmake like i am other build systems
It looks like you changed line 2063, that should stay at just find_package(SDL2)
, line 2069 is the one you needed to change. We're still finding the same package but then linking a different library from that package. Like this:
find_package(SDL2)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
"ZAPDUtils;"
SDL2::SDL2-static #change this line
"$<$<BOOL:${BUILD_CROWD_CONTROL}>:SDL2_net::SDL2_net>"
${CMAKE_DL_LIBS}
Threads::Threads
)
oh sorry, my bad, will fix that, thank you
yeah changing that around, it gives the original error just with that name now
unix E[0] /home/unix/Source/Shipwright/ ➜ cmake -H. -Bbuild-cmake -GNinja
-- OpenBSD
-- Linking against dependent libraries statically
-- Using the multi-header code from /home/unix/Source/Shipwright/libultraship/extern/nlohmann-json/include/
-- Testing if -Werror=pointer-arith can be used -- compiles
-- Testing if -Werror=implicit-function-declaration can be used -- compiles
-- Testing if -fno-strict-aliasing can be used -- compiles
-- Using raylib's GLFW
-- Using X11 for window creation
-- Audio Backend: miniaudio
-- Building raylib static library
-- Generated build type: Debug
-- Compiling with the flags:
-- PLATFORM=PLATFORM_DESKTOP
-- GRAPHICS=GRAPHICS_API_OPENGL_33
-- Configuring done
CMake Error at libultraship/extern/CMakeLists.txt:73 (target_link_libraries):
Target "ImGui" links to:
SDL2::SDL2
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
CMake Error at soh/CMakeLists.txt:2100 (target_link_libraries):
Target "soh" links to:
SDL2::SDL2-static
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
Hmmm. I'm running out of ideas then. I'd say your next best bet is to see if you can build and install SDL2 2.0.22 or above. I haven't dug deep enough yet to say for certain, but there were definitely cmake changes between those two versions that might have an impact.
okay, i'll probably have to wait til tomorrow then, is sdl2-2.24.1
fine? thats the version ports has, seems weird to jump from 2.0.20 to 2.24.1 but idk the sdl updates
Definitely worth a shot. If I have time I might try and make an OpenBSD VM and experiment, but I can't make any promises about when that will be.
okay will try it tomorrow, i'll also see if i can think of anything else, hopefully that works we will see, thanks for all the help
i tried it earlier today but do to unrelated issues with building any version of the SDL2 port i haven't been able to build the more up to date package, i'll experiment with this more but that might take awhile
I had used this on linux when it wasn't finding SDL2 -DSDL2_DIR=/usr/local/lib/cmake/SDL2/
cmake -H. -Bbuild-cmake -GNinja -DSDL2_DIR=/usr/local/lib/cmake/SDL2/
EDIT: setting SDL2_DIR didnt work. I made the following changes:
libultraship/extern/CMakeLists.txt
L73 SDL2::SDL2 -> SDL2
soh/CMakeLists.txt
L2069 SDL2::SDL2 -> SDL2
and
ln -s /usr/X11R6/include/X11 /usr/include/
Only SDL2::SDL2 is not found. https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/devel/sdl2/patches/Attic/patch-sdl2-config_cmake_in?rev=1.4&content-type=text/plain&hideattic=1 shows a patch to add it. With this configuration works. For the build /usr/local/include/SDL2 is used for include dir, which is not matching <SDL2/SDL.h> used in the sources. I removed SDL2 from include in sdl2config.cmake and build continues throwing an error about X11/Xlib.h not found. This is because X11 resides in /usr/X11R6, which is not added. Adding -DCMAKE_CXX_FLAGS="-I/usr/X11R6/include" solves this. Now I'm getting compile errors like: /home/vagrant/Shipwright-cmake/libultraship/extern/StormLib/src/FileStream.cpp:374:12: error: use of undeclared identifier 'ftruncate64'; did you mean 'ftruncate'? So there is more porting needed...
In file included from /home/vagrant/Shipwright-cmake/libultraship/extern/ImGui/backends/imgui_impl_sdl.cpp:78: /usr/local/include/SDL2/SDL_syswm.h:69:10: fatal error: 'X11/Xlib.h' file not found Is there a find_package(X11) missing?
modifying SDL2::SDL2
to just SDL2
seems to just makes the first step go through.
playing around with the extract assets phase now
cmake --build build-cmake --target ExtractAssets
results in it not finding SDL.h no matter if i passed -DSDL2_DIR=/usr/local/lib/cmake/SDL2/
or not
unix E[0] /home/unix/Source/Shipwright/ ➜ cmake --build build-cmake --target ExtractAssets
[1/416] Building CXX object libultraship/extern/CMakeFiles/StrHash64.dir/StrHash64/StrHash64.cpp.o
[2/416] Building CXX object libultraship/extern/CMakeFiles/Mercury.dir/Mercury/Mercury.cpp.o
[3/416] Building CXX object libultraship/extern/CMakeFiles/ImGui.dir/ImGui/backends/imgui_impl_sdl.cpp.o
[4/416] Linking CXX static library libultraship/extern/libStrHash64.a
[5/416] Building CXX object libultraship/extern/CMakeFiles/ImGui.dir/ImGui/backends/imgui_impl_opengl3.cpp.o
samu: job failed: /usr/bin/c++ -I/home/unix/Source/Shipwright/libultraship/extern/ImGui -I/home/unix/Source/Shipwright/libultraship/extern/ImGui/backends -I/usr/local/include/SDL2 -g -std=gnu++20 -MD -MT libultraship/extern/CMakeFiles/ImGui.dir/ImGui/backends/imgui_impl_sdl.cpp.o -MF libultraship/extern/CMakeFiles/ImGui.dir/ImGui/backends/imgui_impl_sdl.cpp.o.d -o libultraship/extern/CMakeFiles/ImGui.dir/ImGui/backends/imgui_impl_sdl.cpp.o -c /home/unix/Source/Shipwright/libultraship/extern/ImGui/backends/imgui_impl_sdl.cpp
/home/unix/Source/Shipwright/libultraship/extern/ImGui/backends/imgui_impl_sdl.cpp:77:10: fatal error: 'SDL2/SDL.h' file not found
#include <SDL2/SDL.h>
^~~~~~~~~~~~
1 error generated.
samu: subcommand failed
i guess this is where i should mention that i've been using https://github.com/michaelforney/samurai on my system for ninja builds, but it shouldn't be negatively effecting anything, and if it seems like it could i'll try regular ninja.
if that patch does something special id like to know but actually cant figure out where or why its applied sdl2-config.cmake is literally just
# sdl2 cmake project-config input for ./configure scripts
set(prefix "/usr/local")
set(exec_prefix "${prefix}")
set(libdir "${exec_prefix}/lib")
set(includedir "${prefix}/include")
set(SDL2_PREFIX "${prefix}")
set(SDL2_EXEC_PREFIX "${exec_prefix}")
set(SDL2_LIBDIR "${libdir}")
set(SDL2_INCLUDE_DIRS "${includedir}/SDL2")
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2")
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
i assume this is prepatched when built for openbsd, honestly that might be the patch used on building the sdl2 package.
I also reviewed the patch @th-2021 mentioned prior to building. The last time I ran into the ftruncate errors was when we were beginning the port for switch. At the time I had used a modified FileStream.cpp for StormLib.
StormPort.h has some of the defines listed. I was not able to extract the assets completely due to the ftruncate errors.
Edit:
libultraship/extern/StormLib/CMakeLists.txt changing line 325
to:
if(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD OR ${CMAKE_SYSTEM_NAME} STREQUAL OpenBSD)
Fixes the ftruncate
issue.
I'm having completely different issues. I was able to run cmake --build build-cmake --target ExtractAssets
all the way up until the second to last object just fine (besides having to symlink a few lib directories) and I'm now getting the following errors.
[1/2] Linking CXX executable ZAPD/ZAPD
FAILED: ZAPD/ZAPD
: && /usr/bin/c++ -g -pthread -Wl,-export-dynamic ZAPD/CMakeFiles/ZAPD.dir/ExecutableMain.cpp.o -o ZAPD/ZAPD -L/usr/local/lib -Wl,-z,origin,-rpath,/usr/local/lib ZAPD/libZAPDLib.a -Wl,--whole-archive OTRExporter/OTRExporter/libOTRExporter.a -Wl,--no-whole-archive libultraship/src/libultraship.a libultraship/extern/ZAPDUtils/libZAPDUtils.a libultraship/extern/libtinyxml2.a libultraship/extern/libStrHash64.a libultraship/extern/libImGui.a /usr/local/lib/libSDL2.so.0.14 libultraship/extern/StormLib/libstorm.a /usr/lib/libz.so.7.0 /usr/local/lib/libbz2.so.10.4 /usr/local/lib/libpng.so.18.0 /usr/lib/libz.so.7.0 -pthread -Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
CrashHandler.cpp:64 (/home/swindles/oot/Shipwright/ZAPDTR/ZAPD/CrashHandler.cpp:64)(CrashHandler.cpp.o:(ErrorHandler(int)) in archive ZAPD/libZAPDLib.a): warning: rand() may return deterministic values, is that what you want?
ZCollision.cpp:344 (/home/swindles/oot/Shipwright/ZAPDTR/ZAPD/ZCollision.cpp:344)(ZCollision.cpp.o:(CameraDataList::CameraDataList(ZFile*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&, unsigned int, unsigned int)) in archive ZAPD/libZAPDLib.a): warning: sprintf() is often misused, please use snprintf()
StringHelper.cpp:112 (/home/swindles/oot/Shipwright/libultraship/extern/ZAPDUtils/Utils/StringHelper.cpp:112)(StringHelper.cpp.o:(StringHelper::Sprintf(char const*, ...)) in archive libultraship/extern/ZAPDUtils/libZAPDUtils.a): warning: vsprintf() is often misused, please use vsnprintf()
SBaseFileTable.cpp:2058 (/home/swindles/oot/Shipwright/libultraship/extern/StormLib/src/SBaseFileTable.cpp:2058)(SBaseFileTable.cpp.o:(AllocateFileName(_TMPQArchive*, _TFileEntry*, char const*)) in archive libultraship/extern/StormLib/libstorm.a): warning: strcpy() is almost always misused, please use strlcpy()
SFilePatchArchives.cpp:742 (/home/swindles/oot/Shipwright/libultraship/extern/StormLib/src/SFilePatchArchives.cpp:742)(SFilePatchArchives.cpp.o:(FindPatchPrefix_SC2_HelperFile(_TMPQArchive*, _TMPQArchive*)) in archive libultraship/extern/StormLib/libstorm.a): warning: strcat() is almost always misused, please use strlcat()
ld: error: undefined symbol: backtrace
>>> referenced by CrashHandler.cpp:58 (/home/swindles/oot/Shipwright/ZAPDTR/ZAPD/CrashHandler.cpp:58)
>>> CrashHandler.cpp.o:(ErrorHandler(int)) in archive ZAPD/libZAPDLib.a
ld: error: undefined symbol: backtrace_symbols
>>> referenced by CrashHandler.cpp:59 (/home/swindles/oot/Shipwright/ZAPDTR/ZAPD/CrashHandler.cpp:59)
>>> CrashHandler.cpp.o:(ErrorHandler(int)) in archive ZAPD/libZAPDLib.a
c++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Edit: fixed with the following patch:
diff --git a/ZAPD/CMakeLists.txt b/ZAPD/CMakeLists.txt
index 96c42d0..9c358c6 100644
--- a/ZAPD/CMakeLists.txt
+++ b/ZAPD/CMakeLists.txt
@@ -479,6 +479,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
else()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
+ find_package(Backtrace REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"ZAPDUtils;"
-Wl,--whole-archive $<TARGET_LINKER_FILE_DIR:OTRExporter>/$<TARGET_LINKER_FILE_NAME:OTRExporter> -Wl,--no-whole-archive
@@ -486,6 +487,7 @@ else()
PNG::PNG
${CMAKE_DL_LIBS}
Threads::Threads
+ ${Backtrace_LIBRARY}
)
endif()
Save this patch in the ZAPDTR
repo and run git apply $FILE.patch
inside that dir.
I believe OpenBSD uses clang by default now, so #3383 will be another step towards proper support.
following https://github.com/HarbourMasters/Shipwright/blob/develop/BUILDING.md#linux (linux is the most similar) when you get to
cmake -H. -Bbuild-cmake -GNinja
it can't find the system sdl2 it seems.the pkg is installed
the cmake files for SDL2 seem to be in the proper
/usr/local/lib/cmake/SDL2/
location.i have no idea what could be causing this issue as it seems to be entirely dependency related, i might be missing something with how cmake handles dependencies but i'm not sure