Opened 10 months ago

Closed 7 months ago

#60310 closed defect (fixed)

gnucash @3.9: Could NOT find Threads (missing: Threads_FOUND)

Reported by: hapaguy (Brian Kurt Fujikawa) Owned by: drkp (Dan Ports)
Priority: Normal Milestone:
Component: ports Version:
Keywords: catalina Cc: jjstickel (Jonathan Stickel), posita (Matt Bogosian (formerly @mbogosian)), michaelld (Michael Dickens)
Port: gnucash

Description

I am using the following:

  • macOS 10.15.4
  • Xcode 11.4
  • MacPorts 2.6.2

The gnucash build fails:

  • sudo port -sv upgrade gnucash
  • sudo port -sv install gnucash

with missing threads, etc.:

  • -- Performing Test HAVE_OFX_BUG_39 - Failed
  • -- Performing Test have_stringop_truncation - Failed
  • -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
  • -- Looking for pthread_create in pthreads - not found
  • -- Looking for pthread_create in pthread - not found

I have attached the main.log.

Attachments (2)

gnucash main.log (22.0 KB) - added by hapaguy (Brian Kurt Fujikawa) 10 months ago.
gnucash CMakeError.log (11.7 KB) - added by hapaguy (Brian Kurt Fujikawa) 10 months ago.

Download all attachments as: .zip

Change History (17)

Changed 10 months ago by hapaguy (Brian Kurt Fujikawa)

Attachment: gnucash main.log added

comment:1 Changed 10 months ago by ryandesign (Ryan Schmidt)

Cc: drkp removed
Keywords: catalina added
Owner: set to drkp
Status: newassigned
Summary: gnucash @3.9 build failuregnucash @3.9: Could NOT find Threads (missing: Threads_FOUND)

I agree; here's the build failure log from our Catalina buildbot worker. This problem appears to be specific to Catalina.

Could you also attach the CMakeError.log file?

Changed 10 months ago by hapaguy (Brian Kurt Fujikawa)

Attachment: gnucash CMakeError.log added

comment:2 Changed 10 months ago by hapaguy (Brian Kurt Fujikawa)

Could you also attach the CMakeError.log file?

done, thanks

comment:3 Changed 9 months ago by drkp (Dan Ports)

Well, I'm pretty confused here because I didn't run into this problem when I originally prepared the gnucash 3.9 update (also on Catalina), but now I'm running into it with gnucash 3.10. I guess this is probably related to some update either to Catalina or to Xcode that happened in the interim??

comment:4 Changed 9 months ago by hapaguy (Brian Kurt Fujikawa)

FWIW, I updated macOS and Xcode on Mar 24 - a week before I ran into problems with the gnucash 3.9 update. I didn't encounter any issues with the gnucash 3.8 update in Jan - so, your guess that the problem is related to the macOS/Xcode update is reasonable.

comment:5 Changed 9 months ago by kencu (Ken)

I notice one pthread.h test fails like this:

error: no previous prototype for function 'test_func' [-Werror,-Wmissing-prototypes]

I'd have to check by comparing to some other compiler's behaviour, but it could be that test used to pass, and now it fails due to a stricter clang syntax check.

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

With clang-9 on 10.6, I see similar errors, but it succeeds in the end:

-- Checking for GTEST
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  

so it's not that -- too bad, that might have been easy. You may see useful information in CMakeOutput.log to help as well.

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

comment:7 Changed 9 months ago by jjstickel (Jonathan Stickel)

Cc: jjstickel added

comment:8 Changed 8 months ago by jjstickel (Jonathan Stickel)

I'd appreciate some movement on this one. I've been using direct download of gnucash from the upstream site, but I am experiencing some weird behavior that might be easier to trouble-shoot with Macports-installed gnucash. I googled and tried solutions suggested on these forums/issues:

https://stackoverflow.com/questions/54587052/cmake-on-mac-could-not-find-threads-missing-threads-found

https://github.com/fireice-uk/xmr-stak/issues/1597

but no luck. I'm willing to try other things if you have suggestions.

comment:9 Changed 7 months ago by ryandesign (Ryan Schmidt)

Cc: posita added

Has duplicate #60724.

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

On 10.15, the initial configuration of gnucash fails, as above.

looking at build/CMakeFiles/CMakeError.log, we see this:

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gnucash/gnucash/work/build/CMakeFiles/CMakeTmp/src.c:3:7: error: no previous prototype for function 'test_func' [-Werror,-Wmissing-prototypes]
void* test_func(void* data)
      ^
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gnucash/gnucash/work/build/CMakeFiles/CMakeTmp/src.c:3:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void* test_func(void* data)
^
static 
1 error generated.

Well, OK, Xcode 11 wants a function prototype. The test is kept in this file:

/opt/local/share/cmake-3.17/Modules/CheckForPthreads.c

and editing that file to add a function prototype:

#include <pthread.h>

/* ADD THIS FUNCTION PROTOTYPE */
void* start_routine(void*);

void* start_routine(void* args)
{
  return args;
}

int main(void)
{
  /* This is a compile and link test, no code to actually run things. */
  pthread_t thread;
  pthread_create(&thread, 0, start_routine, 0);
  pthread_join(thread, 0);
  return 0;
}

and then all is well, pthreads are found, gnucash finishes configuring, and installs.

% port -v installed gnucash
The following ports are currently installed:
  gnucash @3.9_0 (active) platform='darwin 19' archs='x86_64' date='2020-06-27T19:42:28-0700'

So - cmake will need a patch for this, for now, until the inevitable next release, wherein we find out this has already, no doubt, been reported and fixed upstream in some commit that I'm sure someone will find and paste the link to here.

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

Cc: michaelld added

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

Hi Michael -- adding you in here, as it looks like the pthread detection module on cmake is falsely failing on stricter Xcode 11 due to a lack of function prototype in the pthread test file.

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

another approach, maybe simpler for now (although cmake should still provide a prototype)...

in the gnucash CMakeList.txt, they do this:

if (UNIX)
  set( CMAKE_C_FLAGS "-Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-unused ${CMAKE_C_FLAGS}")

So easing up that -Werror should also fix this in this build.

comment:15 Changed 7 months ago by ken-cunningham-webuse

Resolution: fixed
Status: assignedclosed

In 226874aa46f3297744c62b25328c5786ab6c79a0/macports-ports (master):

gnucash: don't use -Werror

it causes the pthread tests to fail on some macOS versions
and it is generally not advised to have -Werror active
in releases of software in general

closes: #60310

Note: See TracTickets for help on using tickets.