29
1 © 2017 Rogue Wave Software, Inc. All Rights Reserved.

How to migrate SourcePro apps from Solaris to Linux

Embed Size (px)

Citation preview

Page 1: How to migrate SourcePro apps from Solaris to Linux

1© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Page 2: How to migrate SourcePro apps from Solaris to Linux

2© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Stephane Raynaud

SourcePro & .h++ Specialist

[email protected]

Doug Sanders

Account Executive

[email protected]

Consultant: IMPLEMENTING

Consulting Mgr.: REQUIREMENTS

V.P. Technical Services: MANAGING

“Merely sharing my experience”

15 years of experiences at Rogue Wave

Page 3: How to migrate SourcePro apps from Solaris to Linux

3© 2017 Rogue Wave Software, Inc. All Rights Reserved.

• Why?

• Planning

• Ready… Set… Go!

• Port’s done! Let’s run it!!!

• A few last words & conclusion

• Q&A

Page 5: How to migrate SourcePro apps from Solaris to Linux

5© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Why migrate?

• Unification

• Commodity O.S. & Virtualization

• Large Community and available skillset

• On-Par O.S. Quality

• End Of Life

Page 6: How to migrate SourcePro apps from Solaris to Linux

6© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Page 7: How to migrate SourcePro apps from Solaris to Linux

7© 2017 Rogue Wave Software, Inc. All Rights Reserved.

The C++ 4.x compilers predate the 1998 C++ standard. The version of C++ recognized by C++ 4.x does not correspond to any published standard. It follows the C++ Annotated Reference Manual (1990), with a few additions from what was expected to become part of the 1998 C++ Standard.

Product nameVersion number

C/C++ compiler

Supported Operating Systems

Release date

SPARCworks 2.0 2 Solaris 1992

SunSoft Workshop 1.0 3 Solaris Jul-94

SunSoft Workhop 2.0 4 Solaris Mar-95

Sun Workshop 3.0 4.2 Solaris Jan-97

Sun Workshop 5 5 5 Solaris Dec-98

Forte Developer 6 (Sun WorkShop 6) 6 5.1 Solaris May-00

Forte Developer 6 update 1 6.1 5.2 Solaris Nov-00

Forte Developer 6 update 2 6.2 5.3 Solaris Jul-01

Sun ONE Studio 7 (Forte Developer 7) 7 5.4 Solaris May-02

Sun ONE Studio 8 Compiler Collection 8 5.5 Solaris May-03

Sun Studio 8 8 5.5 Solaris Mar-04

Sun Studio 9 9 5.6 Solaris, Linux Jul-04

Sun Studio 10 10 5.7 Solaris, Linux Jan-05

Sun Studio 11 11 5.8 Solaris, Linux Nov-05

Sun Studio 12 12 5.9 Solaris, Linux Jun-07

Sun Studio 12 Update 1 12.1 5.1 Solaris, Linux Jun-09

Oracle Solaris Studio 12.2 12.2 5.11 Solaris, Linux Sep-10

Oracle Solaris Studio 12.3 12.3 5.12 Solaris, Linux Dec-11

Oracle Solaris Studio 12.4 12.4 5.13 Solaris, Linux Nov-14

Oracle Developer Studio 12.5 12.5 5.14 Solaris, Linux Jun-16

Oracle Developer Studio 12.6 12.6 5.15 Solaris, Linux Jun-17

C++ Rogue Wave tools.h++ Librarytools.h++ is a C++ foundation class library that was provided in previous releases of Oracle Solaris Studio and Sun Studio software. The library was released in 1996 and has not been significantly updated since. The time and date classes have serious bugs that cannot be fixed. The functionality in tools.h++ is available with a different programming interface (API) in the C++ Standard Library provided in Oracle Solaris Studio and in the open source BOOST libraries. For information about BOOST libraries see http://www.boost.org.

-compat=4 option in the C++ compilerThe -compat=4 option sets the C++ compiler to compatibility mode. That is, it sets language and binary compatibility to that of the 4.0.1, 4.1, and 4.2 compilers. It sets the __cplusplus preprocessor macro to 1 and the __SUNPRO_CC_COMPAT preprocessor macro to 4.Sun Studio 11 https://docs.oracle.com/cd/E19422-01/819-3689/

Page 8: How to migrate SourcePro apps from Solaris to Linux

