Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Failed to install on Fedora 24 due to strdup error in mtex2MML #64

Closed
ProgramFan opened this issue Aug 29, 2016 · 6 comments
Closed

Failed to install on Fedora 24 due to strdup error in mtex2MML #64

ProgramFan opened this issue Aug 29, 2016 · 6 comments

Comments

@ProgramFan
Copy link

gem install mathematical-1.6.7 fails on Fedora 24 (with gcc 6.1) with the following error:

current directory: /home/zyang/.local/share/rvm/gems/ruby-2.3.0/gems/mathematical-1.6.7/ext/mathematical
make "DESTDIR="
compiling lasem_overrides.c
In file included from /usr/include/string.h:630:0,
                 from /home/zyang/.local/share/rvm/gems/ruby-2.3.0/gems/mathematical-1.6.7/ext/mathematical/mtex2MML/src/../deps/uthash/uthash.h:29,
                 from /home/zyang/.local/share/rvm/gems/ruby-2.3.0/gems/mathematical-1.6.7/ext/mathematical/mtex2MML/src/environment.h:4,
                 from /home/zyang/.local/share/rvm/gems/ruby-2.3.0/gems/mathematical-1.6.7/ext/mathematical/mtex2MML/src/mtex2MML.h:12,
                 from lasem_overrides.c:5:
/home/zyang/.local/share/rvm/gems/ruby-2.3.0/gems/mathematical-1.6.7/ext/mathematical/mtex2MML/src/../deps/uthash/../strdup/strdup.h:24:1: error: expected identifier or ‘(’ before ‘__extension__’
 strdup(const char *str);
 ^
lasem_overrides.c: In function ‘lsm_itex_to_mathml’:
lasem_overrides.c:23:1: warning: control reaches end of non-void function [-Wreturn-type]
 lsm_itex_to_mathml (const char *itex, gssize size) { }
 ^~~~~~~~~~~~~~~~~~
Makefile:238: recipe for target 'lasem_overrides.o' failed
make: *** [lasem_overrides.o] Error 1
@ProgramFan
Copy link
Author

It seems the strdup override conflict with the real strdup in string.h. Commenting out the strdup declaration in mtex2MML/deps/strdup/strdup.h solves the problem.

@gjtorikian
Copy link
Owner

Could you try installing with the environment variable MATHEMATICAL_SKIP_STRDUP enabled, such as:

MATHEMATICAL_SKIP_STRDUP=1 gem install mathematical

This problem has begun recently and I confess I don't know what is causing it. I thought that the ifdef in mtex2mml would take care of conflicts with strdup but that does not seem to be the case. strdup is not part of the C standard so I felt the need to include it. Perhaps I ought to rename the file (string_dupe?) so that it does not conflict with existing implementations? Do you have any suggestions?

@ProgramFan
Copy link
Author

ProgramFan commented Aug 29, 2016

MATHEMATICAL_SKIP_STRDUP=1 solves the problem perfectly. I have tried to comment out the strdup line and it broke mtex2MML compilation (although the aforementioned file compiled). The CMakeLists.txt of mtex2MML also lacks proper support to detect HAVE_STRDUP. If strdup is only used internally by mtex2MML, I would suggest rename it.

@gjtorikian
Copy link
Owner

The CMakeLists.txt of mtex2MML also lacks proper support to detect HAVE_STRDUP

I'm not sure what you mean by this but if you know of a fix, I would very much appreciate a pull request! https://github.com/gjtorikian/mtex2MML

I'll close this out for now since the original issue is solved and, pending an update to the CMakeLists file, I may just rename method to avoid conflict.

@akosma
Copy link

akosma commented Oct 21, 2018

This fix does not work in macOS Mojave 10.14, and the gem cannot be installed.

@aronayne
Copy link

Can also confirm this fix does not work in macOS Mojave 10.14.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants