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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:19:30+00:00 2026-05-16T12:19:30+00:00

Been working on this for hours now so any insight would be greatly appreciated.

  • 0

Been working on this for hours now so any insight would be greatly appreciated.

I’m trying to compile libssh2 for the iPhone Simulator on OS X (I already have it compiled successfully for the device).

I’m using the following environment variables and commands:

export DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer 
export SDKROOT=$DEVROOT/SDKs/iPhoneSimulator3.0.sdk 
export CC=$DEVROOT/usr/bin/gcc-4.2 
export LD=$DEVROOT/usr/bin/ld 
export CPP=$DEVROOT/usr/bin/cpp-4.2 
export CXX=$DEVROOT/usr/bin/g++-4.2 
export AR=$DEVROOT/usr/bin/ar 
export AS=$DEVROOT/usr/bin/as 
export NM=$DEVROOT/usr/bin/nm 
export CXXCPP=$DEVROOT/usr/bin/cpp-4.2 
export RANLIB=$DEVROOT/usr/bin/ranlib 
export LDFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -L/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os/lib"
export CFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -I/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os/include"
export CXXFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -I/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os/include/"
export CFLAGS=-m32
export CPPFLAGS=-m32

cd /Users/<USERNAME>/Desktop/Dev/src/gnupg-1.4.10
sudo ./configure --host=i386-apple-darwin --prefix=/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os
sudo make
sudo make install

cd /Users/<USERNAME>/Desktop/Dev/src/libgpg-error-1.7
sudo ./configure --host=i386-apple-darwin --prefix=/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os --enable-shared=no
sudo make
sudo make install

cd /Users/<USERNAME>/Desktop/Dev/src/libgcrypt-1.4.5
sudo ./configure --host=i386-apple-darwin --prefix=/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os --enable-shared=no --with-gpg-error-prefix=/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os --disable-asm
sudo make
sudo make install

sudo ./configure --host=i386-apple-darwin --prefix=/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os --with-libgcrypt-prefix=/Users/<USERNAME>/Desktop/Dev/src/libgcrypt-1.4.5
cd /Users/<USERNAME>/Desktop/Dev/src/libssh2-1.2.7
sudo make
sudo make install

The dylib that is produced shows as x86_64 and when trying to use the static library .a file in the iPhone app is says libssh2.a, file was built for unsupported file format which is not the architecture being linked (i386).

libgcrypt and the other required libraries have all compiled with no issue.

Thanks in advance!

  • 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-16T12:19:30+00:00Added an answer on May 16, 2026 at 12:19 pm

    I ran into pretty much this same problem. I was compiling libssh2, but I was using openssl with it. To force configure to compile in 32 bit mode you will need to set the CFLAGS and CPPFLAGS. Enter these commands in the terminal before you run configure:

    export CFLAGS=-m32
    export CPPFLAGS=-m32
    

    Before running ./configure in the Terminal, you need to set the CFLAGS and CPPFLAGS.

    export CFLAGS=-m32

    export CPPFLAGS=-m32

    To build libssh2 with openssl the way I did it first download the latest openssl and libssh2 source files from their respective sites. Go to the directory you downloaded and unzipped openssl to. I actually did the above commands after I built the openssl binaries and it didn’t seem to matter. They were required before building libssh2 though.

    ./configure –prefix=/TARGET_DIRECTORY

    make

    make install

    After that switch over to the folder where you downloaded and unzipped libssh2. Configure and build it with the following commands:

    ./configure –with-openssl –with-libssl-prefix=/OPENSSL_TARGET_DIRECTORY –prefix=/LIBSSH2_TARGET_DIRECTORY

    make

    make install

    You can find the *.a files to import into the Xcode project in the target directorys’ “lib” folders.

    As I’m sure you already know, this is only for the iPhone simulator. You’ll need to build for the arm architecture to use this library on a device.

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

Sidebar

Related Questions

I have been working on this for 24 hours now, trying to optimize it.
I've been working on this for a few hours now and can't find any
I've been trying to get this working for a few hours now. I have
I've been working on this for a few hours now. I am trying to
i have been working on this sub-menu for 8 hours now, the last little
I've been trying to figure this out for a few hours now. In order
I've been working on a solution to this for several hours now & figured
I've been struggling with a way to get this working for hours now, of
I've been trying to get this javascript animation to work for hours now, and
it's been a couple of hours now that I'm working on this and I

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.