How to make a simple C program universal from the command line???

Hi all,
I've developed widgets that use a simple C program. I had no clue how to make it universal. Apple documentation is all about big projects to be developed inside Xcode and so on, but I don't understand even the introductory remarks...
As far as I've read, I have to make a binary for PPC and a binary for i386, and then merge it with lipo. Fine. I get my PPC binary from:
gcc-4.0 prog.c -o prog_ppc -lm -arch ppc -arch ppc64
Now, it seems that I have to use:
gcc-4.0 prog.c -o prog_i386 -lm -arch i386
The latter command didn't work until I added -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/ at the end. With this, it creates a binary file, but with the following message:
/usr/bin/ld: warning fat file: /usr/lib/system/libmathCommon.A.dylib does not contain an architecture that matches the specified -arch flag: i386 (file ignored)
and I guess this is quite an issue if I don't have the common math functions, no?...
Can somebody help me? I googled a lot on this, and found nothing helpful.
Cédric

Thanks, it helped me. I googled a bit to build up my Makefile, and this is what I got.
CC= gcc-4.0
CFLAGS= -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
LDFLAGS= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -lm
TARGETS= skycalc.fixed.c
all: $(TARGETS)
$(CC) $(TARGETS) $(CFLAGS) $(LDFLAGS) -o skycalc_universal
Thanks again.

