porting: Linux to Freebsd

2010-10-02 Thread Chetan Shukla
Hi,
Could someone please outline the steps needed in porting a general application 
from
Linux to FreeBSD.


Thanks  Regards,
Chetan



DISCLAIMER: This message is proprietary to Aricent and is intended solely for 
the use of the individual to whom it is addressed. It may contain privileged or 
confidential information and should not be circulated or used for any purpose 
other than for what it is intended. If you have received this message in error, 
please notify the originator immediately. If you are not the intended 
recipient, you are notified that you are strictly prohibited from using, 
copying, altering, or disclosing the contents of this message. Aricent accepts 
no responsibility for loss or damage arising from the use of the information 
transmitted by this email including damage from virus.
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2010-10-02 Thread Dominic Fandrey
On 02/10/2010 08:42, Chetan Shukla wrote:
 Hi,
 Could someone please outline the steps needed in porting a general 
 application from
 Linux to FreeBSD.

If the thing is not tightly coupled to the kernel, the general
compile guide to the software you try to compile will suffice
most of the time.

Regards
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2010-10-02 Thread Eitan Adler
On Sat, Oct 2, 2010 at 2:42 AM, Chetan Shukla chetan.shu...@aricent.com wrote:
 Hi,
 Could someone please outline the steps needed in porting a general 
 application from
 Linux to FreeBSD.


 Thanks  Regards,
 Chetan

You may want to have a look at http://wiki.freebsd.org/AvoidingLinuxisms
If you ask a more specific question you will probably get more specific answers.

-- 
Eitan Adler
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-22 Thread Matthias Andree
Am 08.06.2009, 21:15 Uhr, schrieb Peter Jeremy  
peterjer...@optushome.com.au:



On 2009-Jun-08 11:33:27 -0400, Robert Huff roberth...@rcn.com wrote:

Alexander Leidinger writes:

Right: I re-ran under bash, and got the same problems.
Looking at configure.ac, I see:
 
  AC_PATH_PROG(YACC,byacc,no)
  if test x$YACC == xno

 This should be a =, not a ==.


Same result.


Relevant bit is:
 
  for ac_remove_CFLAG in -O1 -O2 -O3 ; do
