LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-29-2024, 03:45 PM   #1
PsychoHermit
Member
 
Registered: Aug 2021
Location: Carson City Nevada
Distribution: Debian Testing
Posts: 137

Rep: Reputation: Disabled
Transferring a C program from a Mac to an IBM clone


Greetings folks,

Maybe a dumb question but can you transfer a C program from an Intel based Mac to an IBM clone and expect it to work? I'm assuming there is communication to/from USB involved.

Would it need to be compiled on the IBM clone or would it just work?

Thanks,
--glenn
 
Old 03-29-2024, 04:04 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by PsychoHermit View Post
Greetings folks,
Maybe a dumb question but can you transfer a C program from an Intel based Mac to an IBM clone and expect it to work? I'm assuming there is communication to/from USB involved. Would it need to be compiled on the IBM clone or would it just work?
Several things; first, the term 'transfer' is nebulous...could mean FTP, SCP, SFTP, NFS, Samba, or any number of ways, including USB sticks or bluetooth. A C program is only code/ASCII text. Second, a compiled program for a Mac won't work on a PC, no matter what it's running...Mac OS isn't Linux or Windows. Programs for one are compiled on that platform, using that platforms libraries and drivers. Otherwise, why would companies have different versions for Mac, Windows, or Linux???

Copy the C source code over however you want. You will then have to compile it...and it *MIGHT* work. If it uses specialized Mac libraries that aren't present/available for whatever else you're compiling on, then it's up to you to either find those and install them, or in some cases, write your own work-arounds.
 
1 members found this post helpful.
Old 03-29-2024, 04:06 PM   #3
PsychoHermit
Member
 
Registered: Aug 2021
Location: Carson City Nevada
Distribution: Debian Testing
Posts: 137

Original Poster
Rep: Reputation: Disabled
That's what I was thinking, than you very much.

--glenn
 
Old 03-29-2024, 04:16 PM   #4
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,638

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
Also the term "IBM clone" is interesting. Are we talking an IBM Mainframe, IBM Midrange, IBM SP2, IBM PC, or perhaps an IBM Selectric Typewriter?

I am betting the IBM PC, but IBM has released a LOT of products over the years!

Although it would be an intriguing IBM Selectric clone that would run a C compiler....

Transferring source is just transferring text. If the target does not use EBCDIC you may not even need to translate.
The differences in the standard libraries might make porting a pain, but I have not tested to see how MUCH of a pain.
 
1 members found this post helpful.
Old 03-29-2024, 04:25 PM   #5
PsychoHermit
Member
 
Registered: Aug 2021
Location: Carson City Nevada
Distribution: Debian Testing
Posts: 137

Original Poster
Rep: Reputation: Disabled
Yes, an IBM Compatible PC. AMD_64 I'm guessing.

Thanks,
--glenn
 
Old 03-29-2024, 07:26 PM   #6
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,638

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
Can you expect it to work? Yes.
Without a LOT of fixing and translation to the compiler and library on the target machine? Probably not.
I mean, it IS possible, but seriously unlikely and the bigger the project the less likely it is to compile without issues.
This would be considered a "porting project".
 
1 members found this post helpful.
Old 03-30-2024, 05:03 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,662
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
If you are moving from "Intel iron" to "Intel iron," and are careful with your type definitions and compiler options, you can usually "port" an application from one compiler to another with a minimum of fuss. It's easier if the compiler that you want to use is available on both.
 
1 members found this post helpful.
Old 03-30-2024, 05:10 PM   #8
PsychoHermit
Member
 
Registered: Aug 2021
Location: Carson City Nevada
Distribution: Debian Testing
Posts: 137

Original Poster
Rep: Reputation: Disabled
I won't be the one doing the porting but I will pass that on to the guy doing the work.

Thank you,
--glenn
 
Old 03-31-2024, 07:03 AM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,662
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
The gcc compiler [suite ...], for instance, does run on both platforms. There are various online tutorials which show you how to do it. But, Microsoft makes excellent compilers, too. In short, you have several good ways to approach this problem, and you should be successful.

Last edited by sundialsvcs; 03-31-2024 at 07:08 AM.
 
1 members found this post helpful.
Old 03-31-2024, 07:52 AM   #10
PsychoHermit
Member
 
Registered: Aug 2021
Location: Carson City Nevada
Distribution: Debian Testing
Posts: 137

Original Poster
Rep: Reputation: Disabled
OK

Thank you,
--glenn
 
Old 03-31-2024, 09:40 AM   #11
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,226

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Assuming you’re copying the C source code over and compiling it: the answer is “maybe; try it.”

If you’re copying the compiled binary over, then the answer is no.
 
Old 03-31-2024, 10:35 AM   #12
PsychoHermit
Member
 
Registered: Aug 2021
Location: Carson City Nevada
Distribution: Debian Testing
Posts: 137

Original Poster
Rep: Reputation: Disabled
Yeah, as soon as the computer is available. Another guy is looking at it at the moment.

Thanks,
--glenn
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Clone and boot from clone geelsu Linux - Server 5 12-17-2018 12:03 PM
LXer: Open-spec SBC is a clone of a clone of a clone of a Raspberry Pi 3 LXer Syndicated Linux News 0 04-25-2018 04:56 PM
Linux 64 bit fresh install, created clone on cd, want to use clone on another laptop... apollo1980 Linux - Software 12 10-12-2017 02:59 PM
I need to Clone a Red Hat drive and install clone in HP server drummer54 Linux - Newbie 14 03-07-2009 04:15 PM
bugzilla: to clone, or not to clone? The00Dustin Linux - Newbie 1 05-24-2008 05:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration