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

some packages run wine #841

Closed
starius opened this Issue Sep 10, 2015 · 14 comments

Comments

Projects
None yet
2 participants
@starius
Member

starius commented Sep 10, 2015

Many packages include configure step, which can run wine (from gtkimageview's log):

configure:2945: checking for C compiler default output file name
configure:2967: i686-w64-mingw32.static-gcc    conftest.c  >&5
configure:2971: $? = 0
configure:3009: result: a.exe
configure:3026: checking whether the C compiler works
configure:3036: ./a.exe
configure:3040: $? = 0
configure:3057: result: yes
configure:3064: checking whether we are cross compiling
configure:3066: result: no

On other machine (without wine):

configure:2945: checking for C compiler default output file name
configure:2967: i686-w64-mingw32.static-gcc    conftest.c  >&5
configure:2971: $? = 0
configure:3009: result: a.exe
configure:3026: checking whether the C compiler works
configure:3036: ./a.exe
./configure: line 3038: ./a.exe: cannot execute binary file: Exec format error
configure:3040: $? = 126
configure:3057: result: yes
configure:3064: checking whether we are cross compiling
configure:3066: result: yes

Existence of wine affects the value of whether we are cross compiling.

I know that MXE doesn't use wine. Can we force this policy by disabling wine even if it exists when building?

@tonytheodore

This comment has been minimized.

Member

tonytheodore commented Sep 12, 2015

Can we force this policy by disabling wine even if it exists when building?

AFAIK no. Something about the way wine is installed means you can't easily disable it for a single session or invocation. In the past, explicitly setting ac_cv_build and --build bypassed the detection but maybe something has changed in more recent autotools.

@tonytheodore

This comment has been minimized.

Member

tonytheodore commented Sep 12, 2015

Can you post the full logs of both to see if there's any real change in what is detected?

@starius

This comment has been minimized.

Member

starius commented Sep 12, 2015

@tonytheodore

This comment has been minimized.

Member

tonytheodore commented Sep 23, 2015

It was created by gtkimageview configure 1.6.4, which was
generated by GNU Autoconf 2.62.

It think re-creating configure with a recent autoconf will fix the message (and I'm pretty sure it's only a harmless message).

@starius

This comment has been minimized.

Member

starius commented Sep 23, 2015

Using WINEPREFIX=/ breaks wine for non-root users.

$ ./usr/i686-w64-mingw32.static/bin/test-lua.exe
Application tried to create a window, but no driver could be loaded.
Make sure that your X server is running and that $DISPLAY is set correctly.
err:systray:initialize_systray Could not create tray window
$ echo $?
0

$ WINEPREFIX=/ ./usr/i686-w64-mingw32.static/bin/test-lua.exe
wine: / is not owned by you
$ echo $?
1

See http://wiki.winehq.org/FAQ#wineprefix

Maybe we should set WINEPREFIX=/ for build tasks.

@tonytheodore

This comment has been minimized.

Member

tonytheodore commented Sep 24, 2015

Maybe we should set WINEPREFIX=/ for build tasks.

That would be ideal. Can you check if setting it in the Makefile is sufficient or if it needs to be done individually for packages?

@starius

This comment has been minimized.

Member

starius commented Sep 24, 2015

I'm checking the build with the following patch:

diff --git a/Makefile b/Makefile
index b0acd09..80c2def 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,7 @@ PKGS       := $(call set_create,\
     $(shell $(SED) -n 's/^.* class="package">\([^<]*\)<.*$$/\1/p' '$(TOP_DIR)/index.html'))
 BUILD      := $(shell '$(EXT_DIR)/config.guess')
 PATH       := $(PREFIX)/$(BUILD)/bin:$(PREFIX)/bin:$(PATH)
+WINEPREFIX := .

 # All pkgs have (implied) order-only dependencies on MXE_CONF_PKGS.
 # These aren't meaningful to the pkg list in index.html so
@@ -130,7 +131,7 @@ define MXE_GET_GITHUB_SHA
 endef

 # use a minimal whitelist of safe environment variables
-ENV_WHITELIST := PATH LANG MAKE% MXE% %PROXY %proxy LD_LIBRARY_PATH ACLOCAL_PATH
+ENV_WHITELIST := PATH LANG MAKE% MXE% %PROXY %proxy LD_LIBRARY_PATH ACLOCAL_PATH WINEPREFIX
 unexport $(filter-out $(ENV_WHITELIST),$(shell env | cut -d '=' -f1))

 SHORT_PKG_VERSION = \

Is it the right place to add environment variables?

UPD. Path / was replaced with .. Wine doesn't like non-absolute paths:

$ WINEPREFIX=. ./usr/i686-w64-mingw32.static/bin/test-lua.exe
wine: invalid directory . in WINEPREFIX: not an absolute path

Path / may be writable for the user. I think, setting path to . is more reliable.

@tonytheodore

This comment has been minimized.

Member

tonytheodore commented Sep 24, 2015

Is it the right place to add environment variables?

I'd probably add export WINEPREFIX := ... under the unexport line and not add it to the whitelist.

Path / may be writable for the user. I think, setting path to . is more reliable.

Can something like /dev/null work? Should fail for everyone.

@starius

This comment has been minimized.

Member

starius commented Sep 24, 2015

WINEPREFIX=. doesn't work. Wine is executed somehow...

configure:2945: checking for C compiler default output file name
configure:2967: i686-w64-mingw32.static-gcc    conftest.c  >&5
configure:2971: $? = 0
configure:3009: result: a.exe
configure:3026: checking whether the C compiler works
configure:3036: ./a.exe
configure:3040: $? = 0
configure:3057: result: yes
configure:3064: checking whether we are cross compiling
configure:3066: result: no
configure:3069: checking for suffix of executables
configure:3076: i686-w64-mingw32.static-gcc -o conftest.exe    conftest.c  >&5
Application tried to create a window, but no driver could be loaded.
Make sure that your X server is running and that $DISPLAY is set correctly.
err:systray:initialize_systray Could not create tray window
@tonytheodore

This comment has been minimized.

Member

tonytheodore commented Sep 25, 2015

Does something like this readonly directory work?

@tonytheodore

This comment has been minimized.

Member

tonytheodore commented Sep 25, 2015

Actually $(INSTALL) -m444 -d "$$WINEPREFIX" is better to ensure we have the shell variable.

@starius

This comment has been minimized.

Member

starius commented Sep 25, 2015

UPD. My first commit doesn't work, but this commit does work for some packages:

diff --git a/Makefile b/Makefile
index b0acd09..173cdf5 100644
--- a/Makefile
+++ b/Makefile
@@ -132,6 +132,8 @@ endef
 # use a minimal whitelist of safe environment variables
 ENV_WHITELIST := PATH LANG MAKE% MXE% %PROXY %proxy LD_LIBRARY_PATH ACLOCAL_PATH
 unexport $(filter-out $(ENV_WHITELIST),$(shell env | cut -d '=' -f1))
+# disable wine, see https://github.com/mxe/mxe/issues/841
+export WINEPREFIX := /dev/null

 SHORT_PKG_VERSION = \
     $(word 1,$(subst ., ,$($(1)_VERSION))).$(word 2,$(subst ., ,$($(1)_VERSION)))

Log:

configure:3103: ./a.exe
wine: /dev/null is not a directory
configure:3107: $? = 1
configure:3122: result: yes
configure:3129: checking whether we are cross compiling
configure:3131: result: yes

I am waiting for gtkimageview (because initial tests were on that package) and then switch to testing your commit with read-only dir and $(INSTALL) -m444 -d "$$WINEPREFIX".

@starius

This comment has been minimized.

Member

starius commented Sep 25, 2015

Works for gtkimageview. Testing your patch...

@starius

This comment has been minimized.

Member

starius commented Sep 25, 2015

It works!

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