CFLAGS=${CFLAGS//${ac_remove_CFLAG}/}
CPPFLAGS=${CPPFLAGS//${ac_remove_CFLAG}/}
CXXFLAGS=${CXXFLAGS//${ac_remove_CFLAG}/}
  done

 Quick try:
 CFLAGS=`echo $CFLAGS | sed -e 's:-O[123]::g'`


No change here either.


Obvious question but if you edited configure.ac, you did remember to
rerun autoconf afterwards didn't you?  Can you post the configure
script?

Note that your problems with configure do not surprise me.  Despite
claims otherwise, it appears to have been designed (using the word
very loosely) as a tool to impede application portability.


I beg to differ on impede. It's a tool, as you're writing, and as such,  
it can only be as powerful as its operator. Programmers using non-portable  
shell code are subverting the tool, not using it.


Operating systems also have their share there. For instance, all too many  
FreeBSD system header files are _not_ standalone, but have undocumented  
dependencies on other headers, even if that runs counter to IEEE Std.  
1003.1 (aka Single Unix Specification or POSIX). While such bugs are  
easily fixed, it's often hard for the learning porter to do...


So rather than spraying non-helpful comments over the thread (if you have  
issues with autoconf, file bug reports or contribute to make autoconf - or  
another tool you deem more suitable - better).


--
Matthias Andree
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-09 Thread Alexander Leidinger
Quoting Robert Huff roberth...@rcn.com (from Mon, 8 Jun 2009  
16:36:58 -0400):



Peter Jeremy writes:



for ac_remove_CFLAG in -O1 -O2 -O3 ; do
CFLAGS=${CFLAGS//${ac_remove_CFLAG}/}
CPPFLAGS=${CPPFLAGS//${ac_remove_CFLAG}/}
CXXFLAGS=${CXXFLAGS//${ac_remove_CFLAG}/}
done
 
   Quick try:
   CFLAGS=`echo $CFLAGS | sed -e 's:-O[123]::g'`
 
No change here either.

 Obvious question but if you edited configure.ac, you did remember to
 rerun autoconf afterwards didn't you?


Uh ... no.  (When I said complete novice, wasn't kidding. :-)


Not knowing C/++ when you want to port a C/C++ program makes it very  
hard for you to reach your goal...



Ran autoconf(-2.62).
That seems to have fixed the configure stage.
I'm into compilation, and:

/usr/include/malloc.h:3:2: error: #error malloc.h has been  
replaced by stdlib.h


You didn't provide enough info. There should have been a line or two  
more which referenced files in the src of what you want to compile. In  
those places you have to replace the '#include malloc.h' with  
'#include stdlib.h'.


Bye,
Alexander.

Bye,
Alexander.

--
1.79 x 10^12 furlongs per fortnight -- it's not just a good idea, it's
the law!

http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-09 Thread Robert Huff

Alexander Leidinger writes:

Obvious question but if you edited configure.ac, you did remember to
rerun autoconf afterwards didn't you?
  
  Uh ... no.  (When I said complete novice, wasn't kidding. :-)
  
  Not knowing C/++ when you want to port a C/C++ program makes it very  
  hard for you to reach your goal...

C, I know.  (Though not as much as other folks.)
GNU build tools ... not so much.
:-)

Anyway: many hours of compilation later, I hit this:

/usr/bin/ld: cannot find -lttf

Quick checking suggests libttf is a Linux-ism, replaced by
libfreetype.  Is this correct, and if so can I just (temporarily)
make the change in the list of libraries?


Robert Huff


___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-09 Thread Boris Kochergin

Robert Huff wrote:

Alexander Leidinger writes:

  

   Obvious question but if you edited configure.ac, you did remember to
   rerun autoconf afterwards didn't you?
 
Uh ... no.  (When I said complete novice, wasn't kidding. :-)
 
 Not knowing C/++ when you want to port a C/C++ program makes it very  
 hard for you to reach your goal...



C, I know.  (Though not as much as other folks.)
GNU build tools ... not so much.
:-)

Anyway: many hours of compilation later, I hit this:

/usr/bin/ld: cannot find -lttf

Quick checking suggests libttf is a Linux-ism, replaced by
libfreetype.  Is this correct, and if so can I just (temporarily)
make the change in the list of libraries?


Robert Huff


___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org
  
Seems that way 
(http://fixunix.com/redhat/139735-fly-make-problem-fc3.html). Anyway, it 
will be sure to complain about not being able to find the symbols it's 
looking for if it's not the case.


-Boris
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-09 Thread Alexander Leidinger
Quoting Robert Huff roberth...@rcn.com (from Tue, 9 Jun 2009  
08:34:46 -0400):




Alexander Leidinger writes:


   Obvious question but if you edited configure.ac, you did remember to
   rerun autoconf afterwards didn't you?
 
Uh ... no.  (When I said complete novice, wasn't kidding. :-)

 Not knowing C/++ when you want to port a C/C++ program makes it very
 hard for you to reach your goal...


C, I know.  (Though not as much as other folks.)
GNU build tools ... not so much.
:-)

Anyway: many hours of compilation later, I hit this:

/usr/bin/ld: cannot find -lttf

Quick checking suggests libttf is a Linux-ism, replaced by
libfreetype.  Is this correct, and if so can I just (temporarily)
make the change in the list of libraries?


Why not just try it?

Note, there is/was freetype1 and freetype2...

Bye,
Alexander.

--
Legalize free-enterprise murder: why should governments have all the
fun?

http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-09 Thread Robert Huff

Alexander Leidinger writes:
  Quick checking suggests libttf is a Linux-ism, replaced by
   libfreetype.  Is this correct, and if so can I just (temporarily)
   make the change in the list of libraries?
  
  Why not just try it?
  
  Note, there is/was freetype1 and freetype2...

True.  I only have freetype2 installed; we'll see if that does
the trick.
Um - looks like not.  Installing freetype1.
AH-hah.  print/freetype2 installs libfreetype; print/freetype
installs libttf.  That fixed it.

The program compiles and installs.
Before running (for which I may be back for more help) I'm
going to re-initialize the code base and check to make sure my
change notes work.

Profuse thanks to everyone for the help.



Robert Huff

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-08 Thread Alexander Leidinger
Quoting Robert Huff roberth...@rcn.com (from Mon, 8 Jun 2009  
01:01:32 -0400):




Is there anyone out there with experience porting from Linux to
FreeBSD and/or writing code for both who can spare a few cycles to
help a complete novice figure out what's different (and how to fix
it)?


Have a look at http://wiki.freebsd.org/AvoidingLinuxisms for some  
generic advise. Feel free to propose things to add there (or add them  
yourself, we hand out write access upon request).


If you do not know how to port a specific part of an application to  
FreeBSD, feel free to ask here (or on a more specific ML, e.g. if it  
is network related, the network ML of FreeBSD is maybe better suited).


Bye,
Alexander.

--
The plural of spouse is spice.

http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-08 Thread Peter Jeremy
On 2009-Jun-08 01:01:32 -0400, Robert Huff roberth...@rcn.com wrote:
   Is there anyone out there with experience porting from Linux to
FreeBSD and/or writing code for both who can spare a few cycles to
help a complete novice figure out what's different (and how to fix
it)?

That's an extremely open-ended question.  Probably the biggest issue
is the use of GNU extensions in system utilities - particularly the
assumption that /bin/sh is bash.

You would probably be better off asking specific questions on problems
that you run into.

-- 
Peter Jeremy


pgpKgMCicra7N.pgp
Description: PGP signature


Re: porting: Linux to Freebsd

2009-06-08 Thread Alexander Leidinger
Quoting Robert Huff roberth...@rcn.com (from Mon, 8 Jun 2009  
08:07:08 -0400):



First problem:


Looks like bash-isms in configure.


When following the instructions here
http://ctp2.darkdust.net/anonsvn/branches/linux/doc/README.linux; I
get to step 2 (configure) and get this:

appending configuration tag F77 to libtool
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... none needed
checking whether yytext is a pointer... no
checking for byacc... /usr/bin/byacc
test: x/usr/bin/byacc: unexpected operator


Some possibilities:
 - In the test for byacc they maybe forgot quotes to protect an empty value.
 - wrong operator used in test
 - unknown bashism


checking for unzip... /usr/local/bin/unzip
test: x/usr/local/bin/unzip: unexpected operator


The same as above.

[...]

checking for acroread... /usr/local/bin/acroread
./configure: ${CFLAGS/...}: Bad substitution


Looks liek bashism. Someone tries to substitute something in CFLAGS,  
but this kind of advanced substitution is not supported in a posix  
compliant sh. You can test this assumption by installing bash and  
runnging bash ./configure instead. If it is true, you need to fix  
configure.in or configure.ac.


Bye,
Alexander.

--
This unit... must... survive.

http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-08 Thread Robert Huff

Alexander Leidinger writes:

  First problem:
  
  Looks like bash-isms in configure.

for (i = 0; i  10; i++) hit_forehead_with_desk();

I had already figured out replacing make with gmake; this
should have been obvious.

  
  When following the instructions here
   http://ctp2.darkdust.net/anonsvn/branches/linux/doc/README.linux; I
   get to step 2 (configure) and get this:
  
   test: x/usr/bin/byacc: unexpected operator
  
  Some possibilities:
- In the test for byacc they maybe forgot quotes to protect an empty value.
- wrong operator used in test
- unknown bashism

Right: I re-ran under bash, and got the same problems.
Looking at configure.ac, I see:

AC_PATH_PROG(YACC,byacc,no)
if test x$YACC == xno
then
   AC_MSG_ERROR([

byacc could not be found!

Make sure byacc is in your path.
 
   ])
else
   YACC=${YACC}
   YFLAGS=-d -v
   AC_SUBST(YACC)
   AC_SUBST(YFLAGS)
   AC_DEFINE(AUTOMAKE_INVOKES_YACC,1,[Defined when automake runs yacc and 
renames the output files])
fi


   checking for acroread... /usr/local/bin/acroread
   ./configure: ${CFLAGS/...}: Bad substitution
  
  Looks like bashism. Someone tries to substitute something in CFLAGS,  
  but this kind of advanced substitution is not supported in a posix  
  compliant sh. You can test this assumption by installing bash and  
  runnging bash ./configure instead. If it is true, you need to fix  
  configure.in or configure.ac.

Relevant bit is:

for ac_remove_CFLAG in -O1 -O2 -O3 ; do
CFLAGS=${CFLAGS//${ac_remove_CFLAG}/}
CPPFLAGS=${CPPFLAGS//${ac_remove_CFLAG}/}
CXXFLAGS=${CXXFLAGS//${ac_remove_CFLAG}/}
done


Robert Huff

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-08 Thread Alexander Leidinger
Quoting Robert Huff roberth...@rcn.com (from Mon, 8 Jun 2009  
09:53:29 -0400):




Alexander Leidinger writes:


First problem:

 Looks like bash-isms in configure.


for (i = 0; i  10; i++) hit_forehead_with_desk();

I had already figured out replacing make with gmake; this
should have been obvious.



When following the instructions here
  http://ctp2.darkdust.net/anonsvn/branches/linux/doc/README.linux; I
  get to step 2 (configure) and get this:
 
  test: x/usr/bin/byacc: unexpected operator

 Some possibilities:
   - In the test for byacc they maybe forgot quotes to protect an  
empty value.

   - wrong operator used in test
   - unknown bashism


Right: I re-ran under bash, and got the same problems.
Looking at configure.ac, I see:

AC_PATH_PROG(YACC,byacc,no)
if test x$YACC == xno


This should be a =, not a ==.


 Looks like bashism. Someone tries to substitute something in CFLAGS,
 but this kind of advanced substitution is not supported in a posix
 compliant sh. You can test this assumption by installing bash and
 runnging bash ./configure instead. If it is true, you need to fix
 configure.in or configure.ac.


Relevant bit is:

for ac_remove_CFLAG in -O1 -O2 -O3 ; do
CFLAGS=${CFLAGS//${ac_remove_CFLAG}/}
CPPFLAGS=${CPPFLAGS//${ac_remove_CFLAG}/}
CXXFLAGS=${CXXFLAGS//${ac_remove_CFLAG}/}
done


Quick try:
CFLAGS=`echo $CFLAGS | sed -e 's:-O[123]::g'`

Bye,
Alexander.

--
MANAGER:
A man known for giving great meeting.

http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-08 Thread Robert Huff
Alexander Leidinger writes:
  Right: I re-ran under bash, and got the same problems.
  Looking at configure.ac, I see:
  
   AC_PATH_PROG(YACC,byacc,no)
   if test x$YACC == xno
  
  This should be a =, not a ==.

Same result.

  Relevant bit is:
  
   for ac_remove_CFLAG in -O1 -O2 -O3 ; do
  CFLAGS=${CFLAGS//${ac_remove_CFLAG}/}
  CPPFLAGS=${CPPFLAGS//${ac_remove_CFLAG}/}
  CXXFLAGS=${CXXFLAGS//${ac_remove_CFLAG}/}
   done
  
  Quick try:
  CFLAGS=`echo $CFLAGS | sed -e 's:-O[123]::g'`

No change here either.


Robert Huff

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-08 Thread Peter Jeremy
On 2009-Jun-08 11:33:27 -0400, Robert Huff roberth...@rcn.com wrote:
Alexander Leidinger writes:
 Right: I re-ran under bash, and got the same problems.
 Looking at configure.ac, I see:
  
   AC_PATH_PROG(YACC,byacc,no)
   if test x$YACC == xno
  
  This should be a =, not a ==.

   Same result.

 Relevant bit is:
  
   for ac_remove_CFLAG in -O1 -O2 -O3 ; do
 CFLAGS=${CFLAGS//${ac_remove_CFLAG}/}
 CPPFLAGS=${CPPFLAGS//${ac_remove_CFLAG}/}
 CXXFLAGS=${CXXFLAGS//${ac_remove_CFLAG}/}
   done
  
  Quick try:
  CFLAGS=`echo $CFLAGS | sed -e 's:-O[123]::g'`

   No change here either.

Obvious question but if you edited configure.ac, you did remember to
rerun autoconf afterwards didn't you?  Can you post the configure
script?

Note that your problems with configure do not surprise me.  Despite
claims otherwise, it appears to have been designed (using the word
very loosely) as a tool to impede application portability.

-- 
Peter Jeremy


pgpXyJZsU2fTs.pgp
Description: PGP signature


Re: porting: Linux to Freebsd

2009-06-08 Thread Robert Huff
Peter Jeremy writes:


 for ac_remove_CFLAG in -O1 -O2 -O3 ; do
CFLAGS=${CFLAGS//${ac_remove_CFLAG}/}
CPPFLAGS=${CPPFLAGS//${ac_remove_CFLAG}/}
CXXFLAGS=${CXXFLAGS//${ac_remove_CFLAG}/}
 done

Quick try:
CFLAGS=`echo $CFLAGS | sed -e 's:-O[123]::g'`
  
  No change here either.
  
  Obvious question but if you edited configure.ac, you did remember to
  rerun autoconf afterwards didn't you?

Uh ... no.  (When I said complete novice, wasn't kidding. :-)
Ran autoconf(-2.62).
That seems to have fixed the configure stage.
I'm into compilation, and:

/usr/include/malloc.h:3:2: error: #error malloc.h has been replaced by 
stdlib.h


Robert Huff

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-08 Thread Robert Huff

Lowell Gilbert writes:

   /usr/include/malloc.h:3:2: error: #error malloc.h has been replaced by 
 stdlib.h
  
  Whichever file is being compiled has a line that should be changed from 
   #include malloc.h
  to 
   #include stdlib.h

Done.  Merrily compiling away.




___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: porting: Linux to Freebsd

2009-06-08 Thread Boris Kochergin

Robert Huff wrote:

Robert Huff writes:

  

Done.  Merrily compiling away.



New problem.
One of the files has:

#ifdef LINUX
#include sys/mman.h
#endif

What is the FreeBSD magic tag corresponding to LINUX?
__FREEBSD__?


Robert Huff



___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org
  

#ifdef __FreeBSD__

-Boris
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org