Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7926365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:44:52+00:00 2026-06-03T18:44:52+00:00

I am trying to port my working code from Mac OS X to GNU/Linux.

  • 0

I am trying to port my working code from Mac OS X to GNU/Linux.
I am using qsort_r whose prototypes are different on FreeBSD and GNU/Linux.

Therefore I wrapped my qsort_rspecific calls around platform specific macros
Now when I compile, the code compiles and runs fine on Mac OS X, but I get errors on GNU/Linux

I can’t seem to find the issue. Maybe another pair of eyes might help.

error –

auto-assign.c: In function ‘get_gtype’:
auto-assign.c:1669:19: error: assignment from incompatible pointer type [-Werror]
auto-assign.c:1677:19: error: assignment from incompatible pointer type [-Werror]
auto-assign.c:1685:19: error: assignment from incompatible pointer type [-Werror]
auto-assign.c:1693:19: error: assignment from incompatible pointer type [-Werror]

auto_assign.c –

switch (op) {
1668 case RULE_S2_8:
1669 gtype->qsort_comp = comp_uint8_t; # -Werror
1675 break;
1676 case RULE_S2_16:
1677 gtype->qsort_comp = comp_uint16_t; # -Werror
1683 break;
1684 case RULE_S2_32:
1685 gtype->qsort_comp = comp_uint32_t; # -Werror
1691 break;
1692 case RULE_S2_64:
1693 gtype->qsort_comp = comp_uint64_t; # -Werror
1699 break;
1700 }

gtype –

struct grouper_type {
 71 #if defined(__APPLE__) || defined(__FreeBSD__)··
 72   int (*qsort_comp)(
 73                     void*                           thunk,
 74                     const void*                     e1,
 75                     const void*                     e2
 76                    );
 77 #elif defined(__linux)
 78   int (*qsort_comp)(
 79                     const void*                     e1,
 80                     const void*                     e2,
 81                     void*                           thunk
 82                    );
 83 #endif
 ...

-> gcc -E does return me the write qsort_comp on both platforms.


comp_* –

532 #if defined(__APPLE__) || defined(__FreeBSD__)
533   #define comp(size) \
534   int comp_##size(void *thunk, const void *e1, const void *e2) {\
535     size x, y; \
536     x = *(size *)(**(char ***)e1+*(size_t *)thunk); \
537     y = *(size *)(**(char ***)e2+*(size_t *)thunk); \
538     return (x > y) - (y > x); \
539   }
540 #elif defined(__linux)
541   #define comp(size) \
542   int comp_##size(const void *e1, const void *e2, void *thunk) {\
543     size x, y; \
544     x = *(size *)(**(char ***)e1+*(size_t *)thunk); \
545     y = *(size *)(**(char ***)e2+*(size_t *)thunk); \
546     return (x > y) - (y > x); \
547   }
548 #endif
549 
550 comp(uint8_t);
551 comp(uint16_t);
552 comp(uint32_t);
553 comp(uint64_t);
...

-> gcc -E does return me the write comp_* on both platforms.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T18:44:54+00:00Added an answer on June 3, 2026 at 6:44 pm

    I seem to have found the issue. I forgot to wrap the function prototypes.

    154 #if defined (__APPLE__) || defined (__FreeBSD__)
    155 int·
    156 comp_uint8_t(void *thunk, const void *e1, const void *e2);
    157 int·
    158 comp_uint16_t(void *thunk, const void *e1, const void *e2);
    159 int·
    160 comp_uint32_t(void *thunk, const void *e1, const void *e2);
    161 int·
    162 comp_uint64_t(void *thunk, const void *e1, const void *e2);
    163 #elif defined(__linux)
    164 int·
    165 comp_uint8_t(const void *e1, const void *e2, void* thunk);
    166 int·
    167 comp_uint16_t(const void *e1, const void *e2, void* thunk);
    168 int·
    169 comp_uint32_t(const void *e1, const void *e2, void* thunk);
    170 int·
    171 comp_uint64_t(const void *e1, const void *e2, void* thunk);
    172 #endif
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to port a C++ program from Linux to Windows using cygwin.
I am trying to port working iPhone code to the Mac (iOS to OSX
I’m working on trying to port an ASP.NET app from Server 2003 (and IIS6)
We are trying to port our code from HPX to AIX but getting core
I'm trying to port code over to compile using Microchip's C18 compiler for a
I'm trying to port some Windows code to Linux, ideally through platform-independent libraries (eg
I am specifically trying to read data from an SNMP port in python using
I'm trying to port a .NET application from Windows to Mono, but certain code
I'm trying to port a working Leopard screensaver to Snow Leopard but it's deactivating
I'm currently trying to port an app from asp.net to php, however I just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.