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

The Archive Base Latest Questions

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

I’m trying to compile again the libpq for arm and i386 with the iOS

  • 0

I’m trying to compile again the libpq for arm and i386 with the iOS SDK 4.2.

I did last year for SDK3.x without any problems.

Now, when I want to create the fat binary file with two files, I’m getting this error:

specifed architecture type (arm) for file (/Users/montx/mylibs_sdk42/libpq.arm) does not match its cputype (7) and cpusubtype (3) (should be cputype (12) and cpusubtype (0))

I’m compiling again because my compiled files doesn’t work with the latest iOS4.2

Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
fcntl$UNIX2003 called from function pg_set_noblock in image GlobalScan.
If you are encountering this problem running a simulator binary within gdb, make sure you 'set start-with-shell off' first.

thanks!

Here is the full script:

#!/bin/bash

DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
SDKROOT=$DEVROOT/SDKs/iPhoneOS4.2.sdk

rm -rf  /Users/montx/mylibs_sdk42
mkdir /Users/montx/mylibs_sdk42 #Store there compiled libs
make clean

#Build ARM library
./configure --host=arm-apple-darwin --without-readline --disable-ipv6 CC=$DEVROOT/usr/bin/arm-apple-darwin9-gcc-4.0.1 CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.0.1/include/ -I$SDKROOT/usr/include/" CFLAGS="$CPPFLAGS -arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT" CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS" LD=$DEVROOT/usr/bin/ld
make -C src/interfaces/libpq
cp /Users/montx/Downloads/postgresql-8.4.1/src/interfaces/libpq/libpq.a /Users/montx/mylibs_sdk42/libpq.arm


#Build ARM library
./configure --host=arm-apple-darwin --without-readline --disable-ipv6 CC=$DEVROOT/usr/bin/arm-apple-darwin9-gcc-4.0.1 CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.0.1/include/ -I$SDKROOT/usr/include/" CFLAGS="$CPPFLAGS -arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT" CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS" LD=$DEVROOT/usr/bin/ld



#Then build i386 library ==> the simulator is 32bits


CFLAGS="$(OTHER_CFLAGS) -mmacosx-version-min=10.5"
LDFLAGS="$(OTHER_LDFLAGS) -mmacosx-version-min=10.5"

make clean && ./configure CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" && make -C src/interfaces/libpq


cp src/interfaces/libpq/libpq.a  /Users/montx/mylibs_sdk42/libpq.i386

#Then make fat binary
$DEVROOT/usr/bin/lipo -arch armv6 /Users/montx/mylibs_sdk42/libpq.arm -arch i386 /Users/montx/mylibs_sdk42/libpq.i386 -create -output  /Users/montx/mylibs_sdk42/libpq
  • 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-20T17:07:43+00:00Added an answer on May 20, 2026 at 5:07 pm

    This works for me for the arm library but I’m using gcc 4.2 and I’m targeting armv7

    DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
    SDKROOT=$DEVROOT/SDKs/iPhoneOS4.2.sdk
    ./configure --host=arm-apple-darwin --without-readline --disable-ipv6 \
      CC="$DEVROOT/usr/bin/gcc" \
      CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin10/4.2.1/include/ \
                -I$SDKROOT/usr/include/" \
      CFLAGS="$CPPFLAGS -arch armv7 -pipe -no-cpp-precomp -isysroot $SDKROOT" \
      CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS" \
      LD=$DEVROOT/usr/bin/ld 
    make -C src/interfaces/libpq 
    cp src/interfaces/libpq/libpq.a lib/libpq.arm
    

    My old script for the simulator doesn’t work anymore though, and it usto work fine again iOS 3.2.

    DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer 
    SDKROOT=$DEVROOT/SDKs/iPhoneSimulator4.2.sdk
    $ROOT_DIR/configure --host=i386-apple-darwin  \
      CC="$DEVROOT/usr/bin/gcc" \
      CPPFLAGS="-I$SDKROOT/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ \
                -I$SDKROOT/usr/include/ -mmacosx-version-min=10.5" \
      CFLAGS="$CPPFLAGS -arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT \
              -mmacosx-version-min=10.5" \
      CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS" \
      LD=$DEVROOT/usr/bin/ld
    
    make -C $ROOT_DIR/src/interfaces/libpq
    

    Updated

    Here is the complete script. Drop the bash script in the postgres directory and build. In your project include $POSTGRESDIR/src/include and $POSTGRESDIR/src/interfaces/libpq to get the headers necessary. Note this works for Postgres 8. Haven’t tested it on Postgres 9.

    #!/bin/bash
    set -e
    
    if [ -d "./lib" ]
    then
        echo "Existing libs deleted"
        rm -rf lib/*
    else
        echo "Generating output directory"
        mkdir lib
    fi
    
    if [ -e "./src/Makefile.global" ]
    then
        make -C ./src/interfaces/libpq distclean
    fi
    
    chmod u+x ./configure
    
    #Build i386 library
    DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer 
    SDKROOT=$DEVROOT/SDKs/iPhoneSimulator4.2.sdk
    ./configure --host=i386-apple-darwin  --without-readline --disable-ipv6 \
      CC="$DEVROOT/usr/bin/gcc-4.2" \
      CPPFLAGS="-I$SDKROOT/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I$SDKROOT/usr/include/ -mmacosx-version-min=10.5" \
      CFLAGS="$CPPFLAGS -arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -mmacosx-version-min=10.5" \
      CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS" \
      LD=$DEVROOT/usr/bin/ld
    
    make -C ./src/interfaces/libpq
    cp ./src/interfaces/libpq/libpq.a lib/libpq.i386
    
    #Build ARM library
    make -C ./src/interfaces/libpq distclean
    
    DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
    SDKROOT=$DEVROOT/SDKs/iPhoneOS4.2.sdk
    ./configure --host=arm-apple-darwin --without-readline --disable-ipv6 \
      CC="$DEVROOT/usr/bin/gcc-4.2" \
      CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin10/4.2.1/include/ -I$SDKROOT/usr/include/" \
      CFLAGS="$CPPFLAGS -arch armv7 -pipe -no-cpp-precomp -isysroot $SDKROOT" \
      CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS" \
      LD=$DEVROOT/usr/bin/ld 
    make -C ./src/interfaces/libpq 
    cp ./src/interfaces/libpq/libpq.a lib/libpq.arm
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

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.