wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.3k stars 515 forks source link

installing / rebuilding phoenix wxPython fails: wx/setup.h not found #1067

Open chrismaes87 opened 5 years ago

chrismaes87 commented 5 years ago

Operating system: opensuse leap 15.0 wxPython version & source: master as of 29/10/2018: ceb2f467, also tested with versions 4.0.1 and 4.0.3 Python version & source: python2.7 from opensuse repositories

Description of the problem:

Since there is no package or wheel available for opensuse 15.0, I tried setting up wxPython in muliple manners:

both options fail at the same level:

In file included from ../../../../ext/wxWidgets/include/wx/defs.h:45:0,
                 from ../../../../ext/wxWidgets/include/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:20434,
                 from ../../../../sip/cpp/sip_corewxMDIChildFrameBase.cpp:10:
../../../../ext/wxWidgets/include/wx/platform.h:148:10: fatal error: wx/setup.h: No such file or directory
 #include "wx/setup.h"

When running python build.py dox etg --nodoc sip build I traced the following:

Setting top to                           : /home/chris/workspace/Phoenix 
Setting out to                           : /home/chris/workspace/Phoenix/build/waf/2.7/gtk3 
Checking for 'gcc' (C compiler)          : /usr/bin/gcc 
Checking for 'g++' (C++ compiler)        : /usr/bin/g++ 
Checking for program 'python'            : /usr/bin/python 
Checking for python version >= 2.7.0     : 2.7.14 
python-config                            : /usr/bin/python-config 
Asking python-config for pyembed '--cflags --libs --ldflags' flags : yes 
Testing pyembed configuration                                      : yes 
Asking python-config for pyext '--cflags --libs --ldflags' flags   : yes 
Testing pyext configuration                                        : yes 
Finding libs for WX                                                : yes 
Finding libs for WXADV                                             : yes 
Finding libs for WXSTC                                             : yes 
Finding libs for WXHTML                                            : yes 
Finding libs for WXGL                                              : yes 
Finding libs for WXWEBVIEW                                         : yes 
Finding libs for WXXML                                             : yes 
Finding libs for WXXRC                                             : yes 
Finding libs for WXRICHTEXT                                        : yes 
Finding libs for WXMEDIA                                           : yes 
Finding libs for WXRIBBON                                          : yes 
Finding libs for WXPROPGRID                                        : yes 
Finding libs for WXAUI                                             : yes 
'configure' finished successfully (1.654s)

I'm out of ideas now...

RobinD42 commented 5 years ago

