# uwsgi cannot open "./router_redirect_plugin.so"



## sagaracharya (Jun 27, 2020)

Earlier I installed FreeBSD 13-CURRENT, installed uwsgi through ports


```
cd /usr/ports/www/uwsgi
make install clean
```

It did work well and I was able to access a plugin named router_redirect . When I'm installing the same in 12.1-STABLE on my RPi3, I'm unable to access the plugin

It prints 
!!! UNABLE to load uWSGI plugin: Cannot open "./router_redirect_plugin.so" !!!

My .ini file is as follows:


```
...
plugins = router_redirect
...
```

I also tried uninstalling with port and installing with pkg, doesn't work!


----------



## sagaracharya (Jun 28, 2020)

I tried today on 12.1-RELEASE and it also shows the same error.


----------



## sagaracharya (Jun 28, 2020)

I tried with the latest CURRENT. Same error. The configuration at end of port installation shows 
plugin_dir = .
I'm not sure whether it is empty or it's the same directory. What to do now?

I'm unable to find where it's installed. I see some unreadable uwsgi files in /usr/local/bin


----------



## sagaracharya (Jun 29, 2020)

```
find / -name uwsgi
```
shows 4 locations
/usr/local/etc/rc.d/uwsgi
/usr/local/bin/uwsgi
/usr/ports/www/uwsgi
/var/mail/uwsgi


```
find / -name router_redirect_plugin.so
find / -name router_redirect
```

Above 2 commands show absolutely nothing! There's no such file!
Only the port maintainer can help me now.


----------



## George (Jun 29, 2020)

Maybe `make config install clean` and enable plugins in the config screen?

Freshports shows this under configuration options:

```
Enable plugins     PSGI=off: PSGI embedded plugin
```

This could explain your error message (UNABLE to load uWSGI plugin).

But I dont know this port, never used it.


----------



## SirDice (Jun 29, 2020)

Regarding the use of  -CURRENT:  Topics about unsupported FreeBSD versions


----------



## sagaracharya (Jun 29, 2020)

I tried that too. Also, PSGI is different. By default, plugins are built too. That is an extra option for PSGI plugin which is not useful for me.



SirDice said:


> Regarding the use of  -CURRENT:  Topics about unsupported FreeBSD versions


I use 12.1-RELEASE. I just tried 12.1-STABLE and 13-CURRENT recent snapshots to check the problem.


----------



## T-Daemon (Jun 30, 2020)

sagaracharya said:


> Only the port maintainer can help me now.


You could also address the problem to the uWSGI mailing list: http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

There is a way to obtain the plugin. Build the plugin manually, execute in /usr/ports/www/uwsgi/work-py37/uwsgi-2.0.18:

`python3.7 uwsgiconfig.py --plugin plugins/router_redirect`
`cp router_redirect_plugin.so /usr/local/lib`
`service uwsgi restart`

But this is not a recommended procedure. It will produce a unregistered library, absent in the package database, invisible to the pkg(8) or ports(7) framework.

Also a default direct build from source tar ball doesn't produce any .so libraries. Maybe it's meant to be modular.





__





						Installing uWSGI — uWSGI 2.0 documentation
					





					uwsgi-docs.readthedocs.io


----------



## sagaracharya (Jun 30, 2020)

T-Daemon said:


> You could also address the problem to the uWSGI mailing list: http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
> 
> There is a way to obtain the plugin. Build the plugin manually, execute in /usr/ports/www/uwsgi/work-py37/uwsgi-2.0.18:
> 
> ...


That did it. Thanks a ton. I have requested uwsgi guys on the above mailing list to update the port since also, 2.0.19 is out. I will keep this setting till the updated port is out. Then I'll reinstall the port.


----------



## T-Daemon (Jun 30, 2020)

There is a misunderstanding. Suggesting the uWSGI mailing list was meant to clarify why the plugin is absent.

After further investigation, it's also possible the error message is an error itself, that the module is embedded in the uwsgi binary, the linking to router_redirect_plugin.so faulty. Running make on the port with script(1) recording the build and less verbosity ( Makefile `#PYDISTUTILS_BUILDARGS= --verbose`):

```
...
*** uWSGI compiling embedded plugins ***
...
[thread 3][cc] plugins/router_redirect/router_redirect.o
...
```

And the binary:

```
strings  work-py37/uwsgi-2.0.19.1/uwsgi | grep router_redirect
router_redirect_plugin
router_redirect
```

You should file a bug report at https://bugs.freebsd.org to clarify the situation.



sagaracharya said:


> I have requested uwsgi guys on the above mailing list to update the port since also, 2.0.19 is out.


Thats not the right place. They are not responsible for the port maintenance. You need to address the request at https://bugs.freebsd.org Ports & Packages (latest version is 2.0.19.1) . But the problem with the error message should be clarified first.


----------



## sagaracharya (Jul 1, 2020)

T-Daemon said:


> After further investigation, it's also possible the error message is an error itself, that the module is embedded in the uwsgi binary, the linking to router_redirect_plugin.so faulty. Running make on the port with script(1) recording the build and less verbosity ( Makefile `#PYDISTUTILS_BUILDARGS= --verbose`):
> 
> ```
> ...
> ...



Yes, the plugin worked but once I tried to run my site on server, nothing works well. It shows a template error when my templates are present. It's broken without a doubt. I have filed a bug. I hope they fix it ASAP. I'm totally stuck!


----------



## T-Daemon (Jul 4, 2020)

sagaracharya said:


> My .ini file is as follows:
> 
> ```
> ...
> ...



Reading though the documentation it seems to be a .ini configuration error on your side (embedded plugins a.k.a modules), try /usr/local/etc/uwsgi/uwsgi.ini:

```
[uwsgi]

module=router_redirect
```

Starting the service doesn't return an error with the above configuration, but I have no setup to see if the plugin/module is working as expected.


----------



## T-Daemon (Jul 7, 2020)

T-Daemon said:


> ```
> [uwsgi]
> 
> module=router_redirect
> ...



I was fooled by the absents of an error message, didn't thought to look in /var/log/uwsgi.log, but there was clearly a error recorded:                                              

```
ModuleNotFoundError: No module named 'router_redirect'
```

The problem could be lang/python37. On July 6th the latest package repository was updated, python37 upgraded: 3.7.7_1 -> 3.7.8. python37 in the quarterly package repository remains at 3.7.7_1. Since the upgrade I can't reproduce the error. I have in /usr/local/etc/uwsgi/uwsgi.ini set:

```
[uwsgi]

plugins=router_redirect
```

No error message when starting the service or in the log.

Please upgrade your system to latest repository if on quarterly (to python-3.7.8), restart the service and check your server.


----------



## sagaracharya (Jul 8, 2020)

I installed python37 from ports. Most probably, it did not install correctly
I get "libpython3.8m.so.1.0" not found, required by "uwsgi"

Anyways, I don't think the minor change from 3.7.7 to 3.7.8 should affect uwsgi in such a way. uwsgi built for 3.7.8 and system having python3.7.7 can probably show those errors but I strongly think this will not solve the error. uwsgi 2.0.18 has been made about 6 months before today. 

I enabled latest repo but the pkg showed some strange python versions, python37-3.7.0_3. python is 2.7_3,2 so I switched back to quarterly.

I think it's time for me to shift to alpine while developers fix this. I can't wait forever.


----------

