PDA

View Full Version : Errors in SLES11



Supriya
27-Oct-2014, 05:58
Hello
recently i magrated my server from SLES10 SLES11.2, gcc copmlier 4.3.4&binutils 2.21. when i am doing builds i am getting errors as atoi,setenv,etc was not declared in the scope and one more error Unrecognized option "--build id".

1.
g++ /home/ismdev/sources/cfsw/source/wscafl02.cpp -c -o /home/ismdev/builds/sap/build/wscafl02.o -fexceptions -DTRACE -DCFSW -DSAP -DWEB -DCFSWEB_LINUX2VM -DCFSWEB_SWNT_SAP -DCFSWEB_SAVERESTORE -m32 -ggdb -DCOMPILER_MIGRATION -DISPF_EXCLUDE -I/home/ismdev/sources/cfsw/include -I/home/ismdev/sources/cfsw/components/logclient/include -I/home/ismdev/sources/ispf_emulator/include -I/home/ismdev/sources/wscapi/include -I/home/ismdev/sources/crf/include -I/usr/include/libxml2 -I/usr/include/curl
/home/ismdev/sources/cfsw/source/wscafl02.cpp: In member function ‚RESULT WSCAFL02_FileUploadPanel::CheckAuthorization()‚:
/home/ismdev/sources/cfsw/source/wscafl02.cpp:1849: error: ‚getenv‚ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:1849: error: ‚setenv‚ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:1926: error: ‚atoi‚ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:1942: error: ‚atoi‚ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:1954: error: ‚free‚ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:2007: error: ‚atoi‚ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:2013: error: ‚free‚ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp: In member function ‚RESULT WSCAFL02_FileUploadPanel::CheckAuthCFReportRestore ()‚:
/home/ismdev/sources/cfsw/source/wscafl02.cpp:2142: error: ‚atoi‚ was not declared in this scope
make[2]: *** [/home/ismdev/builds/sap/build/wscafl02.o] Error 1



2.
g++ -o /home/ismdev/builds/sap/build/ismcache.module /home/ismdev/builds/sap/build/wsconfig.o /home/ismdev/builds/sap/build/settings_manager.o /home/ismdev/builds/sap/build/wscwmqc.o /home/ismdev/builds/sap/build/cmqasync.o /home/ismdev/builds/sap/build/wscwrdcc.o -L/home/ismdev/builds/sap/build -L/home/ismdev/builds/wscapi/build -L/home/ismdev/builds/ispf/build -L/home/ismdev/builds/sap/build -Xlinker -\( -lwsc135 -lwscx10a -lwscx10b -lwscx10c -lwscp10a -lwscp10b -lwscp10c -lwscp10d -lwscv10 -lwscv111a -lwscv111b -lwscv111c -lwscegg -lwscu10 -lwscde10 -lwscd10a -lwscgl10a -lwscgl10b -lwscgl10c -lwscli10 -lwscna10 -lwscpr10 -lwscse10 -lwscva10 -lwscr10a -lwscr10b -lwscr10c -lwscaci10 -lwscrsap -lwscw10 -lapit -lispf -lpanel -lform -lncurses -lcurl -lxml2 -lssl -lmqic -lsapnt -Xlinker -\) -m32 -Xlinker --export-dynamic
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: unrecognized option '--build-id'
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
make[1]: *** [ismcache.module] Error 1

Supriya
28-Oct-2014, 11:22
Hello
please help me with it. anyone can be much appreciated.

Thanks

mikewillis
28-Oct-2014, 12:30
Hello
please help me with it. anyone can be much appreciated.

Thanks

I think the reason you've not got any replies so far is in large part because it's not at all clear what you are trying to do. You're trying to compile something, but what exactly is it you're trying to compile?

I'm curious why you've updated to SLES 11 SP2 rather than SLES 11 SP3 given that SP2 is already End Of Life.

jmozdzen
28-Oct-2014, 13:31
Hi Supriya,

> /home/ismdev/sources/cfsw/source/wscafl02.cpp:1849: error: ‚getenv‚ was not declared in this scope
> ...

does that source file include the proper include files? It's rather typical that gcc gets more picky over versions, pointing out errors and warnings that were not reported earlier.

See "man 3 getenv" etc. for details.

> /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: unrecognized option '--build-id'
> /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: use the --help option for usage information

That one looks strange. You might want to call that ld (which ought to be a symlink effectively pointing to /usr/bin/ld) with "--help" to check if it mentions that option - my SLES11SP3 version does.

Regards,
Jens

malcolmlewis
28-Oct-2014, 14:34
On Tue 28 Oct 2014 12:34:02 PM CDT, jmozdzen wrote:


Hi Supriya,

> /home/ismdev/sources/cfsw/source/wscafl02.cpp:1849: error: _getenv_
was not declared in this scope
> ...

does that source file include the proper include files? It's rather
typical that gcc gets more picky over versions, pointing out errors and
warnings that were not reported earlier.

See "man 3 getenv" etc. for details.

>
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld:
unrecognized option '--build-id'
>
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld:
use the --help option for usage information