You can see more details about the wxPython part of the build by adding the --verbose flag to the command line. That will (among other things) print out the compile commands used. If you want to skip the wxwidgets part (since it's already built) then you can just use the build_py command. Something like this:

python build.py build_py --verbose

You can then verify if the proper -I flag is being used for the compile commands for wxPython too. If not then I suppose it's possible that the wrong wx-config command is being used to get the compile flags.

chrismaes87 commented 5 years ago

Hello Robin,

unfortunately running

python build.py build_py --verbose

fails with other errors (probably I'll need to solve these too later...)

/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lwx_gtk3u_core-3.1
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lwx_baseu_net-3.1
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lwx_baseu-3.1

so I just ran

python build.py dox etg --nodoc sip build --verbose

to be able to reproduce the error. He is using the wrong library path: -I../../../wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.1 (using lib64 which is logical since I am on 64bit system, but the include files were generated in lib, and not lib64).

Franck78 commented 4 years ago

I have this exact same problem, with 4.1.0 At some point setup.h is searched in the wrong place

Using opensuse LEAP 15.1, the distro don't particurlarly updates packages often, so many oldies in that Linux. (GCC 7.5.0 for example)

config.status: creating lib/wx/include/gtk3-unicode-3.0/wx/setup.h .... Finished command: build_wx (10minutes)

Running command: build_py
....
WARNING: unable to find setup.h in tmp_dir/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.0

Then similar error also for Waf (setup.h not found)

build.log

Franck78 commented 4 years ago

from inside the wx-Python-4.1.0 directory

python build.py sip build --verbose

WARNING: Unable to find setup.h in /wxpython/wxPython-4.1.0/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.1, assuming wxUSE_GLCANVAS is not available.

                 from ../../../../sip/cpp/sip_corewxLogTextCtrl.cpp:10:
../../../../ext/wxWidgets/include/wx/platform.h:154:10: fatal error: wx/setup.h: Aucun fichier ou dossier de ce type
 #include "wx/setup.h"
          ^~~~~~~~~~~~
compilation terminated.

b2.log

RobinD42 commented 4 years ago

Try this:

Franck78 commented 4 years ago

"lib" only

log lines added:

       configDir = configDir[2:]
        print ("==============****************===================")
        print (wx_config)
        print (output)
        print (configDir)
        return configDir
fbourdonnec@ntkiller2:~/Documents/wxpython/wx> python build.py build_py
Will build using: "/usr/bin/python"
3.6.10 (default, Jan 16 2020, 09:12:04) [GCC]
Python's architecture is 64bit
cfg.VERSION: 4.1.0

Running command: build_py
Checking for /home/fbourdonnec/Documents/wxpython/wx/bin/waf-2.0.19...
"/usr/bin/python" /home/fbourdonnec/Documents/wxpython/wx/bin/waf-2.0.19 --wx_config=/home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/wx-config --gtk3 --python="/usr/bin/python" --out=build/waf/3.6/gtk3 configure build 
Setting top to                           : /home/fbourdonnec/Documents/wxpython/wx 
Setting out to                           : /home/fbourdonnec/Documents/wxpython/wx/build/waf/3.6/gtk3 
Checking for 'gcc' (C compiler)          : /usr/bin/gcc 
Checking for 'g++' (C++ compiler)        : /usr/bin/g++ 
Checking for program 'python'            : /usr/bin/python 
Checking for python version >= 2.7.0     : 3.6.10 
python-config                            : /usr/bin/python-config 
Asking python-config for pyext '--cflags --libs --ldflags' flags : yes 
Testing pyext configuration                                      : yes 
==============****************===================
/home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/wx-config
-I/home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.1 -I/home/fbourdonnec/Documents/wxpython/wx/ext/wxWidgets/include -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread
/home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.1
Finding libs for WX                                              : yes 
Finding libs for WXADV                                           : yes 
Finding libs for WXSTC                                           : yes 
Finding libs for WXHTML                                          : yes 
WARNING: Unable to find setup.h in /home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.1, assuming wxUSE_GLCANVAS is not available.
Finding libs for WXGL                                            : yes 
WARNING: Unable to find setup.h in /home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.1, assuming wxUSE_WEBVIEW is not available.
Finding libs for WXWEBVIEW                                       : yes 
Finding libs for WXXML                                           : yes 
Finding libs for WXXRC                                           : yes 
Finding libs for WXRICHTEXT                                      : yes 
WARNING: Unable to find setup.h in /home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.1, assuming wxUSE_MEDIACTRL is not available.
Finding libs for WXMEDIA                                         : yes 
Finding libs for WXRIBBON                                        : yes 
Finding libs for WXPROPGRID                                      : yes 
Finding libs for WXAUI                                           : yes 
'configure' finished successfully (1.603s)
Waf: Entering directory `/home/fbourdonnec/Documents/wxpython/wx/build/waf/3.6/gtk3'
**** Compiler: /usr/bin/gcc --version
     gcc (SUSE Linux) 7.5.0
     Copyright (C) 2017 Free Software Foundation, Inc.
     This is free software; see the source for copying conditions.  There is NO
     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[ 11/917] Linking build/waf/3.6/gtk3/siplib.cpython-36m-x86_64-linux-gnu.so
[ 12/917] Compiling sip/cpp/sip_corewxLogTextCtrl.cpp
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld : ne peut trouver -lwx_gtk3u_core-3.1
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld : ne peut trouver -lwx_baseu_net-3.1
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld : ne peut trouver -lwx_baseu-3.1
collect2: error: ld returned 1 exit status

In file included from ../../../../ext/wxWidgets/include/wx/defs.h:45:0,
                 from ../../../../ext/wxWidgets/include/wx/wx.h:14,
                 from ../../../../wx/include/wxPython/wxpy_api.h:41,
                 from ../../../../sip/cpp/sipAPI_core.h:20760,
                 from ../../../../sip/cpp/sip_corewxLogTextCtrl.cpp:10:
../../../../ext/wxWidgets/include/wx/platform.h:154:10: fatal error: wx/setup.h: Aucun fichier ou dossier de ce type
 #include "wx/setup.h"
          ^~~~~~~~~~~~
compilation terminated.

Waf: Leaving directory `/home/fbourdonnec/Documents/wxpython/wx/build/waf/3.6/gtk3'
Build failed
 -> task in 'siplib' failed with exit status 1 (run with -v to display more information)
 -> task in '_core' failed with exit status 1 (run with -v to display more information)
Command '"/usr/bin/python" /home/fbourdonnec/Documents/wxpython/wx/bin/waf-2.0.19 --wx_config=/home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/wx-config --gtk3 --python="/usr/bin/python" --out=build/waf/3.6/gtk3 configure build ' failed with exit code 1.
Finished command: build_py (0m3.330s)

there is an existing wx-config (from the distro,the one I want to upgrade)

some outputs of both

fbourdonnec@ntkiller2:~/Documents/wxpython/wx/buildtools> wx-config --version
3.0.3
fbourdonnec@ntkiller2:~/Documents/wxpython/wx/buildtools> /home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/wx-config --version
3.1.4
fbourdonnec@ntkiller2:~/> wx-config --cflags
-I/usr/lib64/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -DWXUSINGDLL -D__WXGTK__ -pthread
fbourdonnec@ntkiller2:~/> /home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/wx-config --cflags
-I/home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.1 -I/home/fbourdonnec/Documents/wxpython/wx/ext/wxWidgets/include -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread
Franck78 commented 4 years ago

After upgrading to opensuse leap 15.1 => 15.2

still only 'lib' and "python3 build.py build_py" fails quicly (same error as chrismaes87) (the libs exist in build/wxbld/gtk3/lib

If I add the symbolic link "lib64->lib", build_py :

------------ BUILD FINISHED ------------
To use wxPython from the build folder (without installing):
 - Set your PYTHONPATH variable to /home/fbourdonnec/Documents/wxpython/wx.
 - You may also need to set your (DY)LD_LIBRARY_PATH to /home/fbourdonnec/Documents/wxpython/wx/build/wxbld/gtk3/lib,
   or wherever the wxWidgets libs have been installed.

Finished command: build_py (37m40.302s)
Done!

The setup.h error is gone. Nonetheless, your 'thing' is buiding in 'lib' then is searching in 'lib64' !!!!!!!

waf/3.6/gtk3 fully populated

wxsvg/temp.linux-x86_64-3.6 is strange !

~919 files were compiled.

Franck78 commented 4 years ago

Before building the package, the openSuse rpm spec file applies a patch related to this bug :

http://trac.wxwidgets.org/ticket/14779

Perhaps this ticket was closed without correct response and since then, some distros must fix something, some other, no.

Here is the rpm source for building 3.0.2

Using the automated pip install wxPython produce same error lib lib64**

    WARNING: Unable to find setup.h in /tmp/pip-install-58k23ty7/wxPython/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.1, assuming wxUSE_MEDIACTRL is not available.                       
    Finding libs for WXMEDIA                                         : yes                                                                                                                     
    Finding libs for WXRIBBON                                        : yes                                                                                                                     
    Finding libs for WXPROPGRID                                      : yes                                                                                                                     
    Finding libs for WXAUI                                           : yes                                                                                                                     
    'configure' finished successfully (1.522s)                                                                                                                                                 
    Waf: Entering directory `/tmp/pip-install-58k23ty7/wxPython/build/waf/3.6/gtk3'                                                                                                            
    **** Compiler: /usr/bin/gcc --version                                                                                                                                                      
         gcc (SUSE Linux) 7.5.0                                                                                                                                                                
         Copyright (C) 2017 Free Software Foundation, Inc.                                                                                                                                     
         This is free software; see the source for copying conditions.  There is NO                                                                                                            
         warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                                                                                                           
    [ 11/917] Linking build/waf/3.6/gtk3/siplib.cpython-36m-x86_64-linux-gnu.so                                                                                                                
    /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld : ne peut trouver -lwx_gtk3u_core-3.1                                                                              
    /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld : ne peut trouver -lwx_baseu_net-3.1                                                                               
    /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld : ne peut trouver -lwx_baseu-3.1
    collect2: error: ld returned 1 exit status

    Waf: Leaving directory `/tmp/pip-install-58k23ty7/wxPython/build/waf/3.6/gtk3'
    Build failed
     -> task in 'siplib' failed with exit status 1 (run with -v to display more information)
    Command '"/usr/bin/python" /tmp/pip-install-58k23ty7/wxPython/bin/waf-2.0.19 --wx_config=/tmp/pip-install-58k23ty7/wxPython/build/wxbld/gtk3/wx-config --gtk3 --python="/usr/bin/python" --out=build/waf/3.6/gtk3 configure build ' failed with exit code 1.
    Finished command: build_py (0m3.233s)
    Finished command: build (0m6.108s)
    Command '"/usr/bin/python" -u build.py build' failed with exit code 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-58k23ty7/wxPython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-58k23ty7/wxPython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-o6w6l5ww/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.6m/wxPython Check the logs for full command output.
RobinD42 commented 4 years ago

The code that patch applies to is long gone, but it's possible that the get_python_lib can still be useful here. I don't think I have a system currently that uses a lib64 path for the python lib, but if you can find where to use that function in the build scripts then I'll look at a PR.

oleksis commented 4 years ago

Hi @RobinD42 :

Compile wxPython from GitHub source

git clone https://github.com/wxWidgets/Phoenix
cd Phoenix

git submodule update --recursive 

python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
python build.py dox etg --nodoc sip build

Get Error setup.h not found

I follow the steps for compile and see when start build wxbld for gtk3 use the path to ./lib but in the config gtk3-unicode-3.1 (./Phoenix/build/wxbld/gtk3/lib/wx/config/gtk3-unicode-3.1) use the hardcode libdir="${exec_prefix}/lib64" and wxconfdir="${exec_prefix}/lib64/wx/config" for example and then when is compiling we have the error setup.h (./Phoenix/build/wxbld/gtk3/lib/wx/include/gtk3-unicode-3.1/setup.h) not found

Then when i do some modifications i can continue with:

python build.py build_py -v

I send some picture for better idea of the situation. I Hope that help to others and find future solutions.

1_libdir 2_wxconfdir

PD: I using openSUSE Leap 15.0 but i will update to 15.2 and try again with a fresh Phoenix source code

Franck78 commented 4 years ago

I have a much more simpler approch :

ln -s lib lib64 We are inside the build tree that is not part of the finished product. If some scripts want "lib", well, let them have it.

The result

creating build/wxsvg/lib.linux-x86_64-2.7
creating build/wxsvg/lib.linux-x86_64-2.7/wx
creating build/wxsvg/lib.linux-x86_64-2.7/wx/svg
gcc -pthread -shared build/wxsvg/temp.linux-x86_64-2.7/wx/svg/_nanosvg.o -L/usr/lib64 -lpython2.7 -o build/wxsvg/lib.linux-x86_64-2.7/wx/svg/_nanosvg.so
copying build/wxsvg/lib.linux-x86_64-2.7/wx/svg/_nanosvg.so -> wx/svg
Finished command: build_others (7.434s)

------------ BUILD FINISHED ------------
To use wxPython from the build folder (without installing):
 - Set your PYTHONPATH variable to /home/fbourdonnec/Documents/wxpython/wxPython-4.1.0.
 - You may also need to set your (DY)LD_LIBRARY_PATH to /home/fbourdonnec/Documents/wxpython/wxPython-4.1.0/build/wxbld/gtk3/lib,
   or wherever the wxWidgets libs have been installed.

Finished command: build_py (37m47.708s)
Finished command: build (37m50.813s)
Done!

Now I have to figure out why I needed this three month ago.

oleksis commented 4 years ago

Compile wxPython from GitHub source

git clone https://github.com/wxWidgets/Phoenix

cd Phoenix

git submodule update --init --recursive

python3 -m venv env
source env/bin/activate
pip install -r requirements.txt

python build.py clean

python build.py dox etg --nodoc sip build_wx -v

Create simbolic link to build/wxbld/gtk3/lib64

ln -s lib build/wxbld/gtk3/lib64

Continue with build for Python

python build.py build_py -v

Good Luck!

Franck78 commented 4 years ago

@oleksis no worry, I have my little script

#!/bin/bash

rm -rf wxPython-4.1.0
mkdir -p wxPython-4.1.0/build/wxbld/gtk3/lib
ln -s  lib wxPython-4.1.0/build/wxbld/gtk3/lib64
tar -xf wxPython-4.1.0.tar.gz

cd  wxPython-4.1.0
python3 build.py dox
python3 build.py etg
python3 build.py build

@RobinD42 , Hello The build tree being unnecessary after the installation, why not just use this hack inside build.py ?

jolz commented 3 years ago

same with wxPython 4.1.1 on openSuSE Leap 15.2 (build can be fixed with "lib64"-link)

swt2c commented 3 years ago

I just tried to reproduce this on openSUSE Leap 15.2 but I could not. This is likely a bug in wxWidgets, either in the wx-config script, or whatever generates it.

swt2c commented 1 year ago

Investigated and found root cause finally, reported upstream to wxWidgets: https://github.com/wxWidgets/wxWidgets/issues/23737