Similar Messages

  • How do I run a 10g rep file from the command line, send output to previewer

    Hi Everyone,
    We are migrating from Reports 2.5 to 10g.
    We are creating a batch file to run one of our reports that is in the .rep file format. Can you tell us what we need to put in the batch file to run the report as a paper report and have the reports runtime prompt the user for the login and show the report in the previewer just like in Reports 2.5?
    Thanks.
    Emad

    They should take a look at the "Oracle Application Server - Reports Services - Publishing Reports to the Web" from Application Server Doumentation downloadable from Reports Homepage http://otn.oracle.com/products/reports
    Martin

  • How to make a redirect without auto-redirect from the portlet "edit" mode?

    How to make a redirect without auto-redirect from the portlet "edit" mode?
    I use some sofisticated customizing with server-side validation of the form data. I want to redirect to the page of the portlet "show" mode and to the "edit" mode depending on the validation results. How can I do it?

    Heay.....this worked for me.
    I am able to change the mode programatically from edit to show.
    HttpPortletRendererUtil.handleEditAction(portletRenderRequest,"OK");
    I removed Apply , OK and Cancel buttons and applied my own Submit and Back button in Personalize mode and then change the mode to show on click of Back button using the above mentioned statement.
    Thanks
    ~Neeraj Sidhaye
    Try_Catch_Finally @ Y !
    ExtremePortal @ Gmail Dot Com

  • How to create an alias from the command line

    Hi
    I would like to know how to create an alias (for a file, not a command) from the command line. I don't want to use the ln command, as an alias has more interesting features than soft/hard links... Is there an Apple specific tool to do this?
    Thanks
    -Jerome
      Mac OS X (10.4.10)  

    The only straightforward way that I am aware of for creating a "Finder" alias from the command line is using AppleScript via 'osascript'. Of course, it's not really a command line solution since the "Finder" has to be running. Anyway, something along the lines of:
    <pre style="overflow:auto; padding: 5px; width: 500px ; font-size: 10px; border:1">osascript -e 'tell application "Finder" to make alias file to POSIX file "/full/path/to/file" at POSIX file "/full/path/to/folder"'</pre>

  • Running powewrpc programs from the command line

    I am trying to run a powerpc application (quicken) from the command line. I want to log into the mac over my local network and run a powerpc program, but I get the following when I try it:
    cannot execute binary file
    I am logging in via ssh, and am running the X11 package from a different unix system which also runs X11.
    How do I get the application to execute? (it runs fine from the desktop).

    I am sitting at a Sun Solaris machine (it runs X11R6
    and Matif). I want to run Quicken, which is on the
    mac mini. I log into the mac with ssh -X. I find the
    Quicken program, but the permissions are set to 644
    (read, but not execute). If I change the permissions
    and try to run the program I get teh error message
    "cannot execute binary file".
    The window interface of the Mac is not X11: so you cannot output it on another X system. Is is not like connecting to another Un*x system.
    Said that, you should be able to launch a program, but you cannot see the output. However, usually Macosx applications are bundles with some executable inside, not directly an executable file: .app files are folders, not files. In order to launch such kind of apps, you have to use the open command I suggested in the previous post.
    I have no idea what VNC is. If this is how I can do
    this, then please provide me a link to it.
    VNC is a screen sharing application, just like Windows Remote Desktop. You may install a VNC server on your mac mini, and then connecting with a VNC client you will see all your computer screen as if you were there. It is cross platform, so no matter which is your client (including mobile phones).

  • Help required - running a Java program from the command line

    Hi,
    I have a small non-graphical Java application, packaged into a Jar file. My program relies on classes in another (external) Jar file.
    When I run the application from the IDE, everything works fine. However, when I try to run the application from the command line, I keep getting a NoClassDefFoundError for classes in the external jar.
    Both the application jar file and the external jar file are in my root directory (C:\).
    My command line call is as follows:
    java -cp c:MyExternalLib.jar -jar MyApp.jar
    Any help greatly appreciated.
    Thanks,
    Walter

    hi,
    set classpath=%classpath%;c:\myjar.jar;
    here i have specified myjar.jar file as an example u give ur location.after setting the classpath run ur java application.
    java mypgm
    this will solve ur problem
    regards,
    Ganesh

  • Problem with running a java program from the command line

    I have this code:
    package pkg;
    import jxl.*;
    import java.io.File;
    public class TestClass {
         public static void main(String[] args) {
              try{
                   Workbook book = Workbook.getWorkbook(new File("d:/testWorkspace/excFile.xls"));
                   Sheet sheet = book.getSheet(0);
                   String s=sheet.getCell(4, 2).getContents();
                   System.out.println(s);     
              }catch (Exception e){System.err.println(e);}
    }I've wrote it in Eclipse, added jxl.jar to the buildpath, and it works fine.
    Then I tried to run it from the command line and I did it like this:
    D:\testWorkspace\testProject\bin> java -cp \jxl.jar pkg.TestClassThe result was:
    Exception in thread "main" java.lang.NoClassDefFoundError: pkg/TestClass
    Caused by: java.lang.ClassNotFoundException: pkg.TestClass
    ...but the file TestClass.class DOES exist in the folder d:\testWorkspace\testProject\bin\pkg\ and the file jxl.jar IS on the root of drive D (like I already wrote, it worked fine inside the Eclipse).
    So, my question is: How to run this code from the command line?
    I have no idea what went wrong.
    Can someone help me, please?

    The current directory is not implied in the classpath.
    D:\testWorkspace\testProject\bin> java -cp .;d:\ pkg.TestClassor
    D:\testWorkspace\testProject\bin> java -cp .;d:\jxl.jar pkg.TestClassI always forget which is right since I never work with jars...

  • How can I print the test page with the Arabic type from the command line

    Hi,
    I have been trying to make the tool for printing the test page from the command line on the Arabic OS. I used "rundll32 printui dll printuientry" with "/k /n" options. My tool is to print the test page in all OS when pushing the
    button.
    Normally, in the Arabic Windows, the test page is printed with RTL type when printing the test page in the "Devices and Printers". But in my tool, the test page is printed with LTR type. I'm confused because of this result.
    Is it possilbe to print the test page with RTL type when using the "rundll32 printui dll printuientry"? If it is possible, could anyone give me the hint or information for resolving?
    Please check for me.

    Hello,
    Thank you for your post.
    Your issue is out of support range of Test Tools in Visual Studio 2010 and 2012 forum which discusses Visual Studio Test issues.
    I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to burn CD's from the command line in 2009?

    I've always managed to burn CDs and DVDs from the command line but I haven't done it in a long time. cdrecord wasn't working as root and I noticed it was just a symlink pointing to wodim.
    I tried the following command as root in a directory with some wav files:
    # cdrecord -dev=/dev/sr0 -driveropts=burnfree -audio -pad *.wav
    Which gives me:
    Mar 6 08:43:18 wilco ata7.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
    Mar 6 08:43:18 wilco ata7.00: cmd a0/00:00:00:00:00/00:00:00:00:00/a0 tag 0
    Mar 6 08:43:18 wilco cdb 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Mar 6 08:43:18 wilco res 40/00:02:00:0c:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
    Mar 6 08:43:18 wilco ata7.00: status: { DRDY }
    Mar 6 08:43:18 wilco ata7: hard resetting link
    Mar 6 08:43:19 wilco ata7: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
    Mar 6 08:43:19 wilco ata7.00: configured for UDMA/100
    Mar 6 08:43:19 wilco ata7: EH complete
    This worked for me in 2008, so has anything big changed?

    Rasi wrote:
    Wilco wrote:
    Dieter@be wrote:I did not follow the discussion, but I just use wodim as specified on http://wiki.archlinux.org/index.php/CD_Burning_Tips, and that works great for me.
    Hmm strange, I tried the same command as in my first post and it works fine with the real cdrtools but not with wodim (I also tried k3b and that failed too). So I just stick with cdrtools
    Hooray, one more convert
    I haven't really followed the discussion either but why choose an "emulated cdrecord" that doesn't work instead of the real program that works great?

  • How to execute SAPGUI script from the command line?

    I have created a script and would like to execute it from the command line. There must be some flag that goes with SAPGUI.EXE. Any help appreciated.
    Thanks,
    Jeff

    Hi Jeff,
    the best way to do this is to run the script using the Windows Script Host, for example like this:
    cscript myscript.vbs
    This will execute the script which in turn can access SAP GUI. You may however have to make sure the script attaches to the correct session.
    Best regards,
    Christian

  • How do shutdown the weblogic server from the command line prompt using web logic 8.1

    I%u2019m currently using weblogic 6.1, but I will upgrade to weblogic 8.1. In weblogic 6.1, the following statements will shutdown the weblogic instance from the command line:
    java weblogic.Admin -url t3://hostname:port -username system -password abc SHUTDOWN
    How do I shutdown the weblogic server from the command line prompt using web logic 8.1.
    Any help will be greatly appreciated.
    Maria

    Maria <[email protected]> wrote:
    How do I shutdown the weblogic server from the
    command line prompt using weblogic 8.1?Greetings Maria! Use this document, located here:
    http://edocs.bea.com/wls/docs81/admin_ref/cli.html#1131733
    Hope this helps...
    Brian J. Mitchell
    Systems Administrator, TRX
    email: [email protected]
    office: +1 404 327 7238
    mobile: +1 678 283 6530

  • How to make an appointment with a contact from the address book directly to iCal

    What is the easiest way to make an appointment with a contact from the address book. My idea is that once you identify a contact down the bottom where it has Text message Share contact, add to favorites it would be nice if it had make appointment in iCal. The open up iCal to todays date and go from there with all the relevant details?

    In the Print dialogue box select Lists in the Style drop down box.

  • How can I open a PDF file and enter a word in the Find field from the command line?

    Hi,
    I want to use a PDF file as the help file of another program.
    I have found somewhere an incomplete description of the command line parameters of Acrobat Reader.
    It described how to open a file and jump to its given page.
    I have written the following batch file based on that.
    rem Open pdf (prm1) with Acrobat reader at given page (prm2)
    "%adobe_rdr%\AcroRd32.exe" /N "zoom=73&page=%2=OpenActions" %1
    The following batch file opens the search dialog:
    rem Open pdf (prm1) with Acrobat reader
    rem and search for something (prm2)
    "%adobe_rdr%\AcroRd32.exe" /N "zoom=73&navpanes=1=OpenActions&search=%2" %1
    I need the simple find field instead of the complicated search window.
    Regards
                   Ferenc

    Not possible.

  • How can I start System Preferences from the command line?

    Hello All,
    I have an issue I'm not quite sure how to solve. I have been tasked within my business environment  with tightening security on a Mac Leopard system and I've been granted Admin Rights to do this on a temporary basis.
    The problem is as follows:
    1) The original Sys Admin that set up this system is gone, no longer available.
    2) He was a Dvorak Keyboard fan and set up the system for a Dvorak Keyboard.
    3) The system actually has a standard Apple keyboard and is marked accordingly, i.e., qwerty (Most Users in the building have stopped using this system altogether - a terrible waste of a good system - even though some of their apps can be run normally (US style qwerty settings). The command line is useless, as is texteditor.app and a few others unless you know Dvorak layout)
    5) When I open System Preferences, the Dvorak keyboard checkbox is grayed out and I cannot change it. There is no lock at the bottom of that particular screen for me to unlock.
    6) Even though I select the US Keyboard at Login, and some apps work accordingly (like MatLab for example) the terminal is borderline useless. I spent over 2 hrs yesterday doing what should have been able to be done in about 30 minutes. I estimate a frustrating and mistake prone additional 8 to 10 hours to do what is normally a a 4 hour job at the command-line.
    7) I do not have the time or desire to re-mark all the keys on the keyboard, particularly since it is not my call to do so, nor do I have the time to re-learn Dvorak touch-typing, and finally I do not want to re-load the entire system. I just want to change the darn keyboard to a standard qwerty keyboard that is somewhat useful in a terminal environment with vi, command line, etc. It's either that or I go mildly insane
    This is frustrating as all get-out. The new Admin logged in and was able to uncheck his Dvorak settings (he is not a UNIX guy, nor is he comfortable om Macs), and we were hoping this was a system wide setting, but No. We re-booted the system, I logged in, still Dvorak, and the checkbox was still grayed out.
    So I figure, short of re-loading the entre system and all the applications necesary, I can either start the Systems Preferences GUI using sudo and hopefully that will change system-wide settings, or I can delete the .AppleSetupDone file and resetup the system (if the keyboard settings are part of the setup) without spending a couple of days reloading everything and re-setting up users, networks, etc.
    Needless to say, I am hoping for the easiest and quickest solution to this extremely frustrating and  aggravating problem.
    Thanks.

    For my situation the following C# code does the job:
        Process.Start(
           @"c:\Program Files\National Instruments\CVI71\cvi.exe",
           @"c:\temp\experiment.c" );
    The file must already exist.

  • How do i create a database template from the command line?

    Hi,
    As part of implementing a backup and recovery strategy for a client (including disaster recovery) I want to automate the creation of a database template From an Existing Database (Structure as well as data) via a script that will run every night.
    The background to this is that we will also be using RMAN to take backups of the database concerned but the client does not want to wait while an RMAN backup is restored and so wants an additional level of insurance in the form of a ‘standby’ clone database.
    The idea is that nightly we will run a script that creates a database template from the Existing Database (Structure as well as data) and then transfers the 2 files involved e.g. DB_data_included.dbc and DB_data_included.DFB across to a standby server where they can be used to recreate the database in the event of us needing to after e.g. a complete server failure.
    So I have a couple of questions about this that I would be very grateful if something could answer for me:
    1)     Is it possible? That is, can a database template be created from some utility by supplying a series of parameter=value pairs on the command line?
    2)     If yes how do I go about it, what utility do I use (the emca utility?). and what parameters do I need to supply on the command line to create the template?
    3)     The intention is that the script to create the template will run in the early hours of the morning when no-one is using the database but what state does the database need to be in when the template creation script runs i.e. up, down, mounted and does the creation of a template affect the state of an already up database i.e. if I kick off the template creation script and the database is up will it switch it into mount mode or anything like that? My concern here is that I want to make sure I understand exactly what is going on so that no users or connected external systems are affected?
    Thanks in anticipation of someone being able to guide me on what to do or what documentation to read.
    Also if you require any clarification on what i'm asking please post up your query and i'll respond ASAP.
    Kind Regards,
    George Johnston
    OCP 9i DBA

    Sybrandb,
    Firstly thanks for you reponse.
    However, I don’t agree that dbca only creates empty databases otherwise why does the option to create a template from an existing database (structure as well as data) exist in the dbca wizard?
    I have performed a test case where I have a created a database template including data on one 10g server. I have then used the files generated to recreate that database on a separate server. When the new database is started it is an exact copy of the original. So it’s not empty at all , it’s exactly what the client wants.
    So I don’t agree that I’m gaining zero.
    Why is this approach doomed to fail?
    There a number of reasons why I “just set up a proper standby database”
    1.     Time – I’m on a customer site in a tight engagement where the customer wants maximum value for money. I don’t have standby database skills and the customer isn’t willing to pay for me to learn on the job so please understand the tight circumstances I’m working in.
    2.     Availability – As far as I know the client is running 10.2.0.3.0 standard edition. Correct me if I’m wrong but is standby db available in that edition. Where do I look to check V$OPTION.
    On the RMAN duplicating a database front it’s an area I haven’t used before but I will take a look at it.
    Also please revisit the context of my original posting where I state
    The background to this is that we will also be using RMAN to take backups of the database concerned but the client does not want to wait while an RMAN backup is restored and so wants an additional level of insurance in the form of a ‘standby’ clone database.
    So please understand that this a quick fix that the client wants developed in the minimum time possible in ADDITION to a full nightly RMAN backup being taken.
    In an ideal world I’d have the time to follow best practice but in the real world of on-site customer support I just need to get the job done operating under the customer imposed constraints.
    Many Thanks,
    George Johnston
    OCP 9i DBA

Maybe you are looking for

  • Problem with top of page in interactive ALV

    Hello all, I am displaying 2 level ALV list. If List heading for the first page is 'First level' and for Second level list is 'Second level'. but when I come back to first level list from second level using back button first level list shows me top o

  • Burning issues

    Hey! Sorry if this question has already been addressed but I am new to this forum. I am using a powerbook G4. I have iMovie HD 5.0.2 and iDVD 5.0.1 I have created an iMovie that is just a little over an hour long. It is just photos set at 3 sec time

  • Saving Numbers Spreadsheet

    Excel opens at the exact saved row and cell position, is there a way of saving Numbers to do this?

  • BPC 7.0MS SP6 on VMWare

    Anyone using BPC 7M in a virtualized environment? I understand SAP does not recommend virtualized servers for production use but tryng to figure out if anyone has had any success with this approach in production. Also, is there any documentation rela

  • Some of my key are not working.

    My N, M, H, J, T, Y, 5 and 6 are not working.   I have to tried to restart several times and my num lock is not on.  Not sure how to fix.