Skip to content

Fix compilation on OpenBSD#284

Open
thyssentishman wants to merge 1 commit intoLSTS:masterfrom
thyssentishman:master
Open

Fix compilation on OpenBSD#284
thyssentishman wants to merge 1 commit intoLSTS:masterfrom
thyssentishman:master

Conversation

@thyssentishman
Copy link

I had to make this change to get DUNE to compile on OpenBSD. Perhaps you'd like to merge it.

On a related note, I had to run CMake as follows (OpenBSD libraries are installed under /usr/local/lib):

mkdir build && cd build && CXXFLAGS="-L/usr/local/lib" cmake ..

Otherwise, I would get the following error:

ld: error: unable to find library -lcurl

Not sure where I'd patch this in the CMake files.

@Bernardo-Gabriel Bernardo-Gabriel requested review from paulosousadias and removed request for paulosousadias February 9, 2026 17:04
@Bernardo-Gabriel Bernardo-Gabriel self-assigned this Feb 9, 2026
@Bernardo-Gabriel
Copy link
Collaborator

Are you running DUNE on OpenBSD? What system are you using?
At this moment, we are only actively maintaining builds using g++ on Linux-based OSs. I don't see any major issue regarding compatibility with OpenBSD, but be aware that we are not currently maintaining it.

Regarding the compilation error you mentioned.
Maybe it would be better to add /usr/local/ as an environment variable:
export CMAKE_PREFIX_PATH=/usr/local
Or force CMake to look at your /usr/local/:
cmake .. -DCMAKE_PREFIX_PATH=/usr/local

@thyssentishman
Copy link
Author

Are you running DUNE on OpenBSD? What system are you using?

I'm trying to develop some Tasks on OpenBSD yes, but DUNE will run on Linux on our end application.

Maybe it would be better to add /usr/local/ as an environment variable:
export CMAKE_PREFIX_PATH=/usr/local
Or force CMake to look at your /usr/local/:
cmake .. -DCMAKE_PREFIX_PATH=/usr/local

This did not fix the problem. Instead of using CXXFLAGS, appending -L/usr/local/lib to DUNE_SYS_LIBS with the following diff also fixes the issue (of course this is OpenBSD specific):

diff --git a/cmake/SystemLibraries.cmake b/cmake/SystemLibraries.cmake
index 512afa3..375a19b 100644
--- a/cmake/SystemLibraries.cmake
+++ b/cmake/SystemLibraries.cmake
@@ -67,4 +67,5 @@ macro(dune_probe_libs)
   dune_test_lib(nsl inet_ntop)
   dune_test_lib(dl dlopen)
   dune_test_lib(intl gettext)
+  dune_add_lib(-L/usr/local/lib)
 endmacro(dune_probe_libs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants