[GH-ISSUE #116] Issues building libxlswriter on Gentoo Linux with system minizip #96

Closed
opened 2026-05-05 11:39:02 -06:00 by gitea-mirror · 18 comments
Owner

Originally created by @petricf on GitHub (Aug 10, 2017).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/116

Originally assigned to: @jmcnamara on GitHub.

On Gentoo Linux minizip is usually installed system wide. This conflicts with the packaged minizip.

The following patches remove the dependency in CMakeLists.txt and adjust the include in packager.h
They are based on the 0.7.2 release.

My suggestion is to add an option for cmake to use the system minizip instead of the built in one.
Sorry - i don't know much on cmake, so maybe an other one will step in.

patches.zip

Originally created by @petricf on GitHub (Aug 10, 2017). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/116 Originally assigned to: @jmcnamara on GitHub. On Gentoo Linux minizip is usually installed system wide. This conflicts with the packaged minizip. The following patches remove the dependency in CMakeLists.txt and adjust the include in packager.h They are based on the 0.7.2 release. My suggestion is to add an option for cmake to use the system minizip instead of the built in one. Sorry - i don't know much on cmake, so maybe an other one will step in. [patches.zip](https://github.com/jmcnamara/libxlsxwriter/files/1214593/patches.zip)
gitea-mirror 2026-05-05 11:39:02 -06:00
Author
Owner

@jmcnamara commented on GitHub (Aug 10, 2017):

Hi @petricf,

Thanks for the report.

  1. Could you add some instruction on how to replicate the issues on Gentoo?
  2. Does the issue happen if you use the Makefile based build system?

John

<!-- gh-comment-id:321528047 --> @jmcnamara commented on GitHub (Aug 10, 2017): Hi @petricf, Thanks for the report. 1. Could you add some instruction on how to replicate the issues on Gentoo? 2. Does the issue happen if you use the Makefile based build system? John
Author
Owner

@petricf commented on GitHub (Aug 10, 2017):

Hello,

imho this is a problem in which the sequence of include directories are scanned for header
files - system vs. packaged.

  1. How ro replicate.

Gentoo uses a .ebuild file contining instructions on how to build integrate a package into
the system. Mine reads this way w/o patches):
----------------- cut ----------------------
EAPI=5
inherit cmake-utils
DESCRIPTION=
"An C implementation of an excel writer"*
HOMEPAGE="https://github.com/jmcnamara/libxlsxwriter"
SRC_URI="https://github.com/jmcnamara/${PN}/archive/RELEASE_${PV}.tar.gz ->
${P}.tar.gz"

LICENSE="BSD-2" # FreeBSD
SLOT="0"
KEYWORDS="amd64 x86"
RDEPEND="sys-libs/zlib[minizip]"
DEPEND="${RDEPEND}"
S="${WORKDIR}/${PN}-RELEASE_${PV}"
----------------- cut ----------------------

All the build and install rules a built in. This is referred by the second line "inherit cmake-
utils". I do not know what sequence of commands are executed here.

Simply place the file above as "libxlsxwriter-0.7.2.ebuild" into the (local) portage tree of
gentoo. The output can be viewed in the attached file "build.log" (sorry, it's german and
colored/escape codes).

  1. Use pre-packaged Makefile.

The output rather is the same
----------------- cut ----------------------
petric@main ~/libxlsxwriter-RELEASE_0.7.2 $ LANG=en_US.UTF-8 make
ioapi.c:29:0:
ioapi.h:135:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before
OF

  •                                              ^* 
    

ioapi.h:136:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before
OF

  •                                              ^* 
    

ioapi.h:137:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before
OF

  •                                              ^* 
    

ioapi.h:138:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before
OF
...

<!-- gh-comment-id:321581064 --> @petricf commented on GitHub (Aug 10, 2017): Hello, imho this is a problem in which the sequence of include directories are scanned for header files - system vs. packaged. 1. How ro replicate. Gentoo uses a *.ebuild file contining instructions on how to build integrate a package into the system. Mine reads this way w/o patches): ----------------- cut ---------------------- EAPI=5 *inherit* cmake-utils DESCRIPTION=*"An C implementation of an excel writer"* HOMEPAGE=*"https://github.com/jmcnamara/libxlsxwriter"* SRC_URI=*"https://github.com/jmcnamara/${PN}/archive/RELEASE_${PV}.tar.gz -> ${P}.tar.gz"* LICENSE=*"BSD-2"* # FreeBSD SLOT=*"0"* KEYWORDS=*"amd64 x86"* RDEPEND=*"sys-libs/zlib[minizip]"* DEPEND=*"${RDEPEND}"* S=*"${WORKDIR}/${PN}-RELEASE_${PV}"* ----------------- cut ---------------------- All the build and install rules a built in. This is referred by the second line "inherit cmake- utils". I do not know what sequence of commands are executed here. Simply place the file above as "libxlsxwriter-0.7.2.ebuild" into the (local) portage tree of gentoo. The output can be viewed in the attached file "build.log" (sorry, it's german and colored/escape codes). 2. Use pre-packaged Makefile. The output rather is the same ----------------- cut ---------------------- *petric@main ~/libxlsxwriter-RELEASE_0.7.2 $* LANG=en_US.UTF-8 make *ioapi.c:29:0*: *ioapi.h:135:51:* *error: *expected ‘*=*’, ‘*,*’, ‘*;*’, ‘*asm*’ or ‘*__attribute__*’ before ‘*OF*’ * ^* *ioapi.h:136:51:* *error: *expected ‘*=*’, ‘*,*’, ‘*;*’, ‘*asm*’ or ‘*__attribute__*’ before ‘*OF*’ * ^* *ioapi.h:137:51:* *error: *expected ‘*=*’, ‘*,*’, ‘*;*’, ‘*asm*’ or ‘*__attribute__*’ before ‘*OF*’ * ^* *ioapi.h:138:51:* *error: *expected ‘*=*’, ‘*,*’, ‘*;*’, ‘*asm*’ or ‘*__attribute__*’ before ‘*OF*’ ...
Author
Owner

@petricf commented on GitHub (Aug 10, 2017):

Missed attachment - renamed to build.txt
build.txt

<!-- gh-comment-id:321582942 --> @petricf commented on GitHub (Aug 10, 2017): Missed attachment - renamed to build.txt [build.txt](https://github.com/jmcnamara/libxlsxwriter/files/1215398/build.txt)
Author
Owner

@jmcnamara commented on GitHub (Aug 10, 2017):

What is the output of the following on your system:

git clone https://github.com/jmcnamara/libxlsxwriter.git
cd libxlsxwriter
make V=1

P.S. Could you post the output via the GitHub website (rather than email) and place it between verbatim commands ``` (3 backticks at the start and end).

<!-- gh-comment-id:321607199 --> @jmcnamara commented on GitHub (Aug 10, 2017): What is the output of the following on your system: ``` git clone https://github.com/jmcnamara/libxlsxwriter.git cd libxlsxwriter make V=1 ``` P.S. Could you post the output via the GitHub website (rather than email) and place it between verbatim commands ``` (3 backticks at the start and end).
Author
Owner

@petricf commented on GitHub (Aug 10, 2017):

Find attached the screen output (test.txt) as requested.

test.txt

<!-- gh-comment-id:321700591 --> @petricf commented on GitHub (Aug 10, 2017): Find attached the screen output (test.txt) as requested. [test.txt](https://github.com/jmcnamara/libxlsxwriter/files/1216615/test.txt)
Author
Owner

@petricf commented on GitHub (Aug 11, 2017):

Compiler info:

petric@main ~/test/libxlsxwriter $ LANG=en_US.UTF-8 gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/5.4.0/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/5.4.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-5.4.0-r3/work/gcc-5.4.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/5.4.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.4.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.4.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.4.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/5.4.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 5.4.0-r3 p1.3, pie-0.6.5' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --disable-libmpx --enable-vtable-verify --enable-libvtv --enable-lto --without-isl --enable-libsanitizer
Thread model: posix
gcc version 5.4.0 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5) 

Default include search paths are:

petric@main ~/test/libxlsxwriter $ echo | LANG=en_US.UTF-8 gcc -Wp,-v -x c - -fsyntax-only
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include-fixed
 /usr/include
End of search list.
<!-- gh-comment-id:321704940 --> @petricf commented on GitHub (Aug 11, 2017): Compiler info: ``` petric@main ~/test/libxlsxwriter $ LANG=en_US.UTF-8 gcc -v Using built-in specs. COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/5.4.0/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/5.4.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-5.4.0-r3/work/gcc-5.4.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/5.4.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.4.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.4.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.4.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/5.4.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 5.4.0-r3 p1.3, pie-0.6.5' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --disable-libmpx --enable-vtable-verify --enable-libvtv --enable-lto --without-isl --enable-libsanitizer Thread model: posix gcc version 5.4.0 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5) ``` Default include search paths are: ``` petric@main ~/test/libxlsxwriter $ echo | LANG=en_US.UTF-8 gcc -Wp,-v -x c - -fsyntax-only ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include-fixed /usr/include End of search list. ```
Author
Owner

@jmcnamara commented on GitHub (Aug 11, 2017):

I'm finding it very hard to reproduce this on other Linux systems even after installing minizip into the system. From a bit of googling it looks like it only occurs on Gentoo.

A couple of questions:

  1. Is zconf.h installed on your system and if so where? For me it is in /usr/local/include/zconf.h.
  2. What version of Gentoo are you using?
  3. If I wanted to replicate a system to reproduce this in a VM what version of Gentoo would I have to install?

John

<!-- gh-comment-id:321798443 --> @jmcnamara commented on GitHub (Aug 11, 2017): I'm finding it very hard to reproduce this on other Linux systems even after installing minizip into the system. From a bit of googling it looks like it only occurs on Gentoo. A couple of questions: 1. Is zconf.h installed on your system and if so where? For me it is in `/usr/local/include/zconf.h`. 2. What version of Gentoo are you using? 3. If I wanted to replicate a system to reproduce this in a VM what version of Gentoo would I have to install? John
Author
Owner

@petricf commented on GitHub (Aug 11, 2017):

  1. zconf.h is in /usr/include
  2. amd64 13.0 (base) + kde plasma desktop
  3. Usually follow https://gentoo.org/get-started/
    This will get you to a non-gui installation. The latest stable version should be ok.

Gentoo is a distribution where you compile (nearly) everything from source. It uses a ports like system (inspired from BSD ?) to manage the installed packages.

Which VM system you intend to use (VMware, Proxmox (linux kvm), VirtualBox, ...) ?

<!-- gh-comment-id:321806451 --> @petricf commented on GitHub (Aug 11, 2017): 1. zconf.h is in /usr/include 2. amd64 13.0 (base) + kde plasma desktop 3. Usually follow https://gentoo.org/get-started/ This will get you to a non-gui installation. The latest stable version should be ok. Gentoo is a distribution where you compile (nearly) everything from source. It uses a ports like system (inspired from BSD ?) to manage the installed packages. Which VM system you intend to use (VMware, Proxmox (linux kvm), VirtualBox, ...) ?
Author
Owner

@jmcnamara commented on GitHub (Aug 11, 2017):

Which VM system you intend to use (VMware, Proxmox (linux kvm), VirtualBox, ...) ?

Virtualbox

<!-- gh-comment-id:321809879 --> @jmcnamara commented on GitHub (Aug 11, 2017): > Which VM system you intend to use (VMware, Proxmox (linux kvm), VirtualBox, ...) ? Virtualbox
Author
Owner

@petricf commented on GitHub (Aug 11, 2017):

Should be installable w/o a problem. I use proxmox (http://pve.proxmox.com) for my test installations - so i can't provide a VM directly.
But this may help: http://www.osboxes.org/gentoo/

<!-- gh-comment-id:321815353 --> @petricf commented on GitHub (Aug 11, 2017): Should be installable w/o a problem. I use proxmox (http://pve.proxmox.com) for my test installations - so i can't provide a VM directly. But this may help: http://www.osboxes.org/gentoo/
Author
Owner

@jmcnamara commented on GitHub (Aug 12, 2017):

Hi,

I got a Gentoo VM built and I was able to replicate the issue. It is in the category best described as "interesting".

It turns out that it is caused by Gentoo redefining a macro in libs zconf.h. Because why not fix a "bad" macro name and let some poor schmucks downstream tear their hair out for a day or two.

Anyway, I've pushed a fix to master and tested it on Gentoo with the standard (non cmake) make system.

Let me know if you have any issues and if you want it packaged into a release.

The cmake solution will have to be patched separately and probably not in the short term.

John

<!-- gh-comment-id:321949253 --> @jmcnamara commented on GitHub (Aug 12, 2017): Hi, I got a Gentoo VM built and I was able to replicate the issue. It is in the category best described as "interesting". It turns out that it is caused by Gentoo redefining a macro in libs zconf.h. Because why not fix a "[bad](https://bugs.gentoo.org/show_bug.cgi?id=383179)" macro name and let some poor schmucks downstream tear their hair out for a day or two. Anyway, I've pushed a fix to master and tested it on Gentoo with the standard (non cmake) make system. Let me know if you have any issues and if you want it packaged into a release. The cmake solution will have to be patched separately and probably not in the short term. John
Author
Owner

@petricf commented on GitHub (Aug 12, 2017):

Thanks for your efforts.

I can confirm that your fix works for the Makefile based build.

The patches i posted on top of this issue also works for me. I can live with that.
You do not have to make a release only driven by the change above.

Could you consider adding a cmake option to use a system wide installed minizip instead of the packaged one ?

<!-- gh-comment-id:321962841 --> @petricf commented on GitHub (Aug 12, 2017): Thanks for your efforts. I can confirm that your fix works for the Makefile based build. The patches i posted on top of this issue also works for me. I can live with that. You do not have to make a release only driven by the change above. Could you consider adding a cmake option to use a system wide installed minizip instead of the packaged one ?
Author
Owner

@jmcnamara commented on GitHub (Aug 12, 2017):

You do not have to make a release only driven by the change above.

Ok. I thought that maybe your were going to submit a port/ebuild for libxlsxwriter to Gentoo. If not I'll just let the change trickle into the next release.

Could you consider adding a cmake option to use a system wide installed minizip instead of the packaged one

To be clear: the issues isn't that there is a system wide minizip since that isn't an issue on Ubuntu, Fedora or other systems. The issue is that the Gentoo maintainers patch the standard zlib/zconf headers to redefine a macro name that they don't like. This causes programs that use those macros to not compile.

I'll look into a fix in the CMake files. In the meantime you can build with CMake as follows:

cd libxlsxwriter
cd cmake # or wherever
cmake -D CMAKE_C_FLAGS='-DOF=_Z_OF' ..
make 
<!-- gh-comment-id:321981158 --> @jmcnamara commented on GitHub (Aug 12, 2017): > You do not have to make a release only driven by the change above. Ok. I thought that maybe your were going to submit a port/ebuild for libxlsxwriter to Gentoo. If not I'll just let the change trickle into the next release. > Could you consider adding a cmake option to use a system wide installed minizip instead of the packaged one To be clear: the issues isn't that there is a system wide minizip since that isn't an issue on Ubuntu, Fedora or other systems. The issue is that the Gentoo maintainers patch the standard zlib/zconf headers to redefine a macro name that they don't like. This causes programs that use those macros to not compile. I'll look into a fix in the CMake files. In the meantime you can build with CMake as follows: ``` cd libxlsxwriter cd cmake # or wherever cmake -D CMAKE_C_FLAGS='-DOF=_Z_OF' .. make ```
Author
Owner

@jmcnamara commented on GitHub (Aug 12, 2017):

Could you consider adding a cmake option to use a system wide installed minizip instead of the packaged one ?

This issue is now fixed on master for cmake and make.

@Alexhuszagh Can you have a quick look at CMake fix: f256dc2ae9 to see if everything looks okay. No rush.

<!-- gh-comment-id:321982705 --> @jmcnamara commented on GitHub (Aug 12, 2017): > Could you consider adding a cmake option to use a system wide installed minizip instead of the packaged one ? This issue is now fixed on master for cmake and make. @Alexhuszagh Can you have a quick look at CMake fix: f256dc2ae9b3890d0df7ae92f234a7f7db5039f7 to see if everything looks okay. No rush.
Author
Owner

@petricf commented on GitHub (Aug 12, 2017):

I've added the ebuild for 0.7.2 to gentoo bugtracker: https://bugs.gentoo.org/show_bug.cgi?id=627452

This ebuild-version includes the two patches i created for using the system minizip. They will be applied during the build process.

As soon as 0.7.3 (or whatever version the fixed release gets) is out (and i get knowledge of it) i will update the ebuild for gentoo and remove the patches.

<!-- gh-comment-id:321994723 --> @petricf commented on GitHub (Aug 12, 2017): I've added the ebuild for 0.7.2 to gentoo bugtracker: https://bugs.gentoo.org/show_bug.cgi?id=627452 This ebuild-version includes the two patches i created for using the system minizip. They will be applied during the build process. As soon as 0.7.3 (or whatever version the fixed release gets) is out (and i get knowledge of it) i will update the ebuild for gentoo and remove the patches.
Author
Owner

@jmcnamara commented on GitHub (Aug 12, 2017):

Version 0.7.3 is available now. Thanks for submitting the ebuild file.

<!-- gh-comment-id:322004095 --> @jmcnamara commented on GitHub (Aug 12, 2017): Version 0.7.3 is available now. Thanks for submitting the ebuild file.
Author
Owner

@petricf commented on GitHub (Aug 13, 2017):

Confirmed - patches are no more required for Gentoo.

I've posted an updated ebuild to https://bugs.gentoo.org/show_bug.cgi?id=627452.

<!-- gh-comment-id:322046794 --> @petricf commented on GitHub (Aug 13, 2017): Confirmed - patches are no more required for Gentoo. I've posted an updated ebuild to https://bugs.gentoo.org/show_bug.cgi?id=627452.
Author
Owner

@jmcnamara commented on GitHub (Aug 14, 2017):

Thanks for that. Let me know if it gets added.

P.S. There is a feature request to use system minizip when possible, that you might be interested in. See: #119.

<!-- gh-comment-id:322154996 --> @jmcnamara commented on GitHub (Aug 14, 2017): Thanks for that. Let me know if it gets added. P.S. There is a feature request to use system minizip when possible, that you might be interested in. See: #119.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#96
No description provided.