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

Perl interface cannot use strawberry perl #328

Closed
GoogleCodeExporter opened this issue Aug 18, 2015 · 13 comments
Closed

Perl interface cannot use strawberry perl #328

GoogleCodeExporter opened this issue Aug 18, 2015 · 13 comments

Comments

@GoogleCodeExporter
Copy link

I'm using 64bit win7, with 64bit strawberry perl installed.

When I want to build vim with perl support, I can't go on with it.

command line features:

nmake -f Make_mvc.mak CPU=AMD64 GUI=yes OLE=yes PERL=D:\perl\StrawberryPerl 
DYNAMIC_PERL=yes PERL_VER=518 PYTHON=%TOOLDIR%python\python27 
DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python\python33 
DYNAMIC_PYTHON3=yes PYTHON3_VER=33  %1 IME=yes CSCOPE=yes

Doesn't work.

ActivePerl is OK with building. But official perl website says that Strawberry 
Perl is full-featured open-source perl on windows.

Original issue reported on code.google.com by universe...@gmail.com on 10 Feb 2015 at 7:56

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

In what way doesn't it work? Does it give an error while compiling? Or does it 
compile and give an error in Vim? Or something else? What specific error, if 
any?

Original comment by fritzoph...@gmail.com on 10 Feb 2015 at 5:49

@fritzophrenic
Copy link
Contributor

You did not specify what compiler you are using.

I'm seeing this issue when using Visual Studio and attempting to compile with Strawberry Perl:

c:\strawberry\perl\lib\core\handy.h(77) : fatal error C1083: Cannot open include file: 'stdbool.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\x86_amd64\cl.EXE"' : return code '0x2'
Stop.

It looks like older Visual Studio compilers simply do not support stdbool.

So maybe this is a compiler issue, and the solution is to use a different compiler (e.g. MinGW)?

Alternatively, Vim could provide a stdbool for use with the Visual Studio builds (and only the Visual Studio builds).

@fritzophrenic
Copy link
Contributor

I have worked around the compiler issue in the meantime, by editing my personal build script that wraps Vim's make and install, to create a temporary stdbool.h in the src directory before building, and delete it afterward.

This lets Vim compile, and :echo has('perl') even returns 1, but :perl print "hello\n" crashes Vim. So something's still not right.

@jamessan
Copy link
Contributor

So maybe this is a compiler issue, and the solution is to use a different compiler (e.g. MinGW)?

Alternatively, Vim could provide a stdbool for use with the Visual Studio builds (and only the Visual Studio builds).

I think using the same compiler that Strawberry Perl was built with is the right choice. There are various build-time decisions made based on the compiler which, as we see here, affect code trying to embed Perl.

Adding a stub for a system header to Vim doesn't sound right.

@k-takata
Copy link
Member

I think updating Visual Studio to 2013 or later is a easy way in this case.

Another option is patching config.h in the perl directory:

--- lib/CORE/config.h.orig  2014-06-06 22:36:37.584537600 +0900
+++ lib/CORE/config.h   2014-06-07 18:26:35.765691900 +0900
@@ -4290,7 +4290,7 @@
  * This symbol, if defined, indicates that <stdbool.h> exists and
  * can be included.
  */
-#define    I_STDBOOL       /**/
+/*#define  I_STDBOOL       / **/

 /* I_SUNMATH:
  * This symbol, if defined, indicates that <sunmath.h> exists and

@mattn
Copy link
Member

mattn commented Sep 11, 2015

I suggest to put win32/stdbool.h that is empty file.

@fritzophrenic
Copy link
Contributor

Ouch. I tried again with ActiveState Perl (64-bit), and that also fails to find stdbool.h. And not everyone can upgrade their Visual Studio. So something needs doing for this on the Vim side I think.

I don't like win32/stdbool.h as a solution; isn't that also used by MinGW builds which presumably don't have this problem?

At least ActiveState doesn't crash Vim when trying to use the Perl interface after the "create a stdbool" workaround.

@k-takata
Copy link
Member

I suggest to put win32/stdbool.h that is empty file.

An empty stdbool.h doesn't fix the problem, because obviously it lacks definition of bool.
The minimal version of the fake stdbool.h is:

#define bool char

but I don't like this.

And not everyone can upgrade their Visual Studio.

Then he/she should patch lib/CORE/config.h.

@fritzophrenic
Copy link
Contributor

On Wed, Sep 16, 2015 at 12:52 PM, K.Takata notifications@github.com wrote:

I suggest to put win32/stdbool.h that is empty file.

An empty stdbool.h doesn't fix the problem, because obviously it lacks definition of bool.
The minimal version of the fake stdbool.h is:

#define bool char

but I don't like this.

And not everyone can upgrade their Visual Studio.

Then he/she should patch lib/CORE/config.h.

OK, I broke down and tried the suggested patch to Perl's config.h file.

It worked (for both ActiveState AND Strawberry)! As in, not only does it
compile, it also doesn't crash!

The other workarounds (defining a stdbool of some kind) create a Perl
interface that crashes on use.

Is there anything Vim can do about this? Maybe just putting it in the help
somewhere, or some sort of #error that suggests a fix, or something? Or
will this just need to be "tribal knowledge"?

@mattn
Copy link
Member

mattn commented Sep 17, 2015

but I don't like this.

And not everyone can upgrade their Visual Studio.
Then he/she should patch lib/CORE/config.h.

Most of users, or distributors aren't know/understand why the patching is required. This is a way to avoid to modify header file in perl.

@k-takata
Copy link
Member

The other workarounds (defining a stdbool of some kind) create a Perl interface that crashes on use.

I suppose you might define bool wrongly.

Note:

sizeof(BOOL) == 4    // Win32
sizeof(_Bool) == 1   // VC++12 or later (C99)
sizeof(bool) == 1    // VC++5 or later (C++)
sizeof(bool) == 4    // VC++4 or earlier (C++)

@k-takata
Copy link
Member

OK, I wrote a patch based on the mattn's idea.
https://bitbucket.org/k_takata/vim-ktakata-mq/src/65b664c6eaf4d1e70f81edd87719ade325c0849f/if_perl_vc2012.patch
(Maybe Filelist should be updated, but this patch doesn't include it.)

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

No branches or pull requests

5 participants