8© 2017 Rogue Wave Software, Inc. All Rights Reserved.

CentOS

Oracle Linux + GCC: Getting Traction

Oracle Linux + Sun Studio“You are the odd duck out there”

Advice: GCC and stay with the version for that OS Version

• Guaranteed service level agreements (SLAs) with all support contracts• 12x5 Silver Support or 24x7 Gold Support with around-the-clock coverage• Access to Tier 3/4 open source architects and a dedicated CentOS development team• Patches and hotfixes hosted on our own CentOS repository

Page 9: How to migrate SourcePro apps from Solaris to Linux

9© 2017 Rogue Wave Software, Inc. All Rights Reserved.

This project may not even be a “Go”

• Customer requested a port to Linux

• Application was managing “Office Location”

• Small portion of code relied on a 3rd party application for “localization”

• Customer was “warned” but didn’t see the issue

Port started but had to stop 3 weeks in because this library wasn’t available nor “deemed”

portable to LINUX.

Investigate carefully your dependencies regardless of how “insignificant” they may appear

Page 10: How to migrate SourcePro apps from Solaris to Linux

10© 2017 Rogue Wave Software, Inc. All Rights Reserved.

“How will I know I have success?”

Rogue Wave libraries have been tested

through 1,000s of use cases

“Batman”

Rogue Wave will run on the newly built binaries the same exact tests used by Rogue Wave development to validate a regular release of SourcePro. Rogue Wave will share the results of these tests with Client, and will let client know if the new binaries are producing the same results than the SourcePro 9 Update 1 release on a supported platform (usually a 100% pass).

Plan for a testing & validation strategy

Develop Validation Plans and test cases if they don’t exist

Page 11: How to migrate SourcePro apps from Solaris to Linux

11© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Note: you may use rwtools even if you don’t use this option. Check for RW Classes in your code…

tools.h++ is a C++ foundation class library that was provided in previous releases of Oracle Solaris Studio and Sun Studio software. The library was released in

1996 and has not been significantly updated since. The time and date classes have serious bugs that cannot

be fixed. The functionality in tools.h++ is available with a

different programming interface (API) in the C++ Standard Library provided in Oracle Solaris Studio and

in the open source BOOST libraries. For information about BOOST libraries see http://www.boost.org.

(from Oracle Studio Documentation)

FALSE: The new versions are named SourcePro Core – Essential Tools and have been updated to support customers to this day

MISLEADING: C++ Standard Library and BOOST offers some overlapping functionalities but this is neither a complete nor a

one to one mapping.

EASY SOLUTION: SourcePro Core – Essential ToolsExactly the same API for RW Classes on Linux from what you used on Solaris

(Only options if using other .h++ product, such as dbtools.h++)

Migrating to STLMigrating to

BOOSTRefactoring .h++

Code in my own class

Watch out for misleading blogs(LOL!) Example

“In 2005, Rogue Wave handed over the tools.h++ to Apache Foundation” … WHAT?!!??!?! This can put you in trouble. (TOTALLY FALSE)

Page 12: How to migrate SourcePro apps from Solaris to Linux

12© 2017 Rogue Wave Software, Inc. All Rights Reserved.

The great mistake of “one thing at a time”

4 step-plan migration:

• Solaris/Oracle Studio/Oracle 8G

• Linux/Oracle Studio/Oracle 8G

• Linux/Oracle Studio/Oracle 12c

• Linux/gcc/Oracle 12c

Why?4X the pain!

Want a better use of your time?Run a static-analysis on your code first to make

sure the code is up to standard & secure!

Contact us about Klocwork !!!

Page 13: How to migrate SourcePro apps from Solaris to Linux

13© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Page 14: How to migrate SourcePro apps from Solaris to Linux

14© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Warning: I have seen people waste months!

STEP1: Define your compilation and link options (*)

STEP2: Modify Your Code

REPEAT AFTER ME: STEP1 first, STEP2 second

The brutal truth: A successful compile is in no way a guarantee you are getting

closer to success!

(*) Use your 3rd party library LINUX make files as your starting point…

Page 15: How to migrate SourcePro apps from Solaris to Linux

15© 2017 Rogue Wave Software, Inc. All Rights Reserved.

“You will be glad you are a SourcePro user” – Useful Tip

After building the RW Libraries with RCB

• Go to /sourcepro/examples/tools (or network,math,ora)

