You are not logged in.

#1 2018-04-28 13:55:29

cuteclown
Guest

[SOLVED] Vim build fails

I want to step through the vim source to poke around in it and change the startup screen (when I start a new vim instance without specifying a source file, I want it to start to a clean, blank screen). Most messages on the opening screen can be removed by replacing the messages in the binary by spaces, but I can't get rid of the version this way. So I figured the only way to do this is to debug vim, step through the code, find out where the version is printed, and comment it out.

I removed vim (sudo pacman -Rdd vim) and did:

git clone https://github.com/vim/vim.git
cd vim
make
sudo make install
sudo cp /usr/local/bin/vim /usr/bin/vim

Compiling took a while, but everything worked perfectly. Then I installed gdb, tried running it. It complained it needed mpfr, so I installed it ("sudo pacman -S mpfr"), and gdb worked. Now, I try debugging vim which works -- but I forgot to compile with debugging symbols. From '' I read: "", so I search through vim/src/Makefile to find line 592:

#CFLAGS = -g

I uncomment it and try to compile again. Oddly, I can no longer compile (mind you, I succesfully compiled vim only minutes before). Even weirder, I can no longer get vim to compile. I re-cloned the repo, leaving the Makefile as is, and configure gives me:

checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/ruben/vim/src':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[1]: *** [Makefile:1873: config] Error 77
make[1]: Leaving directory '/home/ruben/vim/src'
make: *** [Makefile:1899: reconfig] Error 2

However, there seems to be no config.log file, so I can't figure out the problem. I tried removing the mpfr package to see if that was the problem, but this didn't help. Any help is welcome!

Edit: I was moving on to compiling some other project which required Cmake. When I run "cmake .." from within a build folder, it gave me the same error for libmpfr.so.4, So it seems that I messed up the mpfr library. If I remember correctly, gdb was complaining that the mpfr.so.6 was missing, while cmake complains about mpfr.so.4 (and this might be the reason that vim fails to build as well). I think this is quite a common problem, and I'll try to solve it by myself (one notable problem before was that the config.log was missing - and I still haven't figured the reason for this).

Edit 2: Symlinking libmpfr.so.4 to libmpfr.so.6 works. I think this is not the recommended solution though... I have to spend some more time on this.

Edit 3: GDB was not really necessary after all! After commenting out line 4871 in version.c (which calls do_intro_line(...)), vim starts with a nice and clean screen smile

Last edited by cuteclown (2018-05-13 12:13:10)

#2 2018-04-28 16:34:32

CPlusPandaGives
Member
From: United Kingdom
Registered: 2017-03-07
Posts: 11

Re: [SOLVED] Vim build fails

Has your issue been fixed now? If not, can you clarify your the exact issue you're facing. I'm probably misreading what you have written in some way.

Offline

#3 2018-04-28 16:59:55

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [SOLVED] Vim build fails

@OP - Have you tried building a clean chroot?  Since configure is looking in your homedir I suspect you are compiling by hand.  I highly recommend that you use the PKGBUILD which builds fine for me.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2018-05-08 09:19:44

cuteclown
Guest

Re: [SOLVED] Vim build fails

Sorry for the late reply. I have re-enabled my email notifications to make sure I won't miss replies in the future.

graysky wrote:

@OP - Have you tried building a clean chroot?  Since configure is looking in your homedir I suspect you are compiling by hand.  I highly recommend that you use the PKGBUILD which builds fine for me.

I did build by hand! I'm actually not sure if I also tried to use makepkg to build it (I usually do, and I think I tried it as well but got the same error. Ugh, I wish my memory was better. I might try to check this later when I get home).

CPlusPandaGives wrote:

Has your issue been fixed now? If not, can you clarify your the exact issue you're facing. I'm probably misreading what you have written in some way.

The issue has been fixed, yes!

I found that after updating mpfr via pacman, I could no longer compile vim. One step in the build process of vim is to run the 'configure' command. Doing this gave me the error I quoted in my first post. What prevented me from finding out what was going on, was that there was no config.log being created - and I still haven't figured out the reason for this. When I gave up and tried to compile some other project which used Cmake, I did get an error message indicating that libmpfr.so.4 was missing. So I simply symlinked libmpfr.so.4 to libmpfr.so.6, which fixed the issues (although I have the idea that this kind of symlinking is a hacky way to make things work).

Last edited by cuteclown (2018-05-08 09:21:21)

#5 2018-05-08 18:25:58

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Vim build fails

Absolutely no!

If libmpfr.so.6 was a valid way to get libmpfr.so.4, then why do you think the developers explicitly changed the filename in an attempt to stop you from doing that???

Clean your build directory of configure caches, using git clean -idx
Then retry.

