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

Possible problem with LTO on Anaconda 5.0 #6619

Closed
pschella opened this issue Oct 12, 2017 · 33 comments
Closed

Possible problem with LTO on Anaconda 5.0 #6619

pschella opened this issue Oct 12, 2017 · 33 comments

Comments

@pschella
Copy link

Using Anaconda 5.0 / Miniconda 4.3.27.1 (i.e. compiled with GCC 7.2.0) and devtoolset-6 on CentOS (e.g. GCC 6.3.1) to compile extensions the following compilation error occurs:

lto1: fatal error: bytecode stream generated with LTO version 6.0 instead of the expected 5.2

All works fine when I disable link-time-optimization with -fno-lto.
I'm not sure where the exact mismatch is (e.g. how LTO bytecode versions match up with compiler versions),
but thought it might be an issue that other Conda users may be running into.

@3e4
Copy link

3e4 commented Dec 15, 2017

I have just come across this error message when compiling vim80 against anaconda Python 3.5.4 :: Anaconda custom (64-bit) (conda 4.3.30):

./configure --with-features=huge --enable-multibyte --enable-rubyinterp=yes --enable-python3interp=yes --with-python3-config-dir=/home/user/files/anaconda3/lib/python3.5/config-3.5m/ --enable-perlinterp=yes --enable-luainterp=yes --enable-gui=gtk2 --enable-cscope
make VIMRUNTIMEDIR=/usr/local/share/vim/vim80
...
lto1: fatal error: bytecode stream generated with LTO version 6.0 instead of the expected 5.2
compilation terminated.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
link.sh: Linking failed
Makefile:1941: recipe for target 'vim' failed
make[1]: *** [vim] Error 1
...

I did a conda update --all before the compilation. This error did not occur when compiling on November 2nd, and the binary compiled on 2nd November would not start anymore after the conda update --all. It is complaining that it cannot find _sysconfigdata_m_linux_x86_64-linux-gnu.

I tried to pass -fno-lto to gcc through

make VIMRUNTIMEDIR=/usr/local/share/vim/vim80 CFLAGS="-fno-lto"

but did not work.

@mingwandroid
Copy link

@pschella, @3e4, please use our compilers. They are better than these other ones you are trying to use (and will obviously work much better with our packages all of which have been compiled with them, at least all of them that need compilation):

conda install gxx_linux-64.

Closing this as the problem is with your system compilers (or devtoolset) being too old and we provide our own so we do not have to (and technically cannot) fix this kind of incompatiblity.

@3e4
Copy link

3e4 commented Dec 15, 2017

Thank you for clarifying the origin of the error. This might be helpful to several people.

Could you please give me a hint how to use it? After installing, I found the ./etc/conda/activate.d/activate-gcc_linux-64.sh in the conda directory, but when I try to source it, I get:

ERROR: This cross-compiler package contains no program /bin/x86_64-conda_cos6-linux-gnu-cc
ERROR: activate-gcc_linux-64.sh failed, see above for details

There is a file ./bin/x86_64-conda_cos6-linux-gnu-cc. Or can I tell make to use the anaconda gcc without using the activation script?

@mingwandroid
Copy link

mingwandroid commented Dec 15, 2017

You are not meant to source this file. conda activate sources it for you (having first set the correct environment variables and done whatever else it needs to do). If you have installed it into your root env (a bad idea btw, you should setup per-workload environments, so here you could have one for compiling vim80) then issue the following:

. activate root

To put it in an isolated env with python3.6, you should do:

conda create -n vim80build python=3.6 gxx_linux-64
. activate vim80build

@mingwandroid
Copy link

Really if you want to build vim using tools and libraries from the Anaconda Distribution you are best off creating a recipe and using conda-build.

@3e4
Copy link

3e4 commented Dec 15, 2017

Really if you want to build vim using tools and libraries

Well, I don't really want to, but as I have the python from anaconda in my path as default interpreter I had serious trouble to get YouCompleteMe working. Finally I figured out that by building my own vim against the anaconda python it works. Now it stopped working again because I can't get vim to build.

