Opened 10 months ago

Closed 6 months ago

#60508 closed defect (fixed)

gimp2:error: use of undeclared identifier 'MACH_TASK_BASIC_INFO_COUNT

Reported by: iefdev (Eric F) Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: lion snowleopard leopard tiger Cc:
Port: gimp2

Description

$ grep -n 'error: ' gimp2_main.log | grep -v '404'
6195::info:build gimpdashboard.c:2410:31: error: variable has incomplete type 'struct mach_task_basic_info'
6201::info:build gimpdashboard.c:2411:48: error: use of undeclared identifier 'MACH_TASK_BASIC_INFO_COUNT'
6204::info:build gimpdashboard.c:2413:36: error: use of undeclared identifier 'MACH_TASK_BASIC_INFO'

This error dates back to Feb 24 (when it broke), if that helps.

Attachments (5)

gimp2_main.log (2.0 MB) - added by iEFdev 10 months ago.
logs.tar.xz (16.4 KB) - added by iEFdev 6 months ago.
err.txt (1.5 KB) - added by iEFdev 6 months ago.
main-10.7.log (2.0 MB) - added by dbevans (David B. Evans) 6 months ago.
10.7 build log from buildbot
task_info.h (9.8 KB) - added by iEFdev 6 months ago.
<mach/task_info.h> from 10.7

Change History (36)

Changed 10 months ago by iEFdev

Attachment: gimp2_main.log added

comment:1 Changed 7 months ago by iEFdev

I'd really appreciate if someone could have a look, &/or help me with this.

comment:2 Changed 7 months ago by kencu (Ken)

I pegged it <https://github.com/kencu/SnowLeopardPorts/tree/master/graphics/gimp2> at 2.10.14_3 until someone gets around to fixing it. You can do that too, if 2.10.14_3 meets your needs for now.

comment:3 in reply to:  2 Changed 7 months ago by iEFdev

Replying to kencu:

I pegged it <https://github.com/kencu/SnowLeopardPorts/tree/master/graphics/gimp2> at 2.10.14_3 until someone gets around to fixing it. You can do that too, if 2.10.14_3 meets your needs for now.

Thanks Ken… I'll have a look at that one. It's the one I have now.

gimp2 @2.10.14_3+python27+quartz-universal (active) platform='darwin 11' archs='x86_64' date='2020-02-15T04:30:04+0100'

But, before I do that… I read your post last night about “how to install and use a newer libc++ on older systems 10.7 to 10.12”

Do you think that one could help?

Gimp 2.10.20 is out (2.10.18 in port), and I really hope this is fixed for that one. It looks like a really good version.



Here's the code by the way, the one with the errors… in: gimp-2.10.18/app/widgets/gimpdashboard.c

