Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the swab bug to compile on solaris system #6628

Merged
merged 3 commits into from Jun 24, 2016

Conversation

FrankYu
Copy link
Contributor

@FrankYu FrankYu commented Jun 23, 2016

on smartos will met below error when try to build:

In file included from /opt/local/include/python2.7/Python.h:44:0,

             from src/mplutils.h:21,

             from src/ft2font_wrapper.cpp:1:

/usr/include/unistd.h:521:75: error: declaration of C function 'void swab(const void_, void_, ssize_t)' conflicts with

In file included from /opt/local/include/python2.7/Python.h:42:0,

             from src/mplutils.h:21,

             from src/ft2font_wrapper.cpp:1:

/usr/include/stdlib.h:170:13: error: previous declaration 'void swab(const char_, char_, ssize_t)' here

error: command 'gcc' failed with exit status 1

Signed-off-by: Frank Yu flyxiaoyu@gmail.com

on smartos will met below error when try to build:

In file included from /opt/local/include/python2.7/Python.h:44:0,

                 from src/mplutils.h:21,

                 from src/ft2font_wrapper.cpp:1:

/usr/include/unistd.h:521:75: error: declaration of C function 'void swab(const void*, void*, ssize_t)' conflicts with

In file included from /opt/local/include/python2.7/Python.h:42:0,

                 from src/mplutils.h:21,

                 from src/ft2font_wrapper.cpp:1:

/usr/include/stdlib.h:170:13: error: previous declaration 'void swab(const char*, char*, ssize_t)' here

error: command 'gcc' failed with exit status 1

Signed-off-by: Frank Yu <flyxiaoyu@gmail.com>
Signed-off-by: Frank Yu <flyxiaoyu@gmail.com>
@tacaswell tacaswell modified the milestones: 2.0 (style change major release), 2.0.1 (next bug fix release) Jun 23, 2016
@tacaswell
Copy link
Member

Why does this work? Is this a know conflict?

We obviously have no CI on this change.

@FrankYu
Copy link
Contributor Author

FrankYu commented Jun 23, 2016

someone has report this problem http://matplotlib.1069221.n5.nabble.com/Runtime-Error-on-Solaris-Error-Closing-Dupe-File-Handle-td45601.html

why this work:

on smartos:

#sed -n 512,525p /usr/include/unistd.h
#if !defined(XOPEN_OR_POSIX) || defined(__EXTENSIONS)
extern void setusershell(void);
#endif /* !defined(XOPEN_OR_POSIX)|| defined(__EXTENSIONS) /
extern unsigned sleep(unsigned);
#if !defined(XOPEN_OR_POSIX) || defined(__EXTENSIONS)
extern int stime(const time_t *);
#endif /
!defined(XOPEN_OR_POSIX) || defined(__EXTENSIONS) _/
#if defined(XPG4)
/
EXTENSIONS makes the SVID Third Edition prototype in stdlib.h visible _/
extern void swab(const void *_RESTRICT_KYWD, void *RESTRICT_KYWD, ssize_t);
#endif /
defined(_XPG4) */
#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(EXTENSIONS)
extern int symlink(const char *, const char *);
extern void sync(void);

swab was declared 'if defined(_XPG4)'. So add 'undef _XPG4' to avoid the twice declaration of swab.
Moreover, I find one commit d0d21 in 2010 which was related this issues

#git show d0d21
commit d0d2110
Author: John Hunter jdh2358@gmail.com
Date: Fri Jul 2 18:06:25 2010 +0000

fix swab bug so mpl will compile on solaris with cxx 6

svn path=/trunk/matplotlib/; revision=8484

diff --git a/CHANGELOG b/CHANGELOG
index c49196d..af6023d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+2010-07-02 Modified CXX/WrapPython.h to fix "swab bug" on solaris so

  •       mpl can compile on Solaris with CXX6 in the trunk.  Closes
    
  •       tracker bug 3022815 - JDH
    

    2010-06-30 Added autoscale convenience method and corresponding
    pyplot function for simplified control of autoscaling;
    and changed axis, set_xlim, and set_ylim so that by
    diff --git a/CXX/WrapPython.h b/CXX/WrapPython.h
    index 118a874..ef97cf1 100644
    --- a/CXX/WrapPython.h
    +++ b/CXX/WrapPython.h
    @@ -48,6 +48,9 @@
    #if defined(_XPG4)
    #undef _XPG4
    #endif
    +#if defined(_XPG3)
    +#undef _XPG3
    +#endif
    #endif

    // Python.h will redefine these and generate warning in the process

What should I do if we need setup CI env for this?
I believe many person who use matplotlib on Solaris well also met this problem

@WeatherGod
Copy link
Member

Is there any links that you could include as a comment so help guide future developers?

@FrankYu
Copy link
Contributor Author

FrankYu commented Jun 23, 2016

no link. I can update this patch with comment about that. Is it ok?

@WeatherGod
Copy link
Member

That'll have to do, I suppose. I don't think any of the regular developers have much experience developing on a sun-like system, so we don't know what the implications are of undef-ing that macro.

@FrankYu
Copy link
Contributor Author

FrankYu commented Jun 23, 2016

@WeatherGod
Ok. I find another link. I think they're same issues
https://github.com/FreeCAD/FreeCAD/blob/master/src/CXX/WrapPython.h

@tacaswell tacaswell modified the milestones: 1.5.2 (Critical bug fix release), 2.0.1 (next bug fix release) Jun 23, 2016
@tacaswell
Copy link
Member

For CI would would need access to a solaris (like) box to run on.

(slightly better formatted version git log)

09:43 $ git show d0d2110f3fd6ba00403f949cc519760bb3ee3e2e
commit d0d2110f3fd6ba00403f949cc519760bb3ee3e2e
Author: John Hunter <jdh2358@gmail.com>
Date:   Fri Jul 2 18:06:25 2010 +0000

    fix swab bug so mpl will compile on solaris with cxx 6

    svn path=/trunk/matplotlib/; revision=8484

diff --git a/CHANGELOG b/CHANGELOG
index c49196d..af6023d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+2010-07-02 Modified CXX/WrapPython.h to fix "swab bug" on solaris so
+           mpl can compile on Solaris with CXX6 in the trunk.  Closes
+           tracker bug 3022815 - JDH
+
 2010-06-30 Added autoscale convenience method and corresponding
            pyplot function for simplified control of autoscaling;
            and changed axis, set_xlim, and set_ylim so that by
diff --git a/CXX/WrapPython.h b/CXX/WrapPython.h
index 118a874..ef97cf1 100644
--- a/CXX/WrapPython.h
+++ b/CXX/WrapPython.h
@@ -48,6 +48,9 @@
 #if defined(_XPG4)
 #undef _XPG4
 #endif
+#if defined(_XPG3)
+#undef _XPG3
+#endif
 #endif

 // Python.h will redefine these and generate warning in the process

attn @mdboom It looks like this is something we lost in the CXX-ectomy

@FrankYu Thanks for your diligent footwork on this!

Can you put in the XDG3 undef as well?

Given that we still have not cut 1.5.2 and we now have win+mac+linux testing in this branch I think this should be backported to 1.5.x

Signed-off-by: Frank Yu <flyxiaoyu@gmail.com>
@WeatherGod WeatherGod merged commit 5de9c44 into matplotlib:master Jun 24, 2016
WeatherGod added a commit that referenced this pull request Jun 24, 2016
fix the swab bug to compile on solaris system
@WeatherGod
Copy link
Member

backported to v1.5.x via bf6e785

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

Successfully merging this pull request may close these issues.

None yet

4 participants