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

Can't build with clang on FreeBSD #1416

Closed
lbartoletti opened this issue Oct 28, 2019 · 14 comments · Fixed by #1445
Closed

Can't build with clang on FreeBSD #1416

lbartoletti opened this issue Oct 28, 2019 · 14 comments · Fixed by #1445

Comments

@lbartoletti
Copy link

Operating system: FreeBSD
wxPython version & source: wxPython 4.0.6 from github. I'm trying to create a FreeBSD package
Python version & source: python 3.6.9

Description of the problem:

First error

[178/868] Compiling sip/cpp/sip_corewxIcon.cpp
../../../../sip/cpp/sip_corewxString.cpp:53:10: error: wxString conversion can only handle WCHAR wxStrings currently
        #error wxString conversion can only handle WCHAR wxStrings currently
         ^
1 error generated.

Waf: Leaving directory `/usr/local/poudriere/ports/default/x11-toolkits/py-wxPython40/work-py36/wxPython-4.0.7/build/waf/3.6/gtk3'
Build failed
 -> task in '_core' failed with exit status 1 (run with -v to display more information)
Command '"/usr/local/bin/python3.6" /usr/local/poudriere/ports/default/x11-toolkits/py-wxPython40/work-py36/wxPython-4.0.7/bin/waf-2.0.8 --wx_config=wxgtk3u-3.0-config --gtk3 --python="/usr/local/bin/python3.6" --out=build/waf/3.6/gtk3 configure build ' failed with exit code 1.
Finished command: build_py (2m45.725s)
Finished command: build (2m45.725s)
Command '"/usr/local/bin/python3.6" -u build.py build' failed with exit code 1.

But wxWidgets is compiled with Gtk3 and unicode support.

By removing, the ifdef on this file and ohters. I can build until this issue:

[807/868] Compiling sip/cpp/sip_propgridwxPGChoicesData.cpp
../../../../sip/cpp/sip_propgridwxPGPropArgCls.cpp:320:45: error: reinterpret_cast from 'nullptr_t' to 'wxPGProperty *' is not allowed
            *sipCppPtr = new wxPGPropArgCls(reinterpret_cast< wxPGProperty * >(NULL));
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Waf: Leaving directory `/usr/local/poudriere/ports/default/x11-toolkits/py-wxPython40/work-py36/wxPython-4.0.7/build/waf/3.6/gtk3'
Build failed
 -> task in '_propgrid' failed with exit status 1 (run with -v to display more information)
Command '"/usr/local/bin/python3.6" /usr/local/poudriere/ports/default/x11-toolkits/py-wxPython40/work-py36/wxPython-4.0.7/bin/waf-2.0.8 --wx_config=wxgtk3u-3.0-config --gtk3 --python="/usr/local/bin/python3.6" --out=build/waf/3.6/gtk3 configure build ' failed with exit code 1.
Finished command: build_py (13m51.176s)
Finished command: build (13m51.177s)
Command '"/usr/local/bin/python3.6" -u build.py build' failed with exit code 1.
*** Error code 1

I can create a CI with Cirrus-CI if you want.
Thank you.

@RobinD42
Copy link
Member

What CLI command(s) are you using to do the build?

@lbartoletti
Copy link
Author

@RobinD42 I didn't use CLI directly since I create a port (like rewrinting a makefile upper the software). My works is currently here.

port with LLVM/CLANG

The errors in my previous comment are the result of my try to compile wxPython with clang.

port with GCC9

With GCC9 it compiles, but I have an error when I run programms like wxdemo:

lbartoletti@FreeBSD:~ % wxdemo
Traceback (most recent call last):

File "/usr/local/bin/wxdemo", line 11, in <module>
  load_entry_point('wxPython==4.0.6', 'console_scripts', 'wxdemo')()
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
  return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
  return ep.load()
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2443, in load
  return self.resolve()
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2449, in resolve
  module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python3.6/site-packages/wx/__init__.py", line 17, in <module>
  from wx.core import *
File "/usr/local/lib/python3.6/site-packages/wx/core.py", line 12, in <module>
  from ._core import *