Line 
2399#ifdef HAVE_MEMORY_GROUP
2400#ifdef PLATFORM_OSX
2401static void
2402gimp_dashboard_sample_memory_used (GimpDashboard *dashboard,
2403                                   Variable       variable)
2404{
2405  GimpDashboardPrivate        *priv          = dashboard->priv;
2406  VariableData                *variable_data = &priv->variables[variable];
2407
2408  variable_data->available = FALSE;
2409#ifndef TASK_VM_INFO_REV0_COUNT /* phys_footprint added in REV1 */
2410  struct mach_task_basic_info info;
2411  mach_msg_type_number_t      infoCount      = MACH_TASK_BASIC_INFO_COUNT;
2412
2413  if( task_info(mach_task_self (), MACH_TASK_BASIC_INFO,
2414                             (task_info_t)&info, &infoCount ) != KERN_SUCCESS )
2415    return;      /* Can't access? */
2416
2417  variable_data->available  = TRUE;
2418  variable_data->value.size = info.resident_size;
2419#else
2420
2421// ... //

comment:4 Changed 7 months ago by kencu (Ken)

this is not a libc++ API thing here, so upgrading libc++ won't fix this one.

This is related to kernel interface API that looks like it was added in a later os version. You'd have to see what this code is trying to accomplish, and then sort out if it can be done using API available on your system version.

Sometimes comparing the file to last version you have that worked is illuminating; the author might have removed code that worked on your os before. If it's new code, then you might have to write a compatible version. If the API is just unavailable, then perhaps you can just return some reasonable fallback value for whatever it is.

And sometimes there is no fix, and you're out of luck...

comment:5 in reply to:  2 Changed 7 months ago by iEFdev

Replying to kencu:

I pegged it <https://github.com/kencu/SnowLeopardPorts/tree/master/graphics/gimp2> at 2.10.14_3 …

I downloaded the gimp Portfile as well.

I got a config error about mypaint-brushes not being 1.0. Installing mypaint-brushes1 solved it.

But, I get this error… I don't know how to work around that. Tried with a few different compilers (clang{9,8,5}). All the same.

:info:build gimpdata.c:460:40: error: expected expression
:info:build       else if (g_str_has_prefix (path, MYPAINT_BRUSHES_DIR))
:info:build                                        ^
:info:build <command line>:8:29: note: expanded from here
:info:build #define MYPAINT_BRUSHES_DIR /opt/local/share/mypaint-data/1.0/brushes
:info:build                             ^
:info:build gimpdata.c:460:40: error: use of undeclared identifier 'opt'
:info:build <command line>:8:30: note: expanded from here
:info:build #define MYPAINT_BRUSHES_DIR /opt/local/share/mypaint-data/1.0/brushes
:info:build                              ^
:info:build gimpdata.c:460:40: error: use of undeclared identifier 'local'; did you mean 'lockf'?
:info:build <command line>:8:34: note: expanded from here
:info:build #define MYPAINT_BRUSHES_DIR /opt/local/share/mypaint-data/1.0/brushes
:info:build                                  ^
:info:build /usr/include/unistd.h:609:6: note: 'lockf' declared here
:info:build int      lockf(int, int, off_t) __DARWIN_ALIAS_C(lockf);
:info:build          ^
:info:build gimpdata.c:460:40: error: use of undeclared identifier 'share'
:info:build       else if (g_str_has_prefix (path, MYPAINT_BRUSHES_DIR))
:info:build                                        ^
:info:build <command line>:8:40: note: expanded from here
:info:build #define MYPAINT_BRUSHES_DIR /opt/local/share/mypaint-data/1.0/brushes
:info:build                                        ^

// ... //

:info:build 16 errors generated

comment:6 Changed 7 months ago by kencu (Ken)

I guess we will have to try to really fix this :> I'll see if I can find some time. Riccardo is also deeply into gimp2 on older systems, and usually has fixes to contribute.

comment:8 Changed 7 months ago by kencu (Ken)

the gimp2 in my snowleopardports repo has the patch added now. that was all it needed to build for me.

I'll see if I can sort out the newer version over the next bit.

comment:9 in reply to:  8 Changed 7 months ago by iEFdev

Replying to kencu:

the gimp2 in my snowleopardports repo has the patch added now. that was all it needed to build for me.

I'll see if I can sort out the newer version over the next bit.

Thanks! 👍 Yes, I added it here to. Mine is still building.

comment:10 Changed 7 months ago by iEFdev

Thanks again Ken! It built and started up fine now. So nice to get rid of the rev-upgrade msg. My Lion said: “purrfect”. 👌

comment:11 Changed 7 months ago by kencu (Ken)

Summary: gimp2: error: variable has incomplete type, error: use of undeclared identifiergimp2:error: use of undeclared identifier 'MACH_TASK_BASIC_INFO_COUNT

comment:12 Changed 7 months ago by kencu (Ken)

Keywords: lion snowleopard leopard tiger added

comment:13 Changed 6 months ago by dbevans (David B. Evans)

This build failure is occurring with gimp2 2.10.20 on 10.7 and earlier (with MYPAINT_BRUSHES_DIR.patch applied). I'm not sure what happened before but I don't think it looks like this patch has anything to do with it. I'm looking into it but I would appreciate any input from you guys on this.

comment:14 Changed 6 months ago by kencu (Ken)

Yes, we found that patch was needed to fix an earlier gimp2 version (2.10.14) building against an updated mypaint-brushes1.

I don't think we ever got anything newer building on < 10.8, and I haven't tried in a while...

Last edited 6 months ago by kencu (Ken) (previous) (diff)

comment:15 Changed 6 months ago by dbevans (David B. Evans)

Anyway the place the build breaks (for < 10.8) is in app/widgets/gimpdashboard.c and it looks like it could be bypassed, if needed, by just using #undef HAVE_MEMORY_GROUP there.

On the more recent machines, the missing definitions are in <mach/task_info.h>. The GIMP code includes <mach/mach.h> which eventually includes this header. (mach/mach.h includes mach/mach_types.h includes mach/task_info.h)

I'd be interested if this is the case on the failing machines or not or something else. Appreciate it if you could take a look for me.

Thanks in advance.

comment:16 in reply to:  13 ; Changed 6 months ago by iEFdev

Replying to dbevans:

This build failure is occurring with gimp2 2.10.20 on 10.7 and earlier (with MYPAINT_BRUSHES_DIR.patch applied). I'm not sure what happened before but I don't think it looks like this patch has anything to do with it. I'm looking into it but I would appreciate any input from you guys on this.

Unrelated to the original err, but it it is to any help…

I'll attach the configure.log and main.log from upgrading to 2.10.20.

grep'ed the errors and put in a separate `err.txt`

There are a couple of unknown arguments and options, a couple of missing headers, a new undeclared identifier: _NL_MEASUREMENT_MEASUREMENT, and the XML::Parser perl module is missing. 2 of the patches had some offset.

Last edited 6 months ago by iEFdev (previous) (diff)

Changed 6 months ago by iEFdev

Attachment: logs.tar.xz added

Changed 6 months ago by iEFdev

Attachment: err.txt added

comment:17 in reply to:  16 ; Changed 6 months ago by dbevans (David B. Evans)

Replying to iEFdev:

There are a couple of unknown arguments and options, a couple of missing headers, a new undeclared identifier: _NL_MEASUREMENT_MEASUREMENT, and the XML::Parser perl module is missing. 2 of the patches had some offset.

This is not entirely consistent with the result on the buildbots. Particularly the perl bit should be handled correctly and if not is symptomatic of some error in your setup. Will attach the 10.7 buildbot log for comparison.

Maybe were not doing the same thing. Are you building using the gimp2 port that I pushed this morning or something else?

Changed 6 months ago by dbevans (David B. Evans)

Attachment: main-10.7.log added

10.7 build log from buildbot

comment:18 Changed 6 months ago by dbevans (David B. Evans)

This

:info:configure checking for perl... (cached) /opt/local/bin/perl5.30
:info:configure checking for perl >= 5.8.1... 5.30.3
:info:configure checking for XML::Parser... configure: error: XML::Parser perl module is required for intltool
:info:configure Command failed:  cd "/opt/local/var/macports/build/

is because you're using perl 5.30 and intltool is expecting 5.28 (you have p5.30-xml-parser installed) but intltool wants p5.28-xml-parser. Possibly you have perl5 +perl5_30 installed?

comment:19 in reply to:  17 Changed 6 months ago by iEFdev

Replying to dbevans:

Are you building using the gimp2 port that I pushed this morning or something else?

Yes, the new 2.10.20 update. Perhaps the differences are because of my variants? … +python27+quartz-universal.

I renamed my pegged 2.10.14 to gimp2_. Made sure it showed up as outdated with 2.10.20 as the new one, and then ran an port upgrade (to get the logs and errs).

comment:20 in reply to:  18 Changed 6 months ago by iEFdev

Replying to dbevans:

…but intltool wants p5.28-xml-parser. Possibly you have perl5 +perl5_30 installed?

Yes, I have. I'll try add +perl5_28 to the upgrade and see if the err gets removed.

Maybe add port:p5.28-xml-parser as a dep?

comment:21 Changed 6 months ago by dbevans (David B. Evans)

The ports code is assuming that the default perl5 (+perl5_28) is installed. Bad assumption, as you have demonstrated. Will go and fix it.

comment:22 Changed 6 months ago by dbevans (David B. Evans)

Just pushed fix for the perl issue. After updating your ports tree, the perl configuration should work regardless of which variant of perl5 is installed (or no perl5 installed at all).

Last edited 6 months ago by dbevans (David B. Evans) (previous) (diff)

comment:23 in reply to:  15 Changed 6 months ago by iEFdev

Replying to dbevans:

Just pushed fix for the perl issue. After updating your ports tree, the perl configuration should work regardless of which variant of perl5 is installed (or no perl5 installed at all).

Thanks! 👍 I've tried with both now, and it's the old msg.


Replying to dbevans:

On the more recent machines, the missing definitions are in <mach/task_info.h>. The GIMP code includes <mach/mach.h> which eventually includes this header. (mach/mach.h includes mach/mach_types.h includes mach/task_info.h)

In 10.7, there's no MACH_TASK_BASIC_INFO_COUNT, but there is a TASK_BASIC_INFO_COUNT. What's the extected output? Perhaps it's just renamed.

Changed 6 months ago by iEFdev

Attachment: task_info.h added

<mach/task_info.h> from 10.7

comment:24 Changed 6 months ago by kencu (Ken)

I think it probably is just renamed.

10.15:

#define MACH_TASK_BASIC_INFO_COUNT   \
	        (sizeof(mach_task_basic_info_data_t) / sizeof(natural_t))

10.7:

#define TASK_BASIC_INFO_COUNT   \
                (sizeof(task_basic_info_data_t) / sizeof(natural_t))

see: <http://newosxbook.com/src.jl?tree=xnu-1699.32.7&file=/osfmk/mach/task_info.h>

comment:25 Changed 6 months ago by kencu (Ken)

so perhaps we just

#if MAC_OS_X_VERSION_MAX_ALLOWED < 1080
  #define MACH_TASK_BASIC_INFO_COUNT TASK_BASIC_INFO_COUNT
  #define mach_task_basic_info_data_t task_basic_info_data_t
#endif
Last edited 6 months ago by kencu (Ken) (previous) (diff)

comment:26 in reply to:  25 Changed 6 months ago by iEFdev

Replying to kencu:

so perhaps we just

Yes, almost. Got another, but simular error. I think I've fixed it, and have prepared a patch.

I used this:

#ifdef HAVE_MEMORY_GROUP
#ifdef PLATFORM_OSX
  #if MAC_OS_X_VERSION_MAX_ALLOWED < 1080
    #define MACH_TASK_BASIC_INFO_COUNT TASK_BASIC_INFO_COUNT
    #define mach_task_basic_info_data_t task_basic_info_data_t

    #define MACH_TASK_BASIC_INFO TASK_BASIC_INFO
    #define mach_task_basic_info task_basic_info
  #endif
static void

…and it finished the build, but since I had prepared the Portfile (and my muscle memory must've ⌘S that), so it errored on destroot. But, it did build. :–)

$ sudo port destroot gimp2 +python27 +quartz 
--->  Computing dependencies for gimp2
--->  Configuring gimp2
--->  Building gimp2
Portfile changed since last build; discarding previous state.
--->  Staging gimp2 into destroot
Error: Failed to destroot gimp2: command execution failed

I'll retry in a moment, and see if I can fix the (2) offsets on the othe patches to before that.

comment:27 Changed 6 months ago by iEFdev

It built and installed, and the program open up fine.

$ port -v installed gimp2
The following ports are currently installed:
  gimp2 @2.10.14_3+python27+quartz-universal platform='darwin 11' archs='x86_64' date='2020-07-28T01:27:36+0200'
  gimp2 @2.10.20_0+python27+quartz-universal (active) platform='darwin 11' archs='x86_64' date='2020-08-29T19:04:06+0200'

That “Yes, it worked”-feeling is a nice one. :–)

Made a PR for this here: https://github.com/macports/macports-ports/pull/8262

comment:28 Changed 6 months ago by kencu (Ken)

That's great. Perhaps even something we might be able include in legacy-support to make this transparent someday.

Last edited 6 months ago by kencu (Ken) (previous) (diff)

comment:29 Changed 6 months ago by iEFdev

Thanks! Yes, that'd be great.

comment:30 Changed 6 months ago by dbevans (David B. Evans)

Thanks. Looks good. Will merge the PR.

comment:31 Changed 6 months ago by iEFdev

Resolution: fixed
Status: assignedclosed

In 8139855119740a50ff639c83fbd22a4804743de8/macports-ports (master):

gimp2{,-devel}: add patch to fix building on <= 10.7

  • add patch to fix building on <= 10.7
  • fix patches for (2) offsets
  • Closes: #60508

Since gimp2-devel, is an older version (2.10.19-*) I
left out the other patches as is.

Note: See TracTickets for help on using tickets.