xcode 4.0.2 SOIL library link errors (OSX 10.6.8)
Asked Answered
S

1

7

My user story: I want to load a texture into my openGL program.

My question: How do I link the SOIL library properly in xcode 4.0.2

So, I've been googling over the past few days regarding my linker warnings in xcode4, and am unable to answer it for myself - so I'm daring to post another thread on the subject... (humble beginner tucks tail between legs).

My bare-bone repro steps:

  1. I unzip the 'Simple OpenGL Image Library' to my downloads
  2. I drag/drop libSOIL.a to my project file

    • Under 'Build Phases', libSOIL.a is automatically added to 'Link Binary With Libraries'
    • Under 'Build Settings', my Library Search Paths is also automatically updated
    • my Valid Architectures already specify "i386 x86_64"

I get this warning when I try to run my program:

ld: warning: ignoring file /Users/Scott/Developer/Projects/SpaceRanger/Code/Production/lib/libSOIL.a, file was built for archive which is not the architecture being linked (x86_64)

As I mentioned, I'm quite new to programming and IDE's in general, so I was hoping that a simpler approach to loading textures in OpenGL (e.g. SOIL) would be favorable to SDL or even GLFW for that matter. If I'm having this sort of trouble loading only a library, those must absolutely be out of my league.

Other Hit n' Miss attempts based on searching:

  • adding the library to 'Compile Sources' only generating more warnings
  • toggling 'Build Active Architecture Only' Yes/No
  • setting schemes to 32 and 64 bit
  • writing my own texture loader, employing libjpg/DevIL/etc.

I'm afraid I'm beginning to mangle my project just trying to link this library. If someone could help me to link the SOIL library properly in xcode 4.0.2, I would be eternally grateful.

Thank you deeply in advance.

-kropcke

Simard answered 29/8, 2012 at 18:43 Comment(6)
update: In the SOIL folder, where you'll see some test images and a lib and src folder and some others, make a new folder named obj. Then navigate to projects/makefile. In there should be the makefile. You'll need to make a slight modification to it, so open it in TextEdit (or whatever), and modify the line that says:Simard
OBJDIR = obj so that it says: OBJDIR = ../../obj and save itSimard
Then launch Terminal. In Terminal, type cd, then drag the makefile directory onto Terminal and hit return. To make sure you're in the right directory, if you type ls and return you should get "alternate Makefile.txt makefile". Then type make and return and it'll do some compiling. The new Mac compatible lib should now be in the lib directory.Simard
done successfully, and created the new Mac-compatible lib, but still receiving the same warning as above.Simard
copied lib into group containing main.cpp, rather than project (where included frameworks live) and I am warning/error free. Thanks for being a sounding board :)Simard
what format would be this Mac-compatible lib? the same .a you had from the unziped folder?Fagoting
M
7

I would like to add to this, it's driven me insane over last few days. As well as all the above, I had to ensure of the following.

In Project > Target > Build Phases, under 'Compile Sources', need to add the .c SOIL files:

image_DXT.c, image_helper.c, SOIL.c, stb_image_aug.c.

Only now would it compile and run.

// not sure why downvote, would appreciate reason!

Milagro answered 24/12, 2012 at 0:10 Comment(1)
Yes, I was looking through some of my older posts - why is this down-voted? Without reason, it is as arbitrary as it is rude. (btw, thanks for the addition cilk :)Simard

© 2022 - 2024 — McMap. All rights reserved.