michaelrsweet / codedoc

Documentation generator for C/C++ code
https://www.msweet.org/codedoc
Apache License 2.0
48 stars 6 forks source link

how to do a local install of codedoc using a local mxml #20

Closed mark-summerfield closed 1 month ago

mark-summerfield commented 1 month ago

I have installed mxml using configure --prefix /home/mark/opt/mxml and that worked fine. I now want to build codedoc beside it but when I run configure it (rightly can't find) mxml. I'm not familiar enough with configure or make to know how to do it. I tried ./configure --prefix /home/mark/codedoc --with-ldflags=/home/mark/opt/mxml/lib and ./configure --prefix /home/mark/codedoc --with-ldflags=-L/home/mark/opt/mxml/lib but neither worked.

michaelrsweet commented 1 month ago

Set the PKG_CONFIG_PATH environment variable to your install prefix, e.g.:

PKG_CONFIG_PATH=/home/mark/opt/mxml/lib/pkgconfig ./configure ...
mark-summerfield commented 1 month ago

That got me closer but didn't quite work:

$ ls /home/mark/opt/mxml/lib/
libmxml4.a  libmxml4.so  libmxml4.so.2  pkgconfig

$ PKG_CONFIG_PATH=/home/mark/opt/mxml/lib/pkgconfig ./configure --prefix /home/mark/opt/codedoc
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for ranlib... ranlib
checking for mkdir... /usr/bin/mkdir
checking for rm... /usr/bin/rm
checking for install-sh script... using /home/mark/zip/codedoc-3.7/install-sh
checking for pkg-config... /usr/bin/pkg-config
checking for mxml4... yes
checking for zlib... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking whether compiler supports -Wno-char-subscripts... yes
checking whether compiler supports -Wno-format-truncation... yes
checking whether compiler supports -Wno-format-y2k... yes
checking whether compiler supports -Wno-switch... yes
checking whether compiler supports -Wno-unused-result... yes
checking whether compiler supports -fPIE... yes
checking for OS-specific compiler options... -D__USE_MISC -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -Wl,-z,relro,-z,now
configure: creating ./config.status
config.status: creating Makefile

$ make
Compiling codedoc.c...
Compiling mmd.c...
Compiling zipc.c...
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
zipc.c: In function ‘zipcOpen’:
zipc.c:1014:17: warning: variable ‘modtime’ set but not used [-Wunused-but-set-variable]
 1014 |                 modtime,                /* Last modification date/time */
      |                 ^~~~~~~
zipc.c:1011:17: warning: variable ‘version’ set but not used [-Wunused-but-set-variable]
 1011 |                 version,                /* Version needed to extract */
      |                 ^~~~~~~
Linking codedoc...
Formatting codedoc.html...
./codedoc: error while loading shared libraries: libmxml4.so.2: cannot open shared object file: No such file or directory
make: *** [Makefile:141: codedoc.html] Error 127

$ ls -l /home/mark/opt/mxml/lib/libmxml4.*
-rwxr-xr-x 1 mark mark 259024 Sep 17 19:39 /home/mark/opt/mxml/lib/libmxml4.a
lrwxrwxrwx 1 mark mark     13 Sep 17 19:39 /home/mark/opt/mxml/lib/libmxml4.so -> libmxml4.so.2
-rwxr-xr-x 1 mark mark 150360 Sep 17 19:39 /home/mark/opt/mxml/lib/libmxml4.so.2

$ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

And actually, if I can get it to work I'd rather link to libmxml4 statically so that codedoc is completely stand alone.

Thanks!

PS I also tried not using --prefix so mxml ended up in /usr/local/lib. But that didn't help.

$ PKG_CONFIG_PATH=/usr/local/lib ./configure 
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for ranlib... ranlib
checking for mkdir... /usr/bin/mkdir
checking for rm... /usr/bin/rm
checking for install-sh script... using /home/mark/zip/codedoc-3.7/install-sh
checking for pkg-config... /usr/bin/pkg-config
checking for mxml4... yes
checking for zlib... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking whether compiler supports -Wno-char-subscripts... yes
checking whether compiler supports -Wno-format-truncation... yes
checking whether compiler supports -Wno-format-y2k... yes
checking whether compiler supports -Wno-switch... yes
checking whether compiler supports -Wno-unused-result... yes
checking whether compiler supports -fPIE... yes
checking for OS-specific compiler options... -D__USE_MISC -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -Wl,-z,relro,-z,now
configure: creating ./config.status
config.status: creating Makefile

$ make
Compiling codedoc.c...
Compiling mmd.c...
Compiling zipc.c...
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
zipc.c: In function ‘zipcOpen’:
zipc.c:1014:17: warning: variable ‘modtime’ set but not used [-Wunused-but-set-variable]
 1014 |                 modtime,                /* Last modification date/time */
      |                 ^~~~~~~
zipc.c:1011:17: warning: variable ‘version’ set but not used [-Wunused-but-set-variable]
 1011 |                 version,                /* Version needed to extract */
      |                 ^~~~~~~
Linking codedoc...
Formatting codedoc.html...
./codedoc: error while loading shared libraries: libmxml4.so.2: cannot open shared object file: No such file or directory
make: *** [Makefile:141: codedoc.html] Error 127

$ ls -l /usr/local/lib/
...
-rwxr-xr-x 1 root root  259024 Sep 17 20:00 libmxml4.a
lrwxrwxrwx 1 root root      13 Sep 17 20:00 libmxml4.so -> libmxml4.so.2
-rwxr-xr-x 1 root root  150360 Sep 17 20:00 libmxml4.so.2
michaelrsweet commented 1 month ago

OK, so wipe out your Mini-XML install and re-configure it with the "--disable-shared" option so it just builds and installs a static library. Then re-configure your codedoc and do a fresh build against that.

mark-summerfield commented 1 month ago

That worked great, thanks! Now I've just got to read the manual more carefully to see how to use it. (It already shows all my functions, but not yet their docs.)