Skip to content

FreeBSD Python lookup bugfix#6852

Closed
petermolnar wants to merge 1 commit into
domoticz:developmentfrom
petermolnar:development
Closed

FreeBSD Python lookup bugfix#6852
petermolnar wants to merge 1 commit into
domoticz:developmentfrom
petermolnar:development

Conversation

@petermolnar

@petermolnar petermolnar commented Jun 12, 2026

Copy link
Copy Markdown

The

#elif defined(__FreeBSD__)
                       extension = "m";    // FreeBSD uses 'm' suffix

code section is outdated and redundant and needs to removed, because it's preventing Domoticz from finding Python on a FreeBSD.

This is a current ls of a FreBSD 14.4 /usr/local/lib; all python libs are without the additional m.

$ ls -la | grep python
lrwxr-xr-x   1 root wheel      20 Apr 23 02:10 libpython3.11.so -> libpython3.11.so.1.0
lrwxr-xr-x   1 root wheel      20 Apr 23 02:11 libpython3.11.so.1 -> libpython3.11.so.1.0
-rw-r--r--   1 root wheel 6169904 Apr 23 02:10 libpython3.11.so.1.0
-rw-r--r--   1 root wheel   71225 Apr 23 02:11 libpython3.11.so.1.0-gdb.py
drwxr-xr-x  39 root wheel     208 Apr 30 10:23 python3.11

However, for backwards compatibility there's already a case for this in FindLibrary:

					// look in directories covered by ldconfig but 'm' variant
					if (!shared_lib_)
					{
						library = "lib" + sLibrary + "m.so";
						shared_lib_ = dlopen(library.c_str(), RTLD_LAZY | RTLD_GLOBAL);
					}

I compiled Domoticz (albeit 2025.2, that's the one currently in FreeBSD ports) with the change, and it's finally happy, after about 4-5 hours of trying to pass PATH hacks, only to realize that was not the problem.

The

```
                       extension = "m";    // FreeBSD uses 'm' suffix

```
code section is:

a, outdated
b, redundant

and should be removed.

This is a current `ls` of a FreBSD 14.4 install:

```
[:/usr/local/lib] ls -la | grep python
lrwxr-xr-x   1 root wheel      20 Apr 23 02:10 libpython3.11.so -> libpython3.11.so.1.0
lrwxr-xr-x   1 root wheel      20 Apr 23 02:11 libpython3.11.so.1 -> libpython3.11.so.1.0
-rw-r--r--   1 root wheel 6169904 Apr 23 02:10 libpython3.11.so.1.0
-rw-r--r--   1 root wheel   71225 Apr 23 02:11 libpython3.11.so.1.0-gdb.py
drwxr-xr-x  39 root wheel     208 Apr 30 10:23 python3.11
```

all python libs are without the additional `m`

However, for backwards compatibility there's already a case for this in
`FindLibrary`:

```
					// look in directories covered by ldconfig but 'm' variant
					if (!shared_lib_)
					{
						library = "lib" + sLibrary + "m.so";
						shared_lib_ = dlopen(library.c_str(), RTLD_LAZY | RTLD_GLOBAL);
					}
```

The combination of these two is preventing Domoticz from finding Python
in runtime, even though it's found at compile time; removing 2 lines
fixes the problem.
@gizmocuz gizmocuz closed this in c598d34 Jun 13, 2026
@gizmocuz

Copy link
Copy Markdown
Contributor

Thank you for reporting. So FreeBSD finally removed the suffix ;)

Because you also changed other lines in your PR, I removed it directly from the code base.

Thank you again for spotting and the PR!

@petermolnar

Copy link
Copy Markdown
Author

Because you also changed other lines in your PR, I removed it directly from the code base.

Fair point, the other two lines was my auto whitespace cleanup on save in Geany. Apologies, I should have left it out.

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