You might be confused about where that configure cache is, since vim comes with a ./configure script which cd's into the src directory then runs the ./configure script in there, whhich then does the same thing again for the auto directory. So you're really configuring in https://github.com/vim/vim/tree/master/src/auto

cuteclown wrote:

(although I have the idea that this kind of symlinking is a hacky way to make things work).

You're getting "undefined behavior", so yeah, that's pretty horrible. There's literally no telling what might happen. Maybe nothing, maybe it'll eat your files instead of saving them, maybe it'll crash, maybe it'll do all three of these depending on which features of vim you use that day.

Last edited by eschwartz (2018-05-08 18:30:32)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2018-05-09 12:22:36

cuteclown
Guest

Re: [SOLVED] Vim build fails

Eschwartz wrote:

Absolutely no!

If libmpfr.so.6 was a valid way to get libmpfr.so.4, then why do you think the developers explicitly changed the filename in an attempt to stop you from doing that???

Clean your build directory of configure caches, using git clean -idx
Then retry.

You might be confused about where that configure cache is, since vim comes with a ./configure script which cd's into the src directory then runs the ./configure script in there, whhich then does the same thing again for the auto directory. So you're really configuring in https://github.com/vim/vim/tree/master/src/auto

cuteclown wrote:

(although I have the idea that this kind of symlinking is a hacky way to make things work).

You're getting "undefined behavior", so yeah, that's pretty horrible. There's literally no telling what might happen. Maybe nothing, maybe it'll eat your files instead of saving them, maybe it'll crash, maybe it'll do all three of these depending on which features of vim you use that day.

I'll readily admit that I have no clue what I was doing. Luckily I haven't ran into disappearing files or crashes yet -- not that I have important information on the system. I guess I broke things by updating the mpfr shared library between running configure without cleaning the configure cache?

Anyway, thanks for the help, will try this tonight!

#7 2018-05-09 14:29:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] Vim build fails

Is there any reason you are not just working with the PKGBUILD from the ABS if you really need to rebuild vim?

More importantly, do you need to rebuild it.  There are any number of autocommands that could prevent the startup message.  For example, this short excerpt added to your vimrc will work as long as you don't mind a new buffer starting with a single newline:

fun! Start()
        if argc() || line2byte('$') != -1 || v:progname !~? '^[-gmnq]\=vim\=x\=\%[\.exe]$' || &insertmode
                return
        endif
        call append('$',"")
        set nomod
endfun
autocmd VimEnter * call Start()

If you want to avoid even having that newline stick around:

fun! Start()
        if argc() || line2byte('$') != -1 || v:progname !~? '^[-gmnq]\=vim\=x\=\%[\.exe]$' || &insertmode
                return
        endif
        setlocal bufhidden=delete
        call append('$',"")
        set nomod
        nnoremap <buffer><silent> i :enew <bar> startinsert<CR>
        nnoremap <buffer><silent> o :enew <bar> startinsert<CR>
endfun
autocmd VimEnter * call Start()

Last edited by Trilby (2018-05-09 14:29:36)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2018-05-09 16:53:13

cuteclown
Guest

Re: [SOLVED] Vim build fails

Trilby wrote:

Is there any reason you are not just working with the PKGBUILD from the ABS if you really need to rebuild vim?

That *does* sound like an easier option! Awesome!

Ehm, does it sound believable if I say I wanted to build vim for educational purposes? wink

Last edited by cuteclown (2018-05-09 16:54:06)

#9 2018-05-09 17:41:38

Batou
Member
Registered: 2017-01-03
Posts: 259

Re: [SOLVED] Vim build fails

cuteclown wrote:

I want it to start to a clean, blank screen). Most messages on the opening screen can be removed by replacing the messages in the binary by spaces, but I can't get rid of the version this way. So I figured the only way to do this is to debug vim, step through the code, find out where the version is printed, and comment it out.

Am I missing something but can't the startup message be easily avoided with an option in your .vimrc?

 set shortmess=atI 

... and all you'll have is tildas and cursor position. You can further simplify the display too by looking at line options (to remove tildas).


Please vote for all the AUR packages you're using. You can mass-vote for all of them by doing: "pacman -Qqm | xargs aurvote -v" (make sure to run "aurvote --configure"  first)

Offline

#10 2018-05-09 19:22:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] Vim build fails

That shortmess setting is *much* better than my options, nevermind my previous suggestion.  I had found the shortmess option before, but when I tried it previously it didn't seem to actually work.  Now the setting above does the job.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#11 2018-05-13 09:52:25

cuteclown
Guest

Re: [SOLVED] Vim build fails