ImportError: /usr/local/lib/python3.6/site-packages/wx/_core.so: Undefined symbol "_ZThn784_N9wxListBox13DoInsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType"

Tests from CLI

lbartoletti@FreeBSD:~/prog/Phoenix % python3 build.py etg --nodoc --use_syswx build

Will build using: "/usr/local/bin/python3"
3.6.9 (default, Aug 22 2019, 01:17:11)
[GCC 4.2.1 Compatible FreeBSD Clang 6.0.1 (tags/RELEASE_601/final 335540)]
Python's architecture is 64bit
cfg.VERSION: 4.0.8a1

Running command: etg
"/usr/local/bin/python3" etg/_xrc.py --sip --nodoc
Unable to find xml file for ITEM: wxXmlResource
Tried: /usr/home/lbartoletti/prog/Phoenix/ext/wxWidgets/docs/doxygen/out/xml/classwx_xml_resource.xml
       /usr/home/lbartoletti/prog/Phoenix/ext/wxWidgets/docs/doxygen/out/xml/structwx_xml_resource.xml
       /usr/home/lbartoletti/prog/Phoenix/ext/wxWidgets/docs/doxygen/out/xml/wxXmlResource
Traceback (most recent call last):
  File "etg/_xrc.py", line 220, in <module>
    run()
  File "etg/_xrc.py", line 47, in run
    etgtools.parseDoxyXML(module, ITEMS)
  File "/usr/home/lbartoletti/prog/Phoenix/etgtools/__init__.py", line 82, in parseDoxyXML
    raise DoxyXMLError(msg)
etgtools.DoxyXMLError: Unable to find xml file for ITEM: wxXmlResource
Command '"/usr/local/bin/python3" etg/_xrc.py --sip --nodoc' failed with exit code 1.
Finished command: etg (0.333s)

lbartoletti@FreeBSD:~/prog/Phoenix % python3 build.py dox etg --nodoc --use_syswx build

Will build using: "/usr/local/bin/python3"
3.6.9 (default, Aug 22 2019, 01:17:11)
[GCC 4.2.1 Compatible FreeBSD Clang 6.0.1 (tags/RELEASE_601/final 335540)]
Python's architecture is 64bit
cfg.VERSION: 4.0.8a1

Running command: dox
Traceback (most recent call last):
  File "build.py", line 2193, in <module>
    main(sys.argv[1:])
  File "build.py", line 206, in main
    function(options, args)
  File "build.py", line 961, in cmd_dox
    _doDox('xml')
  File "build.py", line 935, in _doDox
    doxCmd = getDoxCmd()
  File "build.py", line 658, in getDoxCmd
    _doxCmd = getTool('doxygen', doxygenCurrentVersion, doxygenMD5, 'DOXYGEN', True)
  File "build.py", line 558, in getTool
    md5 = MD5[platform]
KeyError: 'freebsd12'
Finished command: dox (0.15s)

@RobinD42
Copy link
Member

First, to make things easier you can use a source tarball rather than a checkout from git. Then you won't need to run the dox, etg, or sip commands, because all the generated source is included in the source tarball.

Otherwise you'll need to jump through some extra hoops since we only maintain doxygen and sip binaries on the tools server for Windows, OSX, and Linux.

  1. Set DOXYGEN in the environment to the path of a Doxygen 1.8.8 binary

  2. Set SIP in the environment to the path of a SIP 4.19.16 binary. Later versions of 4.19 will probably work okay too.

  3. To generate all the source code that is not committed to git, you'll need to run python3 build.py dox etg --nodoc sip

  4. You can add the build command and flags to the above, but doing it separately is okay if the above has been run first. Using the --use_syswx is the correct thing to do, but then the version of the system wxWidgets and how it was built becomes important. What's the version and what configure options were used to built it?

@lbartoletti
Copy link
Author

First, to make things easier you can use a source tarball rather than a checkout from git.

Yes, I read that is the recommended way, so I use already tar.gz for my ports. The problems reported in the issue, are obtained with the source tarball.

If I compile my ports with GCC it builds, but there is a link error.

Otherwise you'll need to jump through some extra hoops

Thank you, I forgot to add DOXYGEN/SIP env. But I have a new issue.

"/usr/local/bin/python3" etg/gdicmn.py --sip --nodoc
Traceback (most recent call last):
  File "etg/gdicmn.py", line 408, in <module>
    run()
  File "etg/gdicmn.py", line 79, in run
    for f in c.find('operator+=').all() + c.find('operator-=').all():
  File "/usr/home/lbartoletti/prog/Phoenix_master/etgtools/extractors.py", line 122, in find
    (head, self.__class__.__name__, self.name))
etgtools.extractors.ExtractorError: Unable to find item named 'operator-=' within ClassDef named 'wxPoint'
Command '"/usr/local/bin/python3" etg/gdicmn.py --sip --nodoc' failed with exit code 1.
Finished command: etg (0m4.168s)

FYI I use wx widgets from my system. Version 3.0.4.0 with Gtk3 and Unicode.

@RobinD42
Copy link
Member

Okay, thanks for the clarifications.

The error indicates that the script was unable to find the method operator-= within the wxPoint metadata in the XML output from Doxygen. It's definitely there. (https://github.com/wxWidgets/wxWidgets/blob/WX_3_0_BRANCH/interface/wx/gdicmn.h#L639) Try running python3 build.py dox again to regenerate those XML files and then try the etg --nodoc step again.

If the problem persists then take a closer look at doxygen. Is it the correct version? ISTR that there were lots of unexpected changes in output the last time we did a micro version update of Doxygen.

@lbartoletti
Copy link
Author

OK. It's a segmentation fault with Doxygen...
./regen.sh : ligne 115 : 95835 Segmentation fault $DOXYGEN Doxyfile

our version is doxygen-1.8.15

I'll look at this.

@lbartoletti
Copy link
Author

Doxygen crashes with GENERATE_XML, not with GENERATE_HTML for example

@RobinD42
Copy link
Member

RobinD42 commented Nov 1, 2019

Try with doxygen 1.8.8, or switch back to using a source tarball instead of a git checkout. If you want to use a current (unreleased) source archive then you can get them from https://wxpython.org/Phoenix/snapshot-builds/

@RobinD42
Copy link
Member

RobinD42 commented Nov 1, 2019

Although, those are only done for the master branch currently.

@lbartoletti
Copy link
Author

By removing, the ifdef on this file and ohters. I can build until this issue:

[807/868] Compiling sip/cpp/sip_propgridwxPGChoicesData.cpp
../../../../sip/cpp/sip_propgridwxPGPropArgCls.cpp:320:45: error: reinterpret_cast from 'nullptr_t' to 'wxPGProperty *' is not allowed
            *sipCppPtr = new wxPGPropArgCls(reinterpret_cast< wxPGProperty * >(NULL));
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Waf: Leaving directory `/usr/local/poudriere/ports/default/x11-toolkits/py-wxPython40/work-py36/wxPython-4.0.7/build/waf/3.6/gtk3'
Build failed
 -> task in '_propgrid' failed with exit status 1 (run with -v to display more information)
Command '"/usr/local/bin/python3.6" /usr/local/poudriere/ports/default/x11-toolkits/py-wxPython40/work-py36/wxPython-4.0.7/bin/waf-2.0.8 --wx_config=wxgtk3u-3.0-config --gtk3 --python="/usr/local/bin/python3.6" --out=build/waf/3.6/gtk3 configure build ' failed with exit code 1.
Finished command: build_py (13m51.176s)
Finished command: build (13m51.177s)
Command '"/usr/local/bin/python3.6" -u build.py build' failed with exit code 1.
*** Error code 1

I found the solution. LLVM is happy with static_cast instead of reinterpret_cast

@RobinD42
Copy link
Member

Ok, thanks. That's an easy fix to make.

@lbartoletti
Copy link
Author

I can prepare the patch for etg/propgridiface.py but where apply patch too for sip files?

sip/gen/propgridiface.sip
sip/cpp/sip_propgridwxPGPropArgCls.cpp

@RobinD42
Copy link
Member

but where apply patch too for sip files?

Those files are generated by the build.

@lbartoletti
Copy link
Author

Thank you.

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 a pull request may close this issue.

2 participants