I just tried with the environment, but I get into a lot of trouble. For one, it does not find my libncurses in /usr/lib/x86_64-linux-gnu

no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
      Or specify the name of the library with --with-tlib.

so I have to modify LDFLAGS:

export LDFLAGS='-L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu'
.configure ....

It passes, but building fails because of lua (removed the lua from config), and then some XML errors (and using system libpython3.5m)

/home/user/files/anaconda3/envs/vim80build/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: warning: libexpat.so.1, needed by /usr/lib/x86_64-linux-gnu/libpython3.5m.so, not found (try using -rpath or -rpath-link)
/usr/lib/x86_64-linux-gnu/libpython3.5m.so: undefined reference to `XML_ExpatVersion'
/usr/lib/x86_64-linux-gnu/libpython3.5m.so: undefined reference to `XML_SetEndElementHandler'
...

Maybe it picks up the system libpython because I modified LDFLAGS?

@mingwandroid
Copy link

mingwandroid commented Dec 15, 2017

Well, I don't really want to, but as I have the python from anaconda in my path as default interpreter I had serious trouble to get YouCompleteMe working. Finally I figured out that by building my own vim against the anaconda python it works. Now it stopped working again because I can't get vim to build.

I am not suggesting that you use this environment as your daily-driver, but per-workflow isolation is very important. If you don't want to ever type into a shell without YouCompleteMe working then fine, write a bash script to activate this env, do the build then activate your root env, or better, use conda-build which does all this for you.

For one, it does not find my libncurses in /usr/lib/x86_64-linux-gnu

You should install the conda ncurses package instead. I have no control over the compatibility with your system's libncurses.

so I have to modify LDFLAGS:

