[openssl-users] Building OpenSSL on Linux , undefined reference to 'main'

Rob Hermann rhermann at centonline.com
Tue Feb 16 00:18:19 UTC 2016


that helped out greatly... the build gets past those errors.

1) "make clean"
2) "make dclean"
3) "sh config zlib"
4) "make"
5) "make tests" I get permission error on this one but that may just be 
my user.

  


On 2/15/2016 5:01 PM, Matt Caswell wrote:
>
> On 15/02/16 22:21, Rob Hermann wrote:
>>
>> [root at rhlinuxdev test]# ls -l md2test.c
>> -r--r--r--. 1 rhermann centadmin 0 Feb 12 15:40 md2test.c
> That is slightly surprising for two reasons. Firstly that is an empty
> file (size is 0). Secondly, it shouldn't be a file at all - it should be
> a symbolic link! Looks like somehow or other it has got corrupted.
>
> I also note that the date and timestamp is from a few days ago. Is that
> when you last ran the build steps, or have you done it since?
>
>  From the top level openssl directory try running "make clean" and "make
> dclean" followed by going through the build steps again.
>
> Matt
>
>
>>
>> On 2/15/2016 4:08 PM, Matt Caswell wrote:
>>> On 15/02/16 20:55, Rob Hermann wrote:
>>>> To follow up with a bit more detail
>>>>
>>>> The version of OpenSSL is 1.0.2e.
>>>>
>>>> The exact steps inside of my Linux environment that I take are
>>>>
>>>> 1) log in as su.
>>>> 2) run "make clean"
>>>> 3) run "sh config zlib"
>>>> the last line logged from this command is
>>>> "Configured for linux-elf"
>>> The only slightly strange thing here is running "make clean" before
>>> running "config". Normally I would run it afterwards.
>>>
>>>   From the test directory, what does "ls -l md2test.c" tell us about the
>>> link for that file?
>>>
>>> Matt
>>>
>>>> 4) run "make"
>>>>
>>>> the make gets as far as
>>>>
>>>> make[2]: Entering directory `/home/rhermann/src/OpenSSLWork/test'
>>>> ( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto  -ldl -lz}";
>>>> LDCMD="${LDCMD:-gcc}"; LDFLAGS="${LDFLAGS:--DZLIB -DOPENSSL_THREADS
>>>> -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -DL_ENDIAN -O3
>>>> -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS
>>>> -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
>>>> -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM
>>>> -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM}"; LIBPATH=`for x in $LIBDEPS;
>>>> do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo
>>>> $LIBPATH | sed -e 's/ /:/g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH
>>>> ${LDCMD} ${LDFLAGS} -o ${APPNAME:=ideatest} ideatest.o ${LIBDEPS} )
>>>> make[2]: Leaving directory `/home/rhermann/src/OpenSSLWork/test'
>>>> gcc -I.. -I../include  -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN
>>>> -DHAVE_DLFCN_H -Wa,--noexecstack -DL_ENDIAN -O3 -fomit-frame-pointer
>>>> -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2
>>>> -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM
>>>> -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM
>>>> -DWHIRLPOOL_ASM -DGHASH_ASM   -c -o md2test.o md2test.c
>>>> make[2]: Entering directory `/home/rhermann/src/OpenSSLWork/test'
>>>> ( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto  -ldl -lz}";
>>>> LDCMD="${LDCMD:-gcc}"; LDFLAGS="${LDFLAGS:--DZLIB -DOPENSSL_THREADS
>>>> -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -DL_ENDIAN -O3
>>>> -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS
>>>> -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
>>>> -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM
>>>> -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM}"; LIBPATH=`for x in $LIBDEPS;
>>>> do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo
>>>> $LIBPATH | sed -e 's/ /:/g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH
>>>> ${LDCMD} ${LDFLAGS} -o ${APPNAME:=md2test} md2test.o ${LIBDEPS} )
>>>> /usr/lib/gcc/i686-redhat-linux/4.4.7/../../../crt1.o: In function
>>>> `_start':
>>>> (.text+0x18): undefined reference to `main'
>>>> collect2: ld returned 1 exit status
>>>> make[2]: *** [link_app.] Error 1
>>>> make[2]: Leaving directory `/home/rhermann/src/OpenSSLWork/test'
>>>> make[1]: *** [md2test] Error 2
>>>> make[1]: Leaving directory `/home/rhermann/src/OpenSSLWork/test'
>>>> make: *** [build_tests] Error 1
>>>>
>>>>
>>>> it  does make it through build bntest.o,  ectest.o , ecdsatest,o,
>>>> ecdhtest.o, and ideatest.o
>>>>
>>>>
>>>>
>>>>
>>>> On 2/15/2016 1:59 PM, Rob Hermann wrote:
>>>>> I'm attempting to build OpenSSL on a Linux box, when I issue the make
>>>>> from my OpenSSL directory (OpenSSLWork as seen here),   It  builds all
>>>>> the subdirectories under crypto,
>>>>> then proceeds to
>>>>>
>>>>> OpenSSLWork/engines
>>>>> OpenSSLWork/ssl
>>>>> OpenSSLWork/apps
>>>>>
>>>>> OpenSSLWork/test
>>>>>
>>>>>
>>>>> making all in test...
>>>>> make[1]: Entering directory `/home/rhermann/src/OpenSSLWork/test'
>>>>> make[2]: Entering directory `/home/rhermann/src/OpenSSLWork/test'
>>>>> ( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto  -ldl}";
>>>>> LDCMD="${LDCMD:-gcc}"; LDFLAGS="${LDFLAGS:--DOPENSSL_THREADS
>>>>> -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -DL_ENDIAN
>>>>> -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS
>>>>> -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
>>>>> -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM
>>>>> -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM}"; LIBPATH=`for x in $LIBDEPS;
>>>>> do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo
>>>>> $LIBPATH | sed -e 's/ /:/g'`;
>>>>> LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o
>>>>> ${APPNAME:=md2test} md2test.o ${LIBDEPS} )
>>>>> _/usr/lib/gcc/i686-redhat-linux/4.4.7/../../../crt1.o: In function
>>>>> `_start':__
>>>>> __(.text+0x18): undefined reference to `main'__
>>>>> _collect2: ld returned 1 exit status
>>>>> make[2]: *** [link_app.] Error 1
>>>>> make[2]: Leaving directory `/home/rhermann/src/OpenSSLWork/test'
>>>>> make[1]: *** [md2test] Error 2
>>>>> make[1]: Leaving directory `/home/rhermann/src/OpenSSLWork/test'
>>>>> make: *** [build_tests] Error 1
>>>>>
>>>>> I know this means I'm missing the main() function the entry point for
>>>>> all C programs.
>>>>> I'm trying to build OpenSSL using the procedures outlined in the
>>>>> INSTALL document,  Has anyone seen this before and if so, what have
>>>>> you done to "fix" it ?
>>>>>
>>>>> I've tried -nostartfiles as a linker option and that did not help.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>



More information about the openssl-users mailing list