Thanks for dealing with my ignorance, folks wink The issue is solved. Actually, the wiki is very clear on this (the problem was more that I didn't know where to look). From System maintenance:

If a partial upgrade scenario has been created, and binaries are broken because they cannot find the libraries they are linked against, do not "fix" the problem simply by symlinking. Libraries receive soname bumps when they are not backwards compatible. A simple pacman -Syu to a properly synced mirror will fix the problem as long as pacman is not broken.

And indeed this did fix the compilation error. I found the answer in this thread.

Batou wrote:
cuteclown wrote:

I want it to start to a clean, blank screen). Most messages on the opening screen can be removed by replacing the messages in the binary by spaces, but I can't get rid of the version this way. So I figured the only way to do this is to debug vim, step through the code, find out where the version is printed, and comment it out.

Am I missing something but can't the startup message be easily avoided with an option in your .vimrc?

 set shortmess=atI 

... and all you'll have is tildas and cursor position. You can further simplify the display too by looking at line options (to remove tildas).

Nice, that is probably the best answer to my original question!


Edit: For clarity, this was the problem I had before. It is now solved after upgrading (doing "sudo pacman -Syu").

I was compiling the bare git repository because I couldn't find the vim package in the Arch user repository. It's named vim-git (I just searched for vim, which returns 499 results, none of them named 'vim'). I removed the symlink from libmpfr.so.4 to libmpfr.so.6 and tried again.

$ git clone https://aur.archlinux.org/vim-git.git
$ cd vim-git && makepkg -si

Then I still get error messages:

==> Starting build()...
configure: creating cache auto/config.cache
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/ruben/vim-git/src/vim/src':
configure: error: C compiler cannot create executables
See `config.log' for more details
==> ERROR: A failure occurred in build().
    Aborting...

The src/vim/src/auto/config.log file I couldn't find before now contains:

[...]
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir
=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared -
-enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clo
cale=gnu --disable-libstdcxx-pch --disable-libssp --en
able-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 7.2.0 (GCC) 
configure:2992: $? = 0
configure:2981: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2992: $? = 1
configure:2981: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:2992: $? = 1
configure:3012: checking whether the C compiler works
configure:3034: gcc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now conftest.c  >&5
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
configure:3038: $? = 1
configure:3076: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define UNIX 1
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3081: error: in `/home/ruben/vim-git/src/vim/src':
configure:3083: error: C compiler cannot create executables
See `config.log' for more details
[...]

Last edited by cuteclown (2018-12-01 23:01:56)

#12 2018-05-13 09:56:03

loqs
Member
Registered: 2014-03-06
Posts: 17,196

Re: [SOLVED] Vim build fails

Please use code tags not quote tags.  Why is gcc on version 7.2 instead of 8.1?

Offline

#13 2018-05-13 10:16:32

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: [SOLVED] Vim build fails

configure: error: in `/home/ruben/vim-git/src/vim/src':
configure: error: C compiler cannot create executables

Do you have a /home partition mounted with the noexec flag? You have to build in a directory where you can create executable files.

Edit: Somehow I was blind and missed the obvious library error even though I read the log twice. Thanks loqs for the correction.

Last edited by progandy (2018-05-13 12:35:33)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#14 2018-05-13 10:20:20

loqs
Member
Registered: 2014-03-06
Posts: 17,196

Re: [SOLVED] Vim build fails

@progandy see the config.log the compiler checks beauce of

configure:3012: checking whether the C compiler works
configure:3034: gcc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now conftest.c  >&5
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory

gcc 7.2 but no matching mpfr

Offline

#15 2018-05-13 11:30:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] Vim build fails

Trilby wrote:

Is there any reason you are not just working with the PKGBUILD from the ABS

cuteclown wrote:

I was compiling the bare git repository because I couldn't find the vim package in the Arch user repository. It's named vim-git

ABS != AUR

The ABS has the PKGBUILDs for packages in the main repos.  The AUR, by definition, has PKGBUILDs for things that are not in the repos (and also does not have PKGBUILDs for things that are in the repos, e.g., vim).

https://wiki.archlinux.org/index.php/Arch_Build_System


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#16 2018-05-13 12:03:38

cuteclown
Guest

Re: [SOLVED] Vim build fails

Trilby wrote:
Trilby wrote:

Is there any reason you are not just working with the PKGBUILD from the ABS

cuteclown wrote:

I was compiling the bare git repository because I couldn't find the vim package in the Arch user repository. It's named vim-git

ABS != AUR

The ABS has the PKGBUILDs for packages in the main repos.  The AUR, by definition, has PKGBUILDs for things that are not in the repos (and also does not have PKGBUILDs for things that are in the repos, e.g., vim).

https://wiki.archlinux.org/index.php/Arch_Build_System

Ahhh, that explains a lot. I didn't even notice that you didn't write AUR.


loqs wrote:

Please use code tags not quote tags.  Why is gcc on version 7.2 instead of 8.1?

I fixed the tags (I thought quotes were more appropriate, since I was quoting console output, not code, but OK). I probably just didn't update my system since version gcc 7.2.

Board footer

Powered by FluxBB