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

  • SEARCH
  • Home
  • 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 4536504
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:32:44+00:00 2026-05-21T14:32:44+00:00

I want to set up a project to take my .hs code, and my

  • 0

I want to set up a project to take my .hs code, and my main .c program, and result in a statically linked executable through the use of LLVM compiler. I can get things working via ghc command line options to build a .hs, produce the stubs, and compile and link a driver application using ghc entirely. However, I get various issues within Xcode.

My first issue was that I of course need to use 32 bit compiling environment in Xcode. That solved, I had to fiddle with paths to explicitly include the HsFFI.h. That solved, I get a linker error:

Ld "build/Debug/FFI Test.app/Contents/MacOS/FFI Test" normal i386
    cd "/Users/rcl/TestXCodeProjects/FFI Test"
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    /Developer/usr/bin/clang -arch i386
        -isysroot /Developer/SDKs/MacOSX10.6.sdk
        "-L/Users/rcl/TestXCodeProjects/FFI Test/build/Debug"
        "-L/Users/rcl/TestXCodeProjects/FFI Test/FFI Test"
        "-F/Users/rcl/TestXCodeProjects/FFI Test/build/Debug"
        -filelist "/Users/rcl/TestXCodeProjects/FFI Test/build/FFI Test.build/
            Debug/FFI Test.build/Objects-normal/i386/FFI Test.LinkFileList"
        -mmacosx-version-min=10.6 -framework Cocoa
        "/Users/rcl/TestXCodeProjects/FFI Test/FFI Test/ForeignExportCost.a"
        -o "/Users/rcl/TestXCodeProjects/FFI Test/build/Debug/FFI Test.app/
            Contents/MacOS/FFI Test"

Undefined symbols for architecture i386:
  "_hs_init", referenced from:
      -[FFI_TestAppDelegate applicationDidFinishLaunching:] in FFI_TestAppDelegate.o
  "_simpleFunction", referenced from:
      -[FFI_TestAppDelegate applicationDidFinishLaunching:] in FFI_TestAppDelegate.o
  "_hs_exit", referenced from:
      -[FFI_TestAppDelegate applicationDidFinishLaunching:] in FFI_TestAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The “simpleFunction” is in “ForeignExportCost.a” library which I compile using ghc like this:

ghc -no-hs-main -fPIC -c ForeignExportCost.hs
ghc -no-hs-main -shared ForeignExportCost.o -o ForeignExportCost.a

What am I missing or doing wrong?

  • 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-21T14:32:45+00:00Added an answer on May 21, 2026 at 2:32 pm

    Ugh – it looks like the answer to my question is detailed here, telling me how to painfully add a ton of .a’s to my project. And this blog post gave some helpful tips to getting on the way.

    Although if someone tells me “hey wait, there’s an easier way than iteratively figuring out failed deps” that would be awesome. Because I want to reuse this framework several times and this is a real pain of a way to get things up and going!

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

Sidebar

Related Questions

I got a project in mind that makes it worth to finally take the
How do I take my existing project in Eclipse on Windows for Android and
When I compile my code with code analysis enabled, it take a long time.
We develop a set of industrial applications that use SQL Server. As demand expands,
I haven't touched any code in a good 4-5 months so just getting back
I'm working on a project that involves diverting phone calls to a number of
I'm working on a Project Euler problem which requires factorization of an integer. I
I want to localize / globalize the fields on my Login page. I am
I am working on an old asp project. I am new in project. My
I need to load some text (shader code) from a file that is placed

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.