Bug 110939 - src/egl/main/egldisplay.c: In function '_eglGetNativePlatform': error: '_EGL_PLATFORM_' undeclared
Summary: src/egl/main/egldisplay.c: In function '_eglGetNativePlatform': error: '_EGL...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: EGL (show other bugs)
Version: 19.0
Hardware: ARM Linux (All)
: medium normal
Assignee: Tapani Pälli
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-18 09:04 UTC by Rolf Eike Beer
Modified: 2019-06-24 05:55 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
add check for empty egl_platform (886 bytes, patch)
2019-06-18 11:04 UTC, Tapani Pälli
Details | Splinter Review

Description Rolf Eike Beer 2019-06-18 09:04:50 UTC
When building with meson this fails:

arm-unknown-linux-gnueabi-gcc -Isrc/egl/src@egl@@EGL@sha -Isrc/egl -I../mesa-19.0.6/src/egl -Iinclude -I../mesa-19.0.6/include -I../mesa-19.0.6/include/drm-uapi -Isrc -I../mesa-19.0.6/src -I../mesa-19.0.6/src/egl/main -Isrc/loader -I../mesa-19.0.6/src/loader -Isrc/gbm -I../mesa-19.0.6/src/gbm -I../mesa-19.0.6/src/gbm/main -I../mesa-19.0.6/src/gbm/backends/dri -I../mesa-19.0.6/src/egl/../gbm/main -I/opt/emlix/test/sysroot/usr/include/libdrm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c99 -O2 -g -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="19.0.6"' '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa"' -DGLX_USE_TLS -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_X11_PLATFORM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DHAVE_DRM_PLATFORM -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -D_GNU_SOURCE -DUSE_GCC_ATOMIC_BUILTINS -DMAJOR_IN_SYSMACROS -DHAVE_SYS_SYSCTL_H -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_POSIX_MEMALIGN -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -fno-math-errno -fno-trapping-math -Wno-missing-field-initializers -Wno-format-truncation -fPIC -pthread -fvisibility=hidden -DHAVE_MINCORE -D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_  -MD -MQ 'src/egl/src@egl@@EGL@sha/main_egldisplay.c.o' -MF 'src/egl/src@egl@@EGL@sha/main_egldisplay.c.o.d' -o 'src/egl/src@egl@@EGL@sha/main_egldisplay.c.o' -c ../mesa-19.0.6/src/egl/main/egldisplay.c
+../mesa-19.0.6/src/egl/main/egldisplay.c: In function '_eglGetNativePlatform':
+<command-line>: error: '_EGL_PLATFORM_' undeclared (first use in this function); did you mean '_EGL_PLATFORM_DRM'?
+<command-line>: note: in definition of macro '_EGL_NATIVE_PLATFORM'
+<command-line>: note: each undeclared identifier is reported only once for each function it appears in
+<command-line>: note: in definition of macro '_EGL_NATIVE_PLATFORM'

And indeed, the define is different when building with autotools:

libtool: compile:  arm-unknown-linux-gnueabi-gcc -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"19.0.6\" "-DPACKAGE_STRING=\"Mesa 19.0.6\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"19.0.6\" -D_FILE_OFFSET_BITS=64 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE___BUILTIN_BSWAP32=1 -DHAVE___BUILTIN_BSWAP64=1 -DHAVE___BUILTIN_CLZ=1 -DHAVE___BUILTIN_CLZLL=1 -DHAVE___BUILTIN_CTZ=1 -DHAVE___BUILTIN_EXPECT=1 -DHAVE___BUILTIN_FFS=1 -DHAVE___BUILTIN_FFSLL=1 -DHAVE___BUILTIN_POPCOUNT=1 -DHAVE___BUILTIN_POPCOUNTLL=1 -DHAVE___BUILTIN_UNREACHABLE=1 -DHAVE_FUNC_ATTRIBUTE_CONST=1 -DHAVE_FUNC_ATTRIBUTE_FLATTEN=1 -DHAVE_FUNC_ATTRIBUTE_FORMAT=1 -DHAVE_FUNC_ATTRIBUTE_MALLOC=1 -DHAVE_FUNC_ATTRIBUTE_PACKED=1 -DHAVE_FUNC_ATTRIBUTE_PURE=1 -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL=1 -DHAVE_FUNC_ATTRIBUTE_UNUSED=1 -DHAVE_FUNC_ATTRIBUTE_VISIBILITY=1 -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1 -DHAVE_FUNC_ATTRIBUTE_WEAK=1 -DHAVE_FUNC_ATTRIBUTE_ALIAS=1 -DHAVE_FUNC_ATTRIBUTE_NORETURN=1 -DMAJOR_IN_SYSMACROS=1 -DHAVE_ENDIAN_H=1 -DHAVE_DLADDR=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -I. -I../../../xorg.Mesa3D/src/egl -I../../../xorg.Mesa3D/include -I../../../xorg.Mesa3D/include/drm-uapi -I../../../xorg.Mesa3D/src/mapi -I../../../xorg.Mesa3D/src/egl/main -I../../../xorg.Mesa3D/src/gbm/main -I../../../xorg.Mesa3D/src -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -DUSE_GCC_ATOMIC_BUILTINS -DNDEBUG -DUSE_ARM_ASM -DHAVE_SYS_SYSCTL_H -DHAVE_DLFCN_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_STRTOD_L -DHAVE_DL_ITERATE_PHDR -DHAVE_POSIX_MEMALIGN -DHAVE_ZLIB -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LINUX_FUTEX_H -DHAVE_LIBDRM -DGLX_USE_DRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_DRM_PLATFORM -DHAVE_X11_PLATFORM -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -DENABLE_SHADER_CACHE -DHAVE_MINCORE -fvisibility=hidden -I/opt/emlix/test/sysroot/usr/include/libdrm -D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_DRM -I../../../xorg.Mesa3D/src/loader -I../../src/egl/drivers/dri2 -I../../../xorg.Mesa3D/src/egl/drivers/dri2 -I../../../xorg.Mesa3D/src/gbm/backends/dri -I../../src/egl/wayland/wayland-drm -I../../../xorg.Mesa3D/src/egl/wayland/wayland-drm -O2 -g -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -pipe -Wl,--no-copy-dt-needed-entries,--as-needed -Wl,--build-id -Wdate-time -std=c99 -MT main/egldisplay.lo -MD -MP -MF main/.deps/egldisplay.Tpo -c ../../../xorg.Mesa3D/src/egl/main/egldisplay.c  -fPIC -DPIC -o main/.libs/egldisplay.o
Comment 1 Tapani Pälli 2019-06-18 10:23:25 UTC
Can you include also information how did you configure the meson build? I think you should get this to work by at least having one platform defined, as example by setting "-Dplatforms=x11".
Comment 2 Rolf Eike Beer 2019-06-18 10:25:32 UTC
meson --cross-file /opt/emlix/master/etc/meson-cross-file.txt --buildtype debugoptimized --prefix=/usr --sysconfdir=/etc -Ddri-drivers=swrast -Dgallium-drivers= -Dllvm=false -Dopengl=true -Dplatforms=,drm,x11 ../xorg.Mesa3
Comment 3 Tapani Pälli 2019-06-18 10:34:34 UTC
Right, it's the empty option given there: "-Dplatforms=,drm,x11", remove the first ',' and that should fix your issue.
Comment 4 Rolf Eike Beer 2019-06-18 10:35:09 UTC
It happens because of the leading ',' in platforms, which did not create a problem until now. I still think this should be caught instead of generating an invalid setup.
Comment 5 Tapani Pälli 2019-06-18 10:42:47 UTC
(In reply to Rolf Eike Beer from comment #4)
> It happens because of the leading ',' in platforms, which did not create a
> problem until now. I still think this should be caught instead of generating
> an invalid setup.

I don't see why someone would do that as it's not how we document at https://www.mesa3d.org/meson.html. But fair enough, I guess the build could error out if such given.
Comment 6 Rolf Eike Beer 2019-06-18 10:45:27 UTC
It was the result of an automatic selection step that went slightly wrong, i.e. it was a variable containing " x11 drm" and the replaced all spaces with ',' without trimming first.
Comment 7 Tapani Pälli 2019-06-18 11:03:19 UTC
Why it does not error is that platforms list 'choices' includes empty string '' (meson_options.txt), I'm not sure if there's a good reason for that. We could alternatively remove the '' from choices or add explicit check that the first platform is not empty.
Comment 8 Tapani Pälli 2019-06-18 11:04:08 UTC
Created attachment 144586 [details] [review]
add check for empty egl_platform

Here's a fix proposal.
Comment 9 Rolf Eike Beer 2019-06-18 11:25:50 UTC
Comment on attachment 144586 [details] [review]
add check for empty egl_platform

LGTM
Comment 10 Rolf Eike Beer 2019-06-18 11:28:46 UTC
I wonder if the check should not be the other way round: it should check that the default platform is in a list of platforms known to work, that way it would also catch typos that could lead to equally strange messages.
Comment 11 Tapani Pälli 2019-06-18 11:38:16 UTC
(In reply to Rolf Eike Beer from comment #10)
> I wonder if the check should not be the other way round: it should check
> that the default platform is in a list of platforms known to work, that way
> it would also catch typos that could lead to equally strange messages.

I thought of that but that case is actually handled already, you can test this my putting some bogus platform name there. Meson automatically checks which choices are possible for the option, see 'choices' in meson_options.txt.
Comment 12 Eric Engestrom 2019-06-19 12:22:07 UTC
FWIW the empty string thing is a know issue that will be fixed once we bump our requirement to meson 0.47; the MR has been around for a while:
https://gitlab.freedesktop.org/mesa/mesa/merge_requests/386

But yeah, until we can do that it's not a bad idea to add extra checks for these empty values like the one Tapani suggested 👍
Comment 13 Tapani Pälli 2019-06-20 06:36:27 UTC
I sent a bit different fix here:
https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1139
Comment 14 Tapani Pälli 2019-06-24 05:55:31 UTC
--- 8< ---
commit ff77b0415bf8a6540ec29663e093171aaeab18a3
Author: Tapani Pälli <tapani.palli@intel.com>
Date:   Tue Jun 18 13:50:52 2019 +0300

    meson: error out if platforms contains empty string
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110939
    Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
    Reviewed-by: Eric Engestrom <eric@engestrom.ch>


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.