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 4000064
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:44:07+00:00 2026-05-20T07:44:07+00:00

Something odd is happening. I have a static library, in C, compiled using CMake.

  • 0

Something odd is happening.

I have a static library, in C, compiled using CMake.

I link against to build an executable fine on Ubuntu, but under Snow Leopard I get an undefined symbol error when I attempt to do this:

per-ms006:mbuild douglasl$ make
Linking C executable Sample
Undefined symbols:
  "_na_Gfx_Impl", referenced from:
      _na_impl_render in libdesktop.a(impl.c.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [Sample] Error 1
make[1]: *** [CMakeFiles/Sample.dir/all] Error 2
make: *** [all] Error 2

This is mysterious to me, because nm on the static library shows:

… (pile of stuff omitted) …

libdesktop.a(impl.c.o):
0000000000003a30 s EH_frame1
0000000000003990 s LC0
00000000000039a0 s LC1
00000000000039ac s LC2
00000000000039d0 s LC3
00000000000039f0 s LC4
00000000000039fc s LC5
0000000000003a0c s LC6
0000000000003a1b s LC7
0000000000003a2a s LC8
                 U _SDL_PollEvent
                 U _free
                 U _malloc
                 U _na_Gfx_Impl  <----------- Symbol is there.
0000000000000209 T _na_impl_api
0000000000003b38 S _na_impl_api.eh
                 U _na_impl_assets_create
                 U _na_impl_events_create
                 U _na_impl_events_destroy
                 U _na_impl_gfx_create
                 U _na_impl_gfx_destroy
0000000000000124 T _na_impl_init
0000000000003aa8 S _na_impl_init.eh
0000000000000021 T _na_impl_log
0000000000003a78 S _na_impl_log.eh
0000000000000159 T _na_impl_poll
0000000000003ad8 S _na_impl_poll.eh
00000000000002d0 T _na_impl_release
0000000000003b68 S _na_impl_release.eh
000000000000018e T _na_impl_render
0000000000003b08 S _na_impl_render.eh
                 U _na_impl_shared_assets_destroy
                 U _na_impl_shared_error
0000000000000000 T _na_impl_version
0000000000003a48 S _na_impl_version.eh
                 U _printf
                 U _putchar
                 U _vprintf

na_Gfx_Impl is unremarkable, its just a struct; and, just to repeat, this code compiles fine on my ubuntu system.

I don’t know enough about osx library linking to know what’s wrong here, but… it’s just a fragment of c code; surely this is me doing something wrong, rather than something weird with OSX.

help! 🙂

Edit:

For reference, the struct is defined:

/** Implementation struct. */
struct na_Gfx_Impl {

  /** Parent. */
  struct na_Gfx *gfx;

  /** SDL surface for rendering. */
  SDL_Surface *screen;

  /** Handler for sprites. */
  struct na_utils_SetHandler *key;

  /** Set of texture values. */
  GLfloat *texture;

  /** Set of vextex values. */
  GLfloat *vertex;
};

and used:

/** Render implementation. */
int na_impl_render(struct na_Api *api) {
  struct na_Gfx_Impl *impl = (struct na_Gfx_Impl *) (api->gfx->impl);
  ... 

However, I conclude something must be screwed up badly. There is no reason (as I understand it) for the struct symbol to turn up in the static lib.

  • 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-05-20T07:44:08+00:00Added an answer on May 20, 2026 at 7:44 am

    I’m not sure if this is your exact problem, but when compiling libraries statically, often times the order of the link matters. You want to make sure the lowest level functions are ordered last.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a bit of an odd situation. Here's what's happening. So, we have
I seem to have something odd with either my Mac 10.6 terminal or my
I have an odd issue happening when trying to open multiple Input Streams (in
I just saw something odd, I'm using Google Chrome browser and I right clicked
Something I have always been interested in out of curiosity, is there a tool
Something else perhaps? I am already using nHibernate, but I get occasional issues where
I have encountered a rather odd error that I do not understand. I created
I discovered something odd that I can't explain. If someone here can see what
I'm seeing something very very strange happening in a Flex app I'm maintaining. I've
I'm using Symfony 1.2 with Doctrine. I have an object with the i18n behaviour.

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.