This PR is a "visibility" PR to let people know that I am working on a common utils lib for geany-plugins. Right now this only includes a function for scanning a directory for files.
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany-plugins/pull/620
-- Commit Summary --
* Added common utils lib. * workbench: use common utils function for scanning directories.
-- File Changes --
M Makefile.am (1) A build/utils.m4 (9) M configure.ac (1) A utils/AUTHORS (1) A utils/COPYING (340) A utils/ChangeLog (0) A utils/Makefile.am (3) A utils/NEWS (2) A utils/README (45) A utils/THANKS (8) A utils/src/Makefile.am (14) A utils/src/filelist.c (218) A utils/src/filelist.h (27) M workbench/src/wb_project.c (36)
-- Patch Links --
https://github.com/geany/geany-plugins/pull/620.patch https://github.com/geany/geany-plugins/pull/620.diff
I am actually struggling with the makefiles. I get the following error message: ``` .libs/workbench_la-wb_project.o: In function `wb_project_dir_rescan_int': /home/lars/DokuWiki/repos/geany-plugins/workbench/src/wb_project.c:586: undefined reference to `filelist_scan_directory' collect2: error: ld returned 1 exit status ``` So on linking the workbench plugin lib the function ```filelist_scan_directory()``` is not found by the linker (no surpise). The common utils lib is in directory ```utils/src```.
I tried adding it to the workbench makefile like this: ``` workbench_la_LIBADD = $(COMMONLIBS) ../../utils/src/utils.la ``` That first seemed to work on ```make``` but on ```make install``` I got error messages about failed re-linking of ```workbench.la```. So I removed that change.
That means I need some help with the makefiles please.
Added https://github.com/LarsGit223/geany-plugins/pull/1 to improve build system support.
@LarsGit223 pushed 2 commits.
d36f70b Fix building of common utility library b083090 Merge pull request #1 from codebrainz/commonlib-autotools
@codebrainz: thanks, at least linking works now.
But something is wrong regarding the lib path. After starting geany I see the following error in the debug messages: ``` 21:53:54: Geany INFO : Can't load plugin: libgeanypluginutils.so.0: cannot open shared object file: No such file or directory 21:53:54: Geany INFO : Failed to load "/usr/local/lib/geany/workbench.so" - ignoring plugin! ```
@LarsGit223 not sure, Geany shouldn't be looking for plugins in `$(libdir)` directly, and that's where the library should end up (tha'ts what the `lib_LTLIBRARIES` change in my PR does). If the library is getting installed into where Geany looks for plugins (ex. `/usr/local/lib/geany`) then that needs to be fixed. Are you sure you didn't accidentally install the library into the plugin directory, like when messing around with the build system?
Seems to work ok for me:
```bash $ tree /opt/geany/lib /opt/geany/lib ├── geany │ ├── classbuilder.la │ ├── classbuilder.so │ ├── export.la │ ├── export.so │ ├── filebrowser.la │ ├── filebrowser.so │ ├── htmlchars.la │ ├── htmlchars.so │ ├── saveactions.la │ ├── saveactions.so │ ├── splitwindow.la │ ├── splitwindow.so │ ├── workbench.la │ └── workbench.so ├── libgeany.la ├── libgeanypluginutils.la ├── libgeanypluginutils.so -> libgeanypluginutils.so.0.0.0 ├── libgeanypluginutils.so.0 -> libgeanypluginutils.so.0.0.0 ├── libgeanypluginutils.so.0.0.0 ├── libgeany.so -> libgeany.so.0.0.0 ├── libgeany.so.0 -> libgeany.so.0.0.0 ├── libgeany.so.0.0.0 └── pkgconfig └── geany.pc
2 directories, 23 files ```
@codebrainz: thanks. I will clean up everything and try again.
@codebrainz: no, still does not work. To say it clearly: I can link successfully but the workbench plugin cannot be loaded any more. I still get that debug messages and the plugin manager doesn't show the workbench plugin any more and so I cannot start/use it.
This is the ```workbench``` part from the ```make install``` output: ``` Making install in workbench make[1]: Entering directory '/home/lars/DokuWiki/repos/gp-branch-workbench3/geany-plugins/workbench' Making install in src make[2]: Entering directory '/home/lars/DokuWiki/repos/gp-branch-workbench3/geany-plugins/workbench/src' make[3]: Entering directory '/home/lars/DokuWiki/repos/gp-branch-workbench3/geany-plugins/workbench/src' make[3]: Nothing to be done for 'install-exec-am'. /bin/mkdir -p '/usr/local/lib/geany' /bin/bash ../../libtool --mode=install /usr/bin/install -c workbench.la '/usr/local/lib/geany' libtool: warning: relinking 'workbench.la' libtool: install: (cd /home/lars/DokuWiki/repos/gp-branch-workbench3/geany-plugins/workbench/src; /bin/bash "/home/lars/DokuWiki/repos/gp-branch-workbench3/geany-plugins/libtool" --silent --tag CC --mode=relink gcc -DLOCALEDIR="/usr/local/share/locale" -DPREFIX="/usr/local" -DDOCDIR="/usr/local/share/doc/geany-plugins" -DGEANYPLUGINS_DATADIR="/usr/local/share" -DPKGDATADIR="/usr/local/share/geany-plugins" -DLIBDIR="/usr/local/lib" -DPKGLIBDIR="/usr/local/lib/geany-plugins" -DPLUGINDATADIR="/usr/local/share/geany-plugins/workbench" -DPLUGINDOCDIR="/usr/local/share/doc/geany-plugins/workbench" -DPLUGINLIBDIR="/usr/local/lib/geany-plugins/workbench" -DPLUGIN="workbench" -DGTK -pthread -I/usr/local/include/geany -I/usr/local/include/geany/tagmanager -I/usr/local/include/geany/scintilla -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wall -Wimplicit-function-declaration -Wmissing-parameter-type -Wold-style-declaration -Wpointer-arith -Wshadow -Wundef -Wwrite-strings -I../../utils/src -g -O2 -module -avoid-version -no-undefined -Wl,-z,defs -o workbench.la -rpath /usr/local/lib/geany workbench_la-plugin_main.lo workbench_la-wb_globals.lo workbench_la-workbench.lo workbench_la-wb_project.lo workbench_la-dialogs.lo workbench_la-menu.lo workbench_la-popup_menu.lo workbench_la-sidebar.lo workbench_la-utils.lo -L/usr/local/lib -lgeany -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lfontconfig -lfreetype -lglib-2.0 ../../utils/src/libgeanypluginutils.la ) libtool: install: /usr/bin/install -c .libs/workbench.soT /usr/local/lib/geany/workbench.so libtool: install: /usr/bin/install -c .libs/workbench.lai /usr/local/lib/geany/workbench.la libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /usr/local/lib/geany ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib/geany ``` At the end of the very long line I see ```../../utils/src/libgeanypluginutils.la```: is that correct that there is a relative path?
I see the utils lib being installed under: - /usr/local/lib/libgeanypluginutils.la - /usr/local/lib/libgeanypluginutils.so - /usr/local/lib/libgeanypluginutils.so.0 - /usr/local/lib/libgeanypluginutils.so.0.0.0 I can see all the plugin libs under ```/usr/local/lib/geany```, including the workbench libs.
But I still cannot load it. The debug messages in geany still show: ``` 09:20:25: Geany INFO : Can't load plugin: libgeanypluginutils.so.0: cannot open shared object file: No such file or directory 09:20:25: Geany INFO : Failed to load "/usr/local/lib/geany/workbench.so" - ignoring plugin! ``` What I wonder about is that there is no path in front of libgeanypluginutils.so.0 and I am not sure if it has any meaning that the output says ```Can't load plugin: libgeanypluginutils.so.0```. I mean it is not really a plugin. But maybe that has no meaning.
One more remark: I also did a git clone into a clean directory. No difference.
Not sure what's going on there. One suggestion is to not use `/usr/local` prefix, sooner or later you're going to mess up your system like that (makes you use root and contains other important stuff). Also recommend to use a clean config dir for testing to make sure other settings aren't getting in the way.
Example of building Geany & Geany-Plugins:
```bash
$ export PREFIX=$HOME/local-geany $ cd geany $ mkdir -p ../geany-build $ cd ../geany-build $ ../geany/configure --prefix=$PREFIX $ make install $ cd ../geany-plugins $ mkdir -p ../geany-plugins-build $ cd ../geany-plugins-build $ ../geany-plugins/configure --prefix=$PREFIX --with-geany-libdir=$PREFIX/lib $ make install $ $PREFIX/bin/geany -v -c /tmp/testing ```
09:20:25: Geany INFO : Can't load plugin: libgeanypluginutils.so.0: cannot open shared object file: No such file or directory
@LarsGit223 are your ld load paths set right? No, I don't know how to do it, I just know its a pain to get right.
@LarsGit223 Are you using Ubuntu? See https://github.com/geany/geany/blob/master/src/Makefile.am#L192
@LarsGit223 pushed 1 commit.
73f6dac workbench: clean-up: Removed code that is no longer required because of the usage of 'utils/filelist.c'.
@codebrainz, @b4n: thanks for all your help with the build system. :1st_place_medal:
Finally, calling ```ldconfig /usr/local/lib``` on the command line before building geany-plugins did the job :sweat: (So, yes I am using Ubuntu).
I tried to do it automatically by adding it somewhere in the Makefiles but failed because I just do not know anything about the principles of autotools/automake. And I have to admit that I do not want to work into it because I dislike make to much and the autotools do not seem to make the job simpler.
Although I think that it is a little shame that the libdirs are not the same amongst the different linux versions.
Anyway, that's not our fault.
Now that it works, how do we proceed now? I would like to place a fresh PR which only includes the changes for the common lib (leave workbench unchanged in that PR). Once that is merged I would place a PR for workbench which replaces the code.
@techee: the code for the filelist was originally written by you, I "only" modified it. Should I add you to the copyright?
@LarsGit223 Nah, not necessary.
By the way I have a candidate for possible inclusion to the utils library - the relative bundle path code used on Windows and Mac. When adding Mac support, I basically copied the same code to all the affected plugins - see https://github.com/geany/geany-plugins/pull/569
Now that it works, how do we proceed now? I would like to place a fresh PR
Just update your `commonlib` branch and this PR will be updated, no need to make a redundant PR for the same thing.
@codebrainz: well, it is updated already. Just thought it would be nicer to have separate PRs for utils/commonlib and the workbench plugin.
@LarsGit223 yeah, just update this PR to only contain the utils/commonlib stuff, and then create a new PR for updating plugins, that's fine.
There are still changes for the workbench plugin in this PR and I do not know how to remove them because they are in one commit with other changes. So I decided to better place a fresh PR, see #622. I close this one now.
Closed #620.
FWIW, you could've just done:
```bash $ git branch -m commonlib commonlib-old $ git branch -m commonlib2 commonlib $ git push <your-remote> -f commonlib ```
And this PR would be updated. Oh well, no big deal.
@techee: the common utils lib is now merged. So you can add your code for relative bundle path now if you like. You might also want to consider to replace the call to ```get_file_list()``` in file ```projectorganizer/prjorg-project``` with a call to ```filelist_scan_directory```. Also see PR #628.
github-comments@lists.geany.org