将应用程序从 Solaris 移植到 Linux

发布于 2024-07-10 15:51:18 字数 167 浏览 9 评论 0原文

我将承担将相当大的 C++ 网络应用程序代码库从 Solaris 移植到 Linux 平台的任务。 该代码还使用了 ACE 等第三方库。 该应用程序最初编写时并没有计划将来可能进行移植。

我想就如何完成这项任务获得一些意见和建议。 最好遵循什么方法。

-帕布。 S

I am to take up the task of porting a C++ networking application code base of quite a size from Solaris to Linux platform. The code also uses third party libraries like ACE. The application when written initially was not planned for a possible porting in future.

I would like to get some advice and suggestions as to how I go about the task. What would be the best methods to follow.

-Prabhu. S

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

墨小沫ゞ 2024-07-17 15:51:18

ACE 是一个优点,因为它是多平台的。 您必须检查字体大小的使用地点和方式。 如果使用 ACE_* 基本类型,您将在那里取得成功,因为它们是可移植的,否则我将首先将 Solaris 版本更改为使用多平台数据类型和元素(使用 ACE 设施,因为您已经拥有了它)。

如果您使用任何仅限 Solaris 的外部库,则必须在 Linux 中找到等效的库并编写一个包装器,以便应用程序的其余部分不需要知道正在使用什么实现。

之后,只需一个代码库即可直接迁移到 Linux。 您应该对其进行全面编译和测试。

ACE is a plus there, as it is multiplatform. You must check where and how your type sizes are used. If ACE_* basic types are used you are hitting a streak there, as those are portable, else I would start by changing the Solaris version into using multiplatform data types and elements (use ACE facilities since you already have that in place).

If you are using any Solaris only external library, you will have to locate an equivalent in linux and write a wrapper so that the rest of the application does not need to know what implementation is being used.

After that, migration into linux should be straight forward with just one code base. You should compile and test it through-fully.

≈。彩虹 2024-07-17 15:51:18

“不存在可移植应用程序,只有已移植的应用程序”

首先,如果可以的话,在两个平台上使用相同的工具。 IE 如果 Solaris 版本尚未更改为使用 GCC 和 GNU make 等,我建议您首先更改此设置并让 Solaris 构建工作。 您会发现您将首先修复编译器问题,而不是在尝试移植应用程序的同时尝试在 Linux 上修复它们。

其次,确保您可以在每个平台上以相同的版本获得所有相同的库。 我想你可以获得 Linux 版的 ACE。 确保该版本的库可以在 Solaris 上运行。 这将限制兼容性问题。

一旦你做到了这一点,真正的工作就开始了。

您需要一次编译每个源文件并找到 Linux 中不可用的功能。 首先寻找在两种操作系统中都可用的替代品。 如果没有简单的替换,则创建两个库,一个用于 Solaris,一个用于 Linux。 创建包装类或函数来抽象掉不兼容性。

如果这听起来像是一项繁重的工作——确实如此。

"There is no such thing as a portable application only applications that have been ported"

First start with using the same tools on both platforms, if you can. I.E. if the Solaris version has not been changed to use GCC and GNU make etc, I advise you to change this first and get the Solaris build working. You will find that you will fix compiler problems first and not try to fix them on Linux at the same time as trying to port the application.

Second make sure you can get all the same libraries on each platform at the same version. I think you can get ACE for Linux. Make sure that the libraries at that version work on Solaris. This will limit compatibility problems.

Once you have done that then the real work starts.

You will need to compile each source file one at a time and find the functions that are not available in Linux. First look for a replacement that is available in both OSs. If there is no simple replacement then create two libraries one for Solaris and one for Linux. Create wrapper classes or functions to abstract the incompatibilities away.

If this sounds like a lot of work - it is.

謸气贵蔟 2024-07-17 15:51:18

我同意大卫·艾伦·芬奇所写的内容。 一步一步地占领港口。 另外:

您来自 Solaris/SPARC 还是 Solaris x86? 如果是 x86,则不会出现字节序问题,但如果是 SPARC,则需要检查代码以确保不存在字节顺序(字节序)问题。

Solaris 代码是 32 位还是 64 位? 当然,最初保持地址空间相同。

I'm in agreement with what David Allan Finch wrote. Take the port one step at a time. In addition:

Are you coming from Solaris/SPARC or Solaris x86? If it's x86, you'll have no endian issues, but if it's SPARC, you'll need to examine your code to make sure that there are no byte-order (endian) issues.

Is the Solaris code 32-bit or 64-bit? Certainly keep the address space the same initially.

假装不在乎 2024-07-17 15:51:18

列出您当前的外部依赖项。 查找 Linux 上可用的这些内容。 对于那些没有的人,你必须找到替代品。 如果对这些外部依赖项的引用没有抽象到函数或对象后面,请重构代码,使其如此。 然后替换依赖项,以便您可以通过替换来实现抽象功能。

List what your current external dependencies are. Find what of these are available on Linux. For those that aren't, you have to find a replacement. If the references to those external dependencies aren't abstracted away behind functions or objects, refactor the code so it is so. Then replace the dependencies, so you can implement the abstracting functions with the replacement.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文