• Go to ./12d directory (or whatever your configuration is)

• Issue a “make clean” (it only cleans the example)

• Issue a “make all” (it will rebuild the example)

• Observe the options used (they come from years of “research”)

• The new build should not contains any “-DRW…” except for a single one such as

“_RWCONFIG_12d”

Page 16: How to migrate SourcePro apps from Solaris to Linux

16© 2017 Rogue Wave Software, Inc. All Rights Reserved.

SourcePro Tags?

When you are building a

Rogue Wave Library, the

library will be named

following a number scheme…

0s RW_NO_STL

3s RWDEBUG, RW_NO_STL

4s RW_MULTI_THREAD, RW_NO_STL

7s RWDEBUG, RW_MULTI_THREAD, RW_NO_STL

8s RW_RWV12_STDLIB

11s RWDEBUG, RW_RWV12_STDLIB

12s RW_MULTI_THREAD, RW_RWV12_STDLIB _RWCONFIG_12s

15s RWDEBUG, RW_MULTI_THREAD, RW_RWV12_STDLIB _RWCONFIG_15s

0d RW_NO_STL, _RWTOOLSDLL

3d RWDEBUG, RW_NO_STL, _RWTOOLSDLL

4d RW_MULTI_THREAD, RW_NO_STL, _RWTOOLSDLL

7d RWDEBUG, RW_MULTI_THREAD, RW_NO_STL, _RWTOOLSDLL

8d _RWTOOLSDLL, RW_RWV12_STDLIB

11d RWDEBUG, _RWTOOLSDLL, RW_RWV12_STDLIB

12d RW_MULTI_THREAD, _RWTOOLSDLL, RW_RWV12_STDLIB _RWCONFIG_12d

15d RWDEBUG, RW_MULTI_THREAD, _RWTOOLSDLL, RW_RWV12_STDLIB _RWCONFIG_15d

If you are using anything else than 12d or 12s today and in production, you are probably doing something

wrong!

NEVER DEFINE THESE YOURSELF !!

USE THESE INSTEAD

15s and 15d is acceptable, but it’s debug code…

Page 17: How to migrate SourcePro apps from Solaris to Linux

17© 2017 Rogue Wave Software, Inc. All Rights Reserved.

#include <iostream.h> // incorrect

#include <iostream> // correct

int main()

{

cout << "hello world" << endl; // incorrect

std::cout << "hello world" << std::endl; // correct

return 0;

}

Keep using RWTime and RWDate, they are “safe”, even if you find “deprecated”

documentation (not anymore!)

RWTRegex<char> re("V[0-9]\\.[0-9]+"); RWCRExpr re("V[0-9]\\.[0-9]+");

RWCRExpr is replaced by RWTRegex<T>

Page 18: How to migrate SourcePro apps from Solaris to Linux

18© 2017 Rogue Wave Software, Inc. All Rights Reserved.

• RWTPtrDlist<T> becomes RWTPtrDlist<T,A>template<class T, class A = std::allocator<T*>> class RWTPtrDlist< T, A >

RWTPtrDlist<T> RWTPtrDlistIterator<T> RWTPtrHashSet<T> RWTPtrHashSetIterator<T> RWTPtrHashDictionary<K V> RWTPtrHashDictionaryIterator<K V> RWTPtrOrderedVector<T> RWTPtrSlist<T> RWTPtrSlistIterator<T> RWTPtrSortedVector<T> RWTValDlist<T> RWTValDlistIterator<T> RWTValHashSet<T> RWTValHashSetIterator<T> RWTValHashDictionary<K V> RWTValHashDictionaryIterator<K V> RWTValOrderedVector<T> RWTValSlist<T> RWTValSlistIterator<T> RWTValSortedVector<T>

• RWTPtrSortedVector<T> becomes RWTPtrSortedVector<T,C,A>C: Comparaison Function

• RWTPtrHashDictionary<K,V> becomes RWTPtrHashMap<K,T,H,EQ,A>K: Type for the KeyT: Type for the ValueH: Hash Function for the KeyEQ: Equality Function for the KeyA: Allocator

EASY CHANGE? Use of RWDefCArgs(T) (Comparaison) or RWDefHArgs(T) (Hash)

You may be using the right

API already!

Page 19: How to migrate SourcePro apps from Solaris to Linux

19© 2017 Rogue Wave Software, Inc. All Rights Reserved.

template <class T> struct RWTHasher

{

typedef unsigned(*hashfun)(const T&);

RWTHasher() : hfun_(NULL) {}

RWTHasher(hashfun f) : hfun_(f)

{ }

unsigned operator()(const T& t) const

{

RW_PRECONDITION(hfun_ != NULL);

return hfun_(t);

}

private: hashfun hfun_;

};

RWTValHashSet<RWCString> set(RWCString::hash);set.insert("one");

Original Code

typedef RWTValHashSet<RWCString, RWTHasher<RWCString>, std::equal_to<RWCString> > MY_Set;

MY_Set s1 = MY_Set(RWTHasher<RWCString>(&custom_hash));

typedef RWTValHashSet<RWCString RWDefHArgs(RWCString) > MY_Set;

MY_Set s1 = MY_Set(RWTHasher<RWCString>(&custom_hash));

unsigned custom_hash(const RWCString& ref_)

{ return ref_.hash(); }

n A

n B

New Code

Page 20: How to migrate SourcePro apps from Solaris to Linux

20© 2017 Rogue Wave Software, Inc. All Rights Reserved.

The SPARC architecture is big endian (BE) and it has forward byte ordering. Bit 0 is the least-significant bit, and byte 0 is the most-significant byte. Intel x86 architectures are little endian (LE) and byte 0 is the least-significant byte (LSB).

int a=0x11121314;

char b, *ptr;

ptr= (char *) &a; // pointer ptr

points to a

b= ptr[1]; // b is 0x13 in LE

and 0x12 in BE

Not really a frequent issue

Watch for networking communication & payloads

No problem with Rogue Wave Classes

Algorithm specific

Page 21: How to migrate SourcePro apps from Solaris to Linux

21© 2017 Rogue Wave Software, Inc. All Rights Reserved.

https://www.ibm.com/developerworks/systems/articles/porting_linux/

Page 22: How to migrate SourcePro apps from Solaris to Linux

22© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Page 23: How to migrate SourcePro apps from Solaris to Linux

23© 2017 Rogue Wave Software, Inc. All Rights Reserved.

“While it may look the same…”

-library=stlport4-library=Cstd (default)-library=stdcxx4

Solaris

libstdc++

Linux

void init(){

std::vector<std::vector<…> >…

Implementations are different.

They lead to potential performance pitfalls, due to

usage error.

Page 24: How to migrate SourcePro apps from Solaris to Linux

24© 2017 Rogue Wave Software, Inc. All Rights Reserved.

std::stringstd::vectorRWCStringRWTPtrVector… lot more…

Threading+

http://www.oracle.com/technetwork/articles/servers-storage-dev/mem-alloc-1557798.html

Heap-Management is different, may impact

performance or highlight concurrency bugs

MTS

Page 25: How to migrate SourcePro apps from Solaris to Linux

25© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Moving Away from Oracle Developer Studio? What’s available on Linux?

• https://www.roguewave.com/products-services/totalview

Amazing Replay Capability(Extremely Useful for runtime error)

Marketed as a HPC tools, but natively designed for Linux

Page 26: How to migrate SourcePro apps from Solaris to Linux

26© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Page 27: How to migrate SourcePro apps from Solaris to Linux

27© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Set-up milestones with your service provider

Successful build of Rogue Wave Library

Build Setup with justifications

Zero error compile & link of code

Be careful who you pick

Rogue Wave Support is often at the receiving end of some consultant’s incompetency. A Threading Programming Error

was once described as a “Rogue Wave is not thread safe!”

Interview your service provider

(Use what you learn today)

Train your Service Provider with

Rogue Wave’s help(1 day engagement)

Use Rogue Wave’s PSG

Page 28: How to migrate SourcePro apps from Solaris to Linux

28© 2017 Rogue Wave Software, Inc. All Rights Reserved.

A Path to success:

Learn about Rogue Wave

Review 3rd party dependencies

Define success criteria and tests

Build the Rogue Wave Libs you need

Migrate & Define Build Process – with

justifications

Code Changes

Rogue Wave Changes

Modernization Changes

Platform Changes

Repeat until Compile and Link with 0 errors

Dynamic & Performance Testing

Page 29: How to migrate SourcePro apps from Solaris to Linux

29© 2017 Rogue Wave Software, Inc. All Rights Reserved.