That one looks strange. You might want to call that ld (which ought to
be a symlink effectively pointing to /usr/bin/ld) with "--help" to check
if it mentions that option - my SLES11SP3 version does.

Regards,
Jens




Hi
When having linking issues with older code, exporting the following
before you compile some times helps...



export SUSE_ASNEEDED=0


--
Cheers Malcolm ¬į¬Ņ¬į LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel 3.12.28-4-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below... Thanks!

jmozdzen
28-Oct-2014, 15:15
Hi Malcolm,

learning something new every day... interesting way to revert that "as-needed" linker flag :)

In this case, I believe that this variable wouldn't help much: The linker statement is already using a link group to wrap all libraries (to avoid the "symbol not found because of lib ordering" issue) and no missing symbols are reported by the linker, anyhow. But from what I can tell, the linker should support the "--build-id" option, Why it is complaining about it, I cannot tell. Do you have an idea what may be causing this, have I overlooked something in the linker parameters used?

Regards,
Jens

Supriya
28-Oct-2014, 16:18
SLES11 SP2 is mandatory for me. All the libraries are installed and i have some files. When i am compiling those i am getting those errors. i don't know why those errors are getting exactly. Thanks

jmozdzen
28-Oct-2014, 16:44
Hi Supriya,

i don't know why those errors are getting exactly.

are you the developer in charge of those sources?

Regards,
Jens

Supriya
28-Oct-2014, 17:30
no i am not. i am working on migrating an old server to new server. for that i copied all sources from old to new server and i installed all libraries which the server needed. after that when i tried to compile those sources i am getting errors.

jmozdzen
28-Oct-2014, 18:04
Hi Supriya,

then I'll try my best, at least to explain... but it'd be helpful if you had someone with a bit of C coding experience at hand...

When stumbling over a function call within some C code, the compiler tries to check if the programmer gave proper parameters to the function call. In order to do that verification, the compiler has to know about the number of required parameters and their types, this information is provided in so-called "header files" (because they include the function signature headers, among other information) or "include files" (because a "#include" statement is used to link your source to those files). In the C world, these files have names that end in ".h".

The older a compiler you come across, the less picky it acts. Early C compilers didn't even have a mean to check the function signatures nor cared if the function existed at all. Later compilers issued warnings, modern compilers are more rigorous, as you have found out.

Now, for each function that the compiler complains about, you need to find the name of the proper include file, and include that file once. The functions that were reported in your first post were all system functions, coming from stdlib.h, so you'll have to insert an include statement in the source code file. Usually, you put these at the beginning of the file, so look for some block of include statement and add

#include <stdlib.h>
Now the compiler complaints should have gone away.

I still have no clue what's wrong with the linker invocation, so I currently cannot help you with that, unfortunately.

Regards,
Jens

Supriya
29-Oct-2014, 05:56
I kept all my libraries in /usr/include I don't want to keep that libraries in source code. In old server we follow same process that time they compiled successfully. now why they are giving error.

my libraries are in
ismdev@INMBZ2197:/usr/include> ls
stdlib.h
string.h
stdint.h
All libarries are included like this.

Supriya
29-Oct-2014, 08:36
It is not working for this linking error.

[QUOTE=malcolmlewis;24393]Hi
When having linking issues with older code, exporting the following
before you compile some times helps...



export SUSE_ASNEEDED=0


--

jmozdzen
29-Oct-2014, 10:56
Hi Supriya,

I kept all my libraries in /usr/include I don't want to keep that libraries in source code. In old server we follow same process that time they compiled successfully. now why they are giving error.

my libraries are in
ismdev@INMBZ2197:/usr/include> ls
stdlib.h
string.h
stdint.h
All libarries are included like this.

to me it seems this is no product problem, but requires (at least basic "C") programming skills. Teaching C programming is beyond the scope of this forum, I suggest that you either get some local person from that area to help you out (should be a matter of an hour or less, judging from your description) or try some forum specialized on C/C++ programming if you want to learn the language and programming fundamentals.

Regards,
Jens

Supriya
29-Oct-2014, 11:31
I know C++ programming. my problem is that if i include that stdlib.h in source file then error won't occur. but as per my requirement lib will not be include in source fiels. those libraries need to keep inside /usr/include from there source file will take that libraries and do compilation. in previous servers it works fine. while i am doing the same in new server it is giving error.

jmozdzen
29-Oct-2014, 11:47
Hi Supriya,

I know C++ programming.
ah, that's good.


my problem is that if i include that stdlib.h in source file then error won't occur.
That's even better - because that#s the way things are to work ;)


but as per my requirement lib will not be include in source fiels. those libraries need to keep inside /usr/include from there source file will take that libraries and do compilation. in previous servers it works fine. while i am doing the same in new server it is giving error

Most likely I'm not understanding you correctly - those files in /usr/include are no libraries, but header files, and you *need* to include them in order to use them. That's what they are written for. What else do you mean with "from there source file will take that libraries and do compilation"?

That it worked in older versions is likely to blame on the carelessness of the older compilers.

Regards,
Jens