You should try to avoid this. We provide enough software to build a huge amount of software and where we miss something conda-forge probably has it (though at present we're not fully Binary Compatible, but we are likely more Binary Compatible than we are with some Linux distro you happen to run). If you must do this then you should add -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib to the front of your LDFLAGS so that our software is found first, both at link-time and at run-time. Here, at run-time, to make relocatable software you may need to post-process you binaries with patchelf, again, conda-build will do all of that for you.

@3e4
Copy link

3e4 commented Dec 15, 2017

Thank you for your time and help. I get

# All requested packages already installed.
# packages in environment at /home/user/files/anaconda3/envs/vim80build:
#
ncurses                   6.0                  h9df7e31_2  

If I put -L${CONDA_PREFIX}/lib -Wl,${CONDA_PREFIX}/lib into LDFLAGS I get

checking for gcc... /home/user/files/anaconda3/envs/vim80build/bin/x86_64-conda_cos6-linux-gnu-cc
checking whether the C compiler works... no

I will look into conda-build when I have more time. Just a quick question: Any chance to downgrade anaconda to the status of November (as a quick fix)?

@mingwandroid
Copy link

mingwandroid commented Dec 15, 2017

You need to look at config.log here to see why it isn't working.

@3e4
Copy link

3e4 commented Dec 15, 2017

It happens during configure, so below some lines from vim/src/configure.log

configure:11414: checking for tgetent in -lncurses
configure:11439: /home/user/files/anaconda3/envs/vim80build/bin/x86_64-conda_cos6-linux-gnu-cc -o conftest -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -D_FORTIFY_SOURCE=2 -O2 -I/usr/local/include -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -L/usr/local/lib conftest.c -lncurses  -lnsl   >&5
/home/user/files/anaconda3/envs/vim80build/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.2.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lncurses
configure:11439: $? = 1
configure: failed program was:

Then it looks for other terminals (curses...). Error repeats.

@mingwandroid
Copy link

I do not see -L${CONDA_PREFIX}/lib nor -Wl,-rpath,${CONDA_PREFIX}/lib at the front of this command line.

@mingwandroid
Copy link

Try with:

LDFLAGS="-L$CONDA_PREFIX/lib -Wl,-rpath,$CONDA_PREFIX/lib -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu" \
./configure ....

@3e4
Copy link

3e4 commented Dec 15, 2017

Sorry, that was for the vanilla vim80build environment.

With your modified LDFLAGS, configure runs through. During make then this error:

/home/user/files/anaconda3/envs/vim80build/bin/x86_64-conda_cos6-linux-gnu-cc -c -I. -I/usr/include/lua5.1 -Iproto -DHAVE_CONFIG_H   -D_FORTIFY_SOURCE=2 -O2 -I/usr/local/include  -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1        -o objects/if_lua.o if_lua.c
In file included from /usr/include/lua5.1/lua.h:16:0,
                 from if_lua.c:14:
/usr/include/lua5.1/luaconf.h:98:10: fatal error: lua5.1-deb-multiarch.h: No such file or directory
 #include "lua5.1-deb-multiarch.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~

When removing --lua-interpreter=yes from the .configure command, build works. And it runs with YCM working.

Any way to get lua (although I don't use it currently)?
Edit: liblua5.1-dev is installed
Edit2: I have /usr/include/x86_64-linux-gnu/lua5.1-deb-multiarch.h on my machine

@mingwandroid
Copy link

I think there's a bad communication problem here.

I cannot advise or help out with what happens when you try to mix our software with your local software. It's completely outside of my control.

Use conda-build and use Anaconda Distribution packages, or conda-forge packages. They probably have lua.

@3e4
Copy link

3e4 commented Dec 15, 2017

OK. I will fix lua by myself. But may I still ask: The fact that ncurses is installed in conda but not found by configure. Is this a bug in vim, in conda, in ubuntu, in gcc? I have no idea but would like to contribute.

For now I'm happy again. Thank you very much for your support! And I will look into conda-build when I have more time.

@mingwandroid
Copy link

mingwandroid commented Dec 15, 2017

It's hard to say, probably it's a bug in the Autotools stuff of vim, or maybe you are not passing --prefix=$CONDA_PREFIX. Sometimes adding --host=$HOST can help and sometimes also --build=$BUILD. That last one is set by conda-build though so do not try to use it outside of that.

Also installing our pkg-config, autoconf, automake, cmake and libtool packages is a very good idea if you want to build against our libraries.

@3e4
Copy link

3e4 commented Dec 16, 2017

I installed the additional packages, and config succeeded without modifying LDFLAGS. But some compilation error occur later.

But then I get an error during make:

gcc -c -I. -I/usr/include/lua5.1 -D_REENTRANT -D_GNU_SOURCE --sysroot=/home/user/files/anaconda3/x86_64-conda_cos6-linux-gnu/sysroot -fwrapv  -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -I/home/user/files/anaconda3/lib/5.26.0/x86_64-linux-thread-multi/CORE   -I/home/user/files/anaconda3/include/python3.5m -DPYTHON3_HOME='L"/home/user/files/anaconda3"' -pthread -fPIE -I/usr/include/ruby-2.3.0 -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -DRUBY_VERSION=23  -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1        -o objects/option.o option.c
In file included from vim.h:1816:0,
                 from option.c:35:
structs.h:100:29: fatal error: X11/Intrinsic.h: No such file or directory
 #  include <X11/Intrinsic.h>
                             ^
compilation terminated.

As you pointed out, your recommended way is conda-build, which I am not using so far. Possible this can be fixed by using it. For the time being I don't have the time to invest in setting this up.

@mingwandroid
Copy link

mingwandroid commented Dec 16, 2017

gcc -c .....

This is not our compiler, our compilers have names like x86_64-conda_cos6-linux-gnu-gcc (because they are pseudo cross-compilers).

Given that you are using your system compiler (which will probably not end well) and it's failing to find an X11 header, this means you need to install the package containing that X11 header. To figure out the package:

On Debian-based distros (like Ubuntu): apt-file search /usr/include/X11/Intrinsic.h
On RedHat-based distros: yum whatprovides **/Intrinsic.h
On ArchLinux-based distros: pkgfile /usr/include/X11/Intrinsic.h

This changes if you are using our compilers though, they do not look at your system includes (/usr/include) or libraries (/usr/lib or usr/lib64) because we do not want the system to pollute our packages. For that we have what we call CDT packages which are repackaged binaries from CentOS6 and have names like libx11-devel-cos6-x86_64. You can install these directly in your env with conda install but it's better to use conda-build for that.

Can you not just install vim from your distro though instead? Do you really want to go though all this pain?

@3e4
Copy link

3e4 commented Dec 16, 2017

The reason I'm building vim by myself is that I was not able to get YCM working with conda's python2 and python3. It just wouldn't find the installed packages for completion, and I wanted to use the conda python instead of the system wide one as it is more up to date and allows the nifty environments and package installation. It took me many hours until I found somewhere that it might be better to build (I think vim in the ubuntu repo is +python, but I have python3 as my default python in the path). Anyway, it worked after building using ubuntu compiler for 1-2 years. Had to rebuild when upgrading ubuntu. It's just recently that my setup broke (see 2nd post of this issue).

Just found out that many other functions of vim are not properly compiled when using the conda gcc, for example clientserver. I'll see how to get out of this mess without wasting too much time. Maybe nuke my home directory and start from scratch with ubuntu's vim. Maybe YCM improved, maybe my config was bad to start with.

P.S.: I think Anaconda python is a very good tool and I had no trouble to introduce several colleagues to jupyter and install all required packages within an hour!

@3e4
Copy link

3e4 commented Dec 17, 2017

I think I got it working now with the ubuntu vim. (vim-nox)

There were some old files hidden in my file system that I had to manually remove. Now I get package suggestions from the anaconda python. Probabaly there has been some progress in YCM since the time I was setting it up.

@Erotemic
Copy link

Erotemic commented Apr 9, 2018

Following this comment #6619 (comment) I was able to get terminal vim built against conda. However, I'm interested in getting vim running with a gui. I attempted to get the required gtk libs in conda, but I'm hitting an error. When vim checks for gtk>=2, it fails with x86_64-conda_cos6-linux-gnu/sysroot/lib/librt.so.1: undefined reference to __vdso_clock_gettime@GLIBC_PRIVATE`

The procedure I'm using to install dependencies and configure is:

    conda install gxx_linux-64
    conda install ncurses
    conda install -c mw gtk2
    conda install pkg-config autoconf automake cmake libtool

    #conda install -c pkgw/label/superseded gtk3
    conda install -c pkgw-forge gtk3 
    conda install -c anaconda glib 
    #apt-cache showsrc vim-gtk | grep ^Build-Depends
    
    conda install -c anaconda gtk2-devel-cos6-x86_64 
    conda install -c anaconda libxt-devel-cos6-x86_64 
    conda install -c anaconda libx11-devel-cos6-x86_64 
    conda install -c conda-forge libiconv 

    make distclean
    LDFLAGS="-L$CONDA_PREFIX/lib -Wl,-rpath,$CONDA_PREFIX/lib -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu" \
        ./configure --prefix=$CONDA_PREFIX --enable-pythoninterp=no --enable-python3interp=yes --enable-gui=gtk2 \
        --with-local-dir==$CONDA_PREFIX --with-gnome-libs=$CONDA_PREFIX/lib --with-gnome-includes=$CONDA_PREFIX/include
    cat src/auto/config.mk | grep GUI

The error details:

configure:8614: checking --enable-gui argument
configure:8685: result: GTK+ 2.x GUI support
configure:8872: checking --disable-gtktest argument
configure:8882: result: gtk test enabled
configure:8936: checking for pkg-config
configure:8954: found /home/joncrall/.local/conda/envs/py36/bin/pkg-config
configure:8966: result: /home/joncrall/.local/conda/envs/py36/bin/pkg-config
configure:8999: checking for GTK - version >= 2.2.0
configure:9079: /home/joncrall/.local/conda/envs/py36/bin/x86_64-conda_cos6-linux-gnu-cc -o conftest -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -pthread -I/home/joncrall/.local/conda/envs/py36/include/gtk-2.0 -I/home/joncrall/.local/conda/envs/py36/lib/gtk-2.0/include -I/home/joncrall/.local/conda/envs/py36/include/pango-1.0 -I/home/joncrall/.local/conda/envs/py36/include/atk-1.0 -I/home/joncrall/.local/conda/envs/py36/include/cairo -I/home/joncrall/.local/conda/envs/py36/include/pixman-1 -I/home/joncrall/.local/conda/envs/py36/include/libpng16 -I/home/joncrall/.local/conda/envs/py36/include/gdk-pixbuf-2.0 -I/home/joncrall/.local/conda/envs/py36/include/libpng16 -I/home/joncrall/.local/conda/envs/py36/include -I/home/joncrall/.local/conda/envs/py36/include/pango-1.0 -I/home/joncrall/.local/conda/envs/py36/include/harfbuzz -I/home/joncrall/.local/conda/envs/py36/include/pango-1.0 -I/home/joncrall/.local/conda/envs/py36/include/glib-2.0 -I/home/joncrall/.local/conda/envs/py36/lib/glib-2.0/include -I/home/joncrall/.local/conda/envs/py36/include -I/home/joncrall/.local/conda/envs/py36/include/freetype2 -I/home/joncrall/.local/conda/envs/py36/include/libxml2 -I/home/joncrall/.local/conda/envs/py36/include -I/home/joncrall/.local/conda/envs/py36/include/libxml2 -I/home/joncrall/.local/conda/envs/py36/include -I/home/joncrall/.local/conda/envs/py36/include/freetype2 -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -L/home/joncrall/.local/conda/envs/py36/lib -Wl,-rpath,/home/joncrall/.local/conda/envs/py36/lib -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu conftest.c -lnsl   -L/home/joncrall/.local/conda/envs/py36/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype >&5
conftest.c: In function 'main':
conftest.c:35:1: warning: ignoring return value of 'system', declared with attribute warn_unused_result [-Wunused-result]
 system ("touch conf.gtktest");
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/joncrall/.local/conda/envs/py36/bin/../x86_64-conda_cos6-linux-gnu/sysroot/lib/librt.so.1: undefined reference to `__vdso_clock_gettime@GLIBC_PRIVATE'
collect2: error: ld returned 1 exit status

Any ideas on how to fix this and compile vim against anaconda with gui support?

@mingwandroid
Copy link

I attempted to get the required gtk libs in conda

We don't provide any gtk libs I'm afraid and do not offer support for packages from this mw channel.

@mingwandroid
Copy link

mingwandroid commented Apr 9, 2018

Your best bet for now would be to make 'CDT' packages from CentOS6's gtk suite and build against those and see what happens via:

conda skeleton rpm --distro=centos6 gtk-something-or-other --architecture=x86_64 --recursive

Then build those packages and add them to your requirements/build as - {{ cdt("gtk-something-or-other") }} (you need conda-build 3 for all this stuff).

Can vim be built with Qt? We do have pretty good Qt packages, that's probably a lot less hassle.

Otherwise, adding GTK (I'd go straight for 3 at least, but I don't know if that's ok for vim) to conda-forge would be an excellent endeavour.

@Erotemic
Copy link

Erotemic commented Apr 9, 2018

Can vim be built with Qt?

Unfortunately, no. The valid backends are: gtk2, gnome2, gtk3, motif, athena, neXtaw, photon, and carbon.

Otherwise, adding GTK (I'd go straight for 3 at least, but I don't know if that's ok for vim) to conda-forge would be an excellent endeavour

I'm relatively new to conda, and not much of a compile toolchain expert. I see tutorials for conda-build here: https://conda.io/docs/user-guide/tutorials/index.html so I'll look at those. Because I'll need to learn a lot to do that, I probably wont get to it anytime soon.

In the meantime, I'm just curious about a few things (sorry if a few of these are stupid questions):

  • I see that there are a lot of gtk2 packages if I search: https://anaconda.org/search?q=gtk2
    I see now that the -c argument specifies a user's custom channel. However, I see the package https://anaconda.org/anaconda/gtk2-cos6-x86_64 is this not gtk2 libraries? Is the anaconda channel not supported?

  • Why haven't the various existing gtk3 packages not been added to conda-forge? How would a package that I write be different?

  • I know what i686 and x86_64 are, but what is cos6?

  • In this comment you mention that your compilers are better than the gcc that ships with Ubuntu. Why?

@mingwandroid
Copy link

Well that's a lot of questions!

I see that there are a lot of gtk2 packages if I search: https://anaconda.org/search?q=gtk2
I see now that the -c argument specifies a user's custom channel

Since these come from users we are not able to guarantee much about them, esp. wrt binary compatibility with the packages we do build.

However, I see the package https://anaconda.org/anaconda/gtk2-cos6-x86_64 is this not gtk2 libraries?

cos6 == centos6 == the minimum OS-level we support for Linux. It is gtk2, but it is not an end-user package. It is installed into our cross-compiler's sysroot so that we know that the symbols we link to from it will be present on the 'real' (system provided) library on centos6 and any distro that is compatible with that.

Is the anaconda channel not supported?

Yes it is supported. I forgot I added this gtk2 package to it though, it could save you some work but I've never used it as a means to building something that depends on much of gtk2 at runtime, it is only a build-time dependency to ensure compatibility, in this case with Qt 5's style stuff I think.

Why haven't the various existing gtk3 packages not been added to conda-forge? How would a package that I write be different?

TIme and effort.

In this comment you mention that your compilers are better than the gcc that ships with Ubuntu. Why?

What do you mean by "Ubuntu"? Our compilers are different from a given distro's compilers in that they build software that will run on a fresh installation of CentOS6 (due to being pseudo-cross compilers and us providing CDT packages - the centos6 RPMs repackaged) but allow you to take advantage of C++11, 14 and 17 (due to being fairly modern).

I this case I meant better along both of these axes since the reporter was using devtoolset-6 (which comes with a lot of compromises IMHO).

@Erotemic
Copy link

Erotemic commented Apr 9, 2018

Thank you for your prompt responses! All of this makes sense.

For reference I was able to get gvim compiled and working using pkgw/label/superseded gtk3. The script I used to build is here:

    conda create -n vim80build python=3.6 gxx_linux-64 ncurses pkg-config autoconf automake cmake libtool gtk2-devel-cos6-x86_64 libx11-devel-cos6-x86_64 libiconv glib libxml2 libpng cairo
    conda activate vim80build

    conda install -c pkgw/label/superseded gtk3

    make distclean
    LDFLAGS="-L$CONDA_PREFIX/lib -Wl,-rpath,$CONDA_PREFIX/lib" ./configure --prefix=$CONDA_PREFIX --enable-pythoninterp=no --enable-python3interp=yes --enable-gui=gtk3 --with-local-dir==$CONDA_PREFIX
    cat src/auto/config.mk | grep GUI

    NCPUS=$(grep -c ^processor /proc/cpuinfo)
    make -j$NCPUS

It does spit out warning:

(gvim:30987): Gtk-WARNING **: GtkNotebook 0x5619c012f1c0 is mapped but visible child GtkEventBox 0x5619c032b190 is not mapped

The menubar does not appear, but that's not a huge deal for me. Its more of an annoyance than a showstopper. Thanks for your suggestion to use GTK3.

@mingwandroid
Copy link

Great news! Seems you took to this stuff and got up to speed very well.

It is worth asking @pkgw about the state of gtk3 on conda-forge too since his channel is marked as 'superseded' and he contributes to conda-forge these days.

Now if I can be so bold, you may want to consider making a conda package for conda-forge next?

@pkgw
Copy link

pkgw commented Apr 9, 2018

I should really write some docs about this at some point because I actually have users ...

My pkgw channel on Anaconda.org only derived from defaults Anaconda. It is now superseded by the pkgw-forge channel, which builds on conda-forge and is actively maintained. It includes a gtk3 package which has been updated relatively recently — many of the Gtk3 deps are making their way into conda-forge, but not all of them are there yet. I think it would be cool to see Gtk3 in conda-forge, but it has been a bit slow going as we talk out how to deal with the fact that both Gtk2 and Gtk3 are in use, and there are just a lot of deps needed to package.

@Erotemic
Copy link

Erotemic commented Apr 9, 2018

@pkgw I can install gtk3 using conda install -c pkgw/label/superseded gtk3, but this seems to be 3.14, whereas it would be nice to have a version > 3.2. The page associated with conda install -c pkgw-forge gtk3 says that its 3.22, but when I try running the command I get:

(py36) joncrall@acidalia:~/code/vim$ conda install -c pkgw-forge gtk3 
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - gtk3
  - at-spi2-atk=2.25
  - at-spi2-core=2.25
  - glib=2.55
  - gtk3
  - at-spi2-atk=2.25
  - at-spi2-core=2.25
  - gobject-introspection=1.55
  - gtk3
  - at-spi2-atk=2.25
  - at-spi2-core=2.25
  - xorg-libx11=1.6
  - gtk3
  - at-spi2-atk=2.25
  - at-spi2-core=2.25
  - xorg-libxi=1.7
  - gtk3
  - at-spi2-atk=2.25
  - at-spi2-core=2.25
  - xorg-libxtst=1.2
  - gtk3
  - at-spi2-atk=2.25
  - atk=2.25
  - gtk3
  - epoxy=1.4
  - gtk3
  - gdk-pixbuf=2.36
  - gtk3
  - xorg-libice=1.0
  - gtk3
  - xorg-libsm=1.2
  - gtk3
  - xorg-libxrender=0.9

Current channels:

  - https://conda.anaconda.org/pkgw-forge/linux-64
  - https://conda.anaconda.org/pkgw-forge/noarch
  - https://conda.anaconda.org/loopbio/linux-64
  - https://conda.anaconda.org/loopbio/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/free/linux-64
  - https://repo.anaconda.com/pkgs/free/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/pro/linux-64
  - https://repo.anaconda.com/pkgs/pro/noarch

I was trying to build vim without the conda compilers because they were breaking pytorch (which unfortunately requires on version of gcc < 7). However, I ran into an error and the solution I found requires gtk > 3.2


On related note, I've also had success building with gtk2 and without the conda compilers.
For reference the gtk2 script I used (after building a clean env) was

    conda install ncurses libx11-devel-cos6-x86_64 libiconv glib libxml2 libpng cairo

    conda config --add channels loopbio
    conda install gtk2

    make distclean
    LDFLAGS="-L$CONDA_PREFIX/lib -Wl,-rpath,$CONDA_PREFIX/lib" ./configure --prefix=$CONDA_PREFIX --enable-pythoninterp=no --enable-python3interp=yes --enable-gui=gtk2 --with-local-dir==$CONDA_PREFIX
    cat src/auto/config.mk | grep GUI

@pkgw
Copy link

pkgw commented Apr 9, 2018

@Erotemic So, yes, to install the pkgw-forge build of Gtk3, you'll also need to activate the conda-forge channel. As you may be aware, conda-forge provides rebuilds of virtually every package in the core Anaconda distribution (as well as many, many, more), so activating it generally causes all of your installed packages to be replaced. As it stands, if you want to use my Gtk3 package, you'll have to be OK with that.

@lazyjek
Copy link

lazyjek commented Apr 19, 2018

I came with such an issue today, and fixed it by doing so (after ./configure ...)

  1. conda install gxx_linux-64
  2. modifying vim/src/auto/config.mk : LDFLAGS = -L/user/local/lib -L${CONDA_PREFIX}/lib -Wl,--as-needed

@mingwandroid
Copy link

A better pattern/fix would be:

LDFLAGS ?=
LDFLAGS += -L/user/local/lib

.. because this will keep all of our other good LDFLAGS and also add the only one of yours that is different.

@sankao
Copy link

sankao commented Jun 3, 2020

A simple script, might be of interest for people who are not interested in messing with environments and compilers and don't particularly care about havin link-time optimization for vim (same as the disable lto comment early in the thread) :

export LDFLAGS="-fno-lto"
./configure --with-features=huge \
            --enable-multibyte \
            --enable-rubyinterp=yes \
            --enable-python3interp=yes \
            --with-python3-config-dir=$(python3-config --configdir) \
            --enable-perlinterp=yes \
            --enable-luainterp=yes \
            --enable-gui=gtk2 \
            --enable-cscope \
            --prefix=/usr/local

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

No branches or